Skip to content

[SVLS-10113] feat(otlp): forward OTLP metrics to Datadog's OTLP intake - #1533

Open
jcaparelli15 wants to merge 1 commit into
mainfrom
joe.caparelli/SVLS-10113-otlp-metrics-passthrough
Open

jcaparelli15 wants to merge 1 commit into
mainfrom
joe.caparelli/SVLS-10113-otlp-metrics-passthrough

Conversation

@jcaparelli15

Copy link
Copy Markdown

Problem

Tracer libraries with OpenTelemetry metrics turned on (for example dd-trace-js with DD_METRICS_OTEL_ENABLED=true) export OTLP metrics to localhost: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

  • Adds POST /v1/metrics to the OTLP HTTP listener. The body is forwarded unchanged to https://otlp.<DD_SITE>/v1/metrics through the proxy aggregator (store-and-forward), with the header dd-otel-metric-config: {"resource_attributes_as_tags": true}. Nothing is translated.
  • Turns the route on when DD_OTLP_CONFIG_METRICS_ENABLED or DD_METRICS_OTEL_ENABLED is true. Metrics don't need a receiver endpoint to be configured, because the listener falls back to the tracers' default port.
  • Splits should_enable_otlp_agent into should_enable_otlp_traces and should_enable_otlp_metrics, so the listener can serve metrics with traces off, and the reverse.

Testing

Test 1: unit tests

Steps

  1. cargo nextest run --workspace

Result

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_enabled
  • otlp: 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_default

cargo fmt --check and cargo clippy (default and test-mode features) are clean.

🤖 Generated with Claude Code

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
jcaparelli15 requested a review from a team as a code owner November 19, 2026 20:48
@jcaparelli15
jcaparelli15 requested review from lym953 and a balanced review from Copilot November 19, 2026 20:48
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T20:49:46.034840Z 4a92c0b PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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_ENABLED or DD_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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants