Repository navigation
[SVLS-10113] feat(otlp): forward OTLP metrics to Datadog's OTLP intake - #1533
Open
jcaparelli15 wants to merge 1 commit into
Open
jcaparelli15 wants to merge 1 commit into
jcaparelli15 wants to merge 1 commit into
Conversation
Accept POST /v1/metrics on the OTLP HTTP listener and forward the body unchanged to https://otlp.<DD_SITE>/v1/metrics through the proxy aggregator, with dd-otel-metric-config: {"resource_attributes_as_tags": true}. Enabled by DD_OTLP_CONFIG_METRICS_ENABLED or DD_METRICS_OTEL_ENABLED. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jcaparelli15
requested review from
lym953
and
a balanced review from Copilot
November 19, 2026 20:48
Codex Review Summary: ✅ CompletedThis 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. |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The OTLP metrics forwarding change has no active review issues.
No open issues 🎉
What changed in this PR
Adds OTLP metrics forwarding to the Lambda Extension so tracer-exported metrics, including feature flag evaluation counts, can reach Datadog’s OTLP intake.
Changes:
- Adds
POST /v1/metrics, queuing unchanged payloads through the proxy aggregator with resource attributes enabled as metric tags. - Enables metrics through either
DD_OTLP_CONFIG_METRICS_ENABLEDorDD_METRICS_OTEL_ENABLED, independently of traces, with a default HTTP port of 4318. - Adds unit tests for enablement, forwarding, response encoding, and disabled routes.
| File | Description |
|---|---|
bottlecap/src/otlp/mod.rs |
Separates trace and metric enablement checks and tests flag combinations. |
bottlecap/src/otlp/agent.rs |
Adds metrics routing, queueing, listener configuration, and handler tests. |
bottlecap/src/config/mod.rs |
Adds configuration support for DD_METRICS_OTEL_ENABLED. |
bottlecap/src/bin/bottlecap/main.rs |
Passes the shared proxy aggregator into the OTLP agent. |
Review effort: Balanced
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.
Problem
Tracer libraries with OpenTelemetry metrics turned on (for example dd-trace-js with
DD_METRICS_OTEL_ENABLED=true) export OTLP metrics tolocalhost:4318/v1/metrics. Feature flag evaluation counts (feature_flag.evaluations) are sent this way. In Lambda the Extension listens on that port but only handles/v1/traces, so these metrics are dropped.This PR
POST /v1/metricsto the OTLP HTTP listener. The body is forwarded unchanged tohttps://otlp.<DD_SITE>/v1/metricsthrough the proxy aggregator (store-and-forward), with the headerdd-otel-metric-config: {"resource_attributes_as_tags": true}. Nothing is translated.DD_OTLP_CONFIG_METRICS_ENABLEDorDD_METRICS_OTEL_ENABLEDis true. Metrics don't need a receiver endpoint to be configured, because the listener falls back to the tracers' default port.should_enable_otlp_agentintoshould_enable_otlp_tracesandshould_enable_otlp_metrics, so the listener can serve metrics with traces off, and the reverse.Testing
Test 1: unit tests
Steps
cargo nextest run --workspaceResult
New tests pass:
otlp::agent:test_v1_metrics_queues_request_for_otlp_intake,test_v1_metrics_replies_json_for_json_request,test_v1_metrics_not_found_when_metrics_disabled,test_v1_traces_not_found_when_only_metrics_enabledotlp:test_should_enable_otlp_metrics_from_otlp_config_without_endpoints,test_should_enable_otlp_metrics_from_tracer_flag,test_should_enable_otlp_metrics_with_traces_disabled,test_should_not_enable_otlp_metrics_by_defaultcargo fmt --checkandcargo clippy(default andtest-modefeatures) are clean.🤖 Generated with Claude Code