-
Notifications
You must be signed in to change notification settings - Fork 6
[observability] most basic OpenTelemetry integration into MCK #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
1b6922c
to
3420830
Compare
- name: OTEL_SERVICE_NAME | ||
value: evergreen-agent | ||
value: mongodb-e2e-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the service-name for better querying
scripts/evergreen/e2e/e2e.sh
Outdated
reset_namespace "$(kubectl config current-context)" "${NAMESPACE}" || true | ||
fi | ||
# If the test passed, then the namespace is removed | ||
delete_operator "${NAMESPACE}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should remove the operator to test teardown at the end of the test-run + it enables us to ensure traces are exported in time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces basic OpenTelemetry tracing support into the MongoDB Kubernetes Operator to improve observability and debugging. Key changes include the integration of OpenTelemetry libraries and configuration in main.go and pkg/telemetry, updates to Helm chart values and templates for trace propagation, and accompanying changes in deployment and test scripts to ensure correct trace information is passed.
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
scripts/funcs/operator_deployment | Adds OpenTelemetry environment variable handling to operator deployment configuration. |
scripts/funcs/kubernetes | Updates operator naming and adjusts deployment deletion commands. |
scripts/evergreen/e2e/e2e.sh | Introduces cluster diagnostics and cleanup functions for enhanced troubleshooting. |
scripts/evergreen/deployments/test-app/templates/mongodb-enterprise-tests.yaml | Modifies environment variables to set the correct service name in traces. |
pkg/telemetry/* | Implements tracing setup, span creation, and propagation via new OpenTelemetry integrations. |
pipeline.py | Updates comment on trace flags to reflect sampling behavior. |
main.go | Integrates tracing setup with graceful shutdown and propagates trace context to controllers and webhooks. |
helm_chart/* | Adds OpenTelemetry configuration options to Helm chart values and templates. |
go.mod | Introduces OpenTelemetry dependencies. |
docker/mongodb-kubernetes-tests/tests/conftest.py | Replaces print with logger and corrects a spelling mistake in a comment. |
LICENSE-THIRD-PARTY | Updates third-party dependency list to include new OpenTelemetry libraries. |
Co-authored-by: Copilot <[email protected]>
Summary
This pull request introduces OpenTelemetry tracing support to the MongoDB Kubernetes Operator and its related components. Key changes include the integration of OpenTelemetry libraries, the addition of tracing configuration, and updates to ensure trace propagation across the application. These changes enhance observability and debugging capabilities.
In our CI suite this means we will have the following kind of traces:
OpenTelemetry Integration:
main.go
:main
function, including trace and span ID extraction from environment variables and the creation of a root span for the operator. Tracing context is propagated across controllers and shutdown processes are handled gracefully.pkg/telemetry/client.go
: <--- this is good to know if we happen to make a change and happen to send to prod atlasSendEventWithRetry
function to capture telemetry events and include the Atlas base URL as a span attribute.Helm Chart Updates:
OTEL_TRACE_ID
,OTEL_PARENT_ID
,OTEL_EXPORTER_OTLP_ENDPOINT
) to the operator's deployment template. ([helm_chart/templates/operator.yamlR83-R90](https://github.com/mongodb/mongodb-kubernetes/pull/93/files#diff-5d2e377a6806023ca9eff60be4d7e5cd879803de2bd3800b630f479f8728f322R83-R90)
)enabled
,traceID
,parentID
,collectorEndpoint
) in the Helm chart'svalues.yaml
.Dependency Updates:
otel
,otel/sdk
,otel/trace
, etc.) togo.mod
.Proof of Work
e.g. patch
generated traces in our ci: Link

Checklist
Reminder (Please remove this when merging)