Repository navigation
[OTEL-3364] feat(otel): add OTel startup logs environment configuration and tests - #7978
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f0799b50ea
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
✅ All CI checks and tests passed. 🎉 All green!🧪 All tests passed 🔗 Commit SHA: 306d600 | Docs | View more details | Give us feedback! |
nccatoni
left a comment
There was a problem hiding this comment.
You should probably also get a review from someone familiar with the feature
## Summary of changes Expose resolved OpenTelemetry configuration as flat uppercase fields in the existing `DATADOG TRACER CONFIGURATION` startup JSON. Added feature gates: - `OTEL_ENABLED` - `DD_TRACE_OTEL_ENABLED` - `DD_METRICS_OTEL_ENABLED` - `DD_LOGS_OTEL_ENABLED` - `DD_TRACE_OTEL_SEMANTICS_ENABLED` Added exporter settings, emitted for each enabled OTLP pipeline: - `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` - `OTEL_EXPORTER_OTLP_TRACES_PROTOCOL` - `OTEL_EXPORTER_OTLP_TRACES_HEADERS` - `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` - `OTEL_EXPORTER_OTLP_METRICS_PROTOCOL` - `OTEL_EXPORTER_OTLP_METRICS_HEADERS` - `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT` - `OTEL_EXPORTER_OTLP_LOGS_PROTOCOL` - `OTEL_EXPORTER_OTLP_LOGS_HEADERS` Added shared and trace settings: - `OTEL_LOG_LEVEL` - `OTEL_SERVICE_NAME` - `OTEL_RESOURCE_ATTRIBUTES` - `OTEL_PROPAGATORS`, when injection and extraction use the same sequence - `OTEL_TRACES_SAMPLER`, when the managed sampler has a supported global rate - `OTEL_TRACES_SAMPLER_ARG`, for rates strictly between zero and one Added logs settings: - `OTEL_LOGS_EXPORTER` - `OTEL_BLRP_SCHEDULE_DELAY`, when OTLP logs export is enabled - `OTEL_BLRP_MAX_QUEUE_SIZE`, when OTLP logs export is enabled - `OTEL_BLRP_MAX_EXPORT_BATCH_SIZE`, when OTLP logs export is enabled Added metrics settings, emitted when OTLP metrics export is enabled: - `OTEL_METRIC_EXPORT_INTERVAL` - `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` ## Reason for change [OTEL-3367](https://datadoghq.atlassian.net/browse/OTEL-3367): make the configuration used by OTel integrations and exporters visible at startup, including existing defaults, precedence, and fallback behavior. This extends the idea in [#8936](#8936) to cover exporter, trace, logs, and metrics settings. Whenever possible, it uses the matching "OTEL_" env var name (the main target here is onboarding OTel consumers). ## Implementation details - Share metrics/logs export predicates, including framework support, between runtime code and startup logging; reuse the existing trace export predicate. - Share sampling-rate validation through `EffectiveGlobalSamplingRate` and read propagator names from resolved instances. Emit `OTEL_PROPAGATORS` only when injection and extraction match. - Reuse existing exporter, logs batching, and metrics getters. Redact header values and report intervals in milliseconds. `OTEL_BLRP_*` fields reflect existing `DD_LOGS_DIRECT_SUBMISSION_*` settings, without adding new inputs. - Read the effective log level, service name, and global tags. Resource attributes use the existing `key:value` array representation. ## Test coverage Startup-log coverage is maintained in [system-tests #7978](DataDog/system-tests#7978). No new assertions or test-only serialization methods are added in this PR. Existing configuration, sampling, propagation, and exporter tests were run locally, and the managed targets and integration-test project compiled. A local run against [#7978](DataDog/system-tests#7978) with the tracer built from the earlier implementation revision completed with 15 passed and 12 failed. The missing fields fall into these categories: - Generic `OTEL_EXPORTER_OTLP_*`: report per-signal effective values instead. - Additional `DD_*` fields and `OTEL_TRACES_EXPORTER`: supported settings whose uppercase startup-log fields are not added by this PR. - `OTEL_SEMCONV_STABILITY_OPT_IN` and `DD_DBM_TRACE_PREPARED_STATEMENTS`: unsupported configuration inputs in .NET. - `OTEL_TRACES_SAMPLER_ARG`: only emitted for ratio sampling; the test requires it for `always_on` too. - `OTEL_BLRP_EXPORT_TIMEOUT`: no equivalent setting in the batching sink. ## Other details Uses the existing startup-log emission and controls. Generic OTLP transport fields are omitted because exporters can have different finalized values. `OTEL_BLRP_EXPORT_TIMEOUT` is omitted because the sink has no equivalent finalized setting. The added getters and interface member are internal. [OTEL-3367]: https://datadoghq.atlassian.net/browse/OTEL-3367?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
Motivation
Currently, reporting OTel configurations at startup is handled by tracers, without standardization on which configs should be reported. This can make self-troubleshooting or troubleshooting using BitsAI harder for customers, and may slow the adoption of DDOT SDKs
Changes
This adds tests that checks that critical OTel configs are present in the startup log config JSON
Workflow
system-tests-reviewers: ask to one of youre co-worker familiar with the tested feature.system-tests-core(slack)🚀 Once your PR is reviewed and the CI green, you can merge it!
🛟 #apm-shared-testing 🛟