feat(golang): add OTLP runtime metrics system tests#6857
Merged
Conversation
Contributor
|
|
|
831bcc0 to
10a2c32
Compare
139d5ac to
67c89b0
Compare
gh-worker-dd-mergequeue-cf854d Bot
pushed a commit
to DataDog/dd-trace-go
that referenced
this pull request
Jun 30, 2026
…s are enabled (#4962) Following #4803, fixes dual-emission when both `DD_RUNTIME_METRICS_ENABLED=true` and `DD_METRICS_OTEL_ENABLED=true` are set: the legacy v1 runtime metrics shouldn't start. **Fix:** Pre-compute `otelRuntimeMetricsShouldBeEnabled` in `config` (`option.go`) and add a `!otelRuntimeMetricsShouldBeEnabled` guard around the legacy goroutine in `newTracer()`. **Testing:** - `TestTracerRuntimeMetrics` (all subtests) pass - Validated against [system-tests PR #6857](DataDog/system-tests#6857) (`OTLP_RUNTIME_METRICS` scenario): `test_otel_metrics_are_present_and_attributed` and `test_dd_metrics_are_absent` both pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: maximo.bautista <maximo.bautista@datadoghq.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0cca3a3265
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Add tests for the new OTel semantic-convention Go runtime metrics (DD_METRICS_OTEL_ENABLED=true) from dd-trace-go PR #4716. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove Test_GoOtlpRuntimeMetricsExtended and the OTLP_RUNTIME_METRICS_EXTENDED scenario — the extended env var (DD_OTEL_RUNTIME_METRICS_EXTENDED_ENABLED) no longer exists in the tracer implementation - Add Test_OtlpRuntimeMetrics: missing_feature to golang.yml so the base test is tracked (to be activated when the tracer ships) - Add ddmetric.InstallGlobal() to the net-http weblog before tracer.Start() so the DD OTLP MeterProvider is installed and runtime metrics are actually exported during the OTLP_RUNTIME_METRICS scenario Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lGlobal Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ide-effect Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…o.memory.limit Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The test_go_otlp_scope test validated that Go metrics arrived in the raw OTLP payload under the 'go.runtime' instrumentation scope. This is a Go-specific special case that doesn't exist for other languages and is redundant with test_otel_metrics_are_present_and_attributed, which already validates the metric names are present. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ormatting Replace missing_feature removal with v2.10.0-dev version tag (dd-trace-go#4803 was merged after version was bumped to v2.10.0-dev). Fix ruff formatting: restore double blank line before module-level function and remove trailing newline. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Explicitly import `_ "github.com/DataDog/dd-trace-go/v2/ddtrace/opentelemetry/metric"` in chi, echo (covers uds-echo), gin, and net-http-orchestrion so that `otelmetricsinstall.StartHook` is registered for every weblog, not just net-http. This guarantees OTel runtime metrics are intentionally enabled rather than relying on an implicit transitive import. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
f63ec4a to
aa37e51
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Add system tests for the new OTel semantic-convention Go runtime metrics feature in dd-trace-go (PR #4803 — now merged to main as well as in dd-trace-go (PR #4962
When `DD_METRICS_OTEL_ENABLED=true`, dd-trace-go emits Go runtime metrics via OTLP using OTel semconv naming (`go.memory.used`, `go.goroutine.count`, etc.) instead of DD-proprietary naming (`runtime.go.*`).
Changes
Workflow
Reviewer checklist