Skip to content

feat(tracer): wire OTLP span metrics into tracer flush path#4900

Open
rachelyangdog wants to merge 6 commits into
rachel.yang/otlp-span-metrics-transportfrom
rachel.yang/otlp-span-metrics-wireup
Open

feat(tracer): wire OTLP span metrics into tracer flush path#4900
rachelyangdog wants to merge 6 commits into
rachel.yang/otlp-span-metrics-transportfrom
rachel.yang/otlp-span-metrics-wireup

Conversation

@rachelyangdog

@rachelyangdog rachelyangdog commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

OTLP Span Metrics — Part 4 of 4: Tracer Integration

Wires the OTLP span metrics exporter into the tracer.

Stack order (merge in sequence):

  1. otlp-span-metrics-config — configuration (PR feat(config): add OTLP span metrics config  #4895)
  2. otlp-span-metrics-conversion — ClientStatsPayload → OTLP protobuf conversion (PR feat(tracer): stats to OTLP histogram conversion for OTLP span metrics #4897)
  3. otlp-span-metrics-transport — OTLP HTTP exporter (PR feat(tracer): add OTLP metrics HTTP exporter for span metrics #4899)
  4. This PR — tracer integration and system-test fixes

What this PR does

Tracer integration (tracer.go, stats.go):

  • When OTLPSpanMetricsEnabled=true, instantiates a newOTLPMetricsConcentrator instead of the standard concentrator; this routes flushed stats to the OTLP endpoint rather than the agent's /v0.6/stats path
  • Flushes the concentrator's input channel before shutdown to avoid dropping spans

Peer tag handling (stats.go):

  • Adds otlpPeerTags to the concentrator; when set, overrides agent-advertised peer tags with a fixed OTel-convention set (http.route, grpc.method.name)
  • Injects span.kind=client only when the span carries a peer-tag value, so non-top-level unmeasured spans are not incorrectly made eligible for stats computation

Datadog-Client-Computed-Stats header (option.go, log.go):

  • Sets the header statically in transport headers when OTLPSpanMetricsEnabled=true, ensuring it is present from the very first request (including the startup probe), before the agent /info poll completes

Testing

  • End-to-end parametric system tests: tests/parametric/test_otlp_trace_metrics.py — 44 passed, 2 xfailed
  • Unit tests in otlp_metrics_wireup_test.go

Motivation

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • New code is free of linting errors. You can check this by running make lint locally.
  • New code doesn't break existing tests. You can check this by running make test locally.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • All generated files are up to date. You can check this by running make generate locally.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild. Make sure all nested modules are up to date by running make fix-modules locally.

Unsure? Have a question? Request a review!

@rachelyangdog rachelyangdog requested review from a team as code owners June 16, 2026 15:47
@rachelyangdog rachelyangdog marked this pull request as draft June 16, 2026 15:47
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Jun 16, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 88.42%
Overall Coverage: 63.06% (+0.02%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 92fe58f | Docs | Datadog PR Page | Give us feedback!

@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.65421% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.63%. Comparing base (94f54e9) to head (5603e81).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
ddtrace/tracer/stats_to_otlp_metrics.go 91.36% 7 Missing and 5 partials ⚠️
ddtrace/tracer/otlp_metrics_exporter.go 86.36% 3 Missing and 3 partials ⚠️
internal/config/config.go 86.66% 5 Missing and 1 partial ⚠️
internal/config/config_helpers.go 87.50% 2 Missing and 2 partials ⚠️
ddtrace/tracer/stats.go 94.11% 2 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
ddtrace/tracer/otlp_writer.go 96.55% <100.00%> (-1.04%) ⬇️
ddtrace/tracer/tracer.go 88.55% <100.00%> (-3.59%) ⬇️
ddtrace/tracer/transport.go 84.89% <100.00%> (-7.92%) ⬇️
ddtrace/tracer/stats.go 96.59% <94.11%> (-1.47%) ⬇️
internal/config/config_helpers.go 63.80% <87.50%> (+0.44%) ⬆️
ddtrace/tracer/otlp_metrics_exporter.go 86.36% <86.36%> (ø)
internal/config/config.go 61.29% <86.66%> (-2.89%) ⬇️
ddtrace/tracer/stats_to_otlp_metrics.go 91.36% <91.36%> (ø)

... and 290 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 539a23ef3e

ℹ️ 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".

Comment thread ddtrace/tracer/stats.go
Comment thread internal/config/config.go Outdated
@pr-commenter

pr-commenter Bot commented Jun 16, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-07-02 20:23:14

Comparing candidate commit 92fe58f in PR branch rachel.yang/otlp-span-metrics-wireup with baseline commit d1699f0 in branch rachel.yang/otlp-span-metrics-transport.

Found 1 performance improvements and 0 performance regressions! Performance is the same for 325 metrics, 0 unstable metrics, 1 flaky benchmarks without significant changes.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:BenchmarkSetTagMetric

  • 🟩 execution_time [-2.090ns; -1.462ns] or [-3.207%; -2.244%]

Known flaky benchmarks

These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

Known flaky benchmarks without significant changes:

  • scenario:BenchmarkOTLPTraceWriterFlush

@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-wireup branch 9 times, most recently from 32cba4f to 043ce14 Compare June 22, 2026 15:10
@rachelyangdog rachelyangdog marked this pull request as ready for review June 23, 2026 14:02

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 043ce14f49

ℹ️ 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".

Comment thread internal/config/config.go
Comment thread internal/env/supported_configurations.json
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-wireup branch from 043ce14 to fd2834e Compare July 1, 2026 19:30
@rachelyangdog rachelyangdog changed the base branch from main to rachel.yang/otlp-span-metrics-transport July 1, 2026 19:41
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-transport branch from 053dd7f to 98e8123 Compare July 2, 2026 14:29
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-wireup branch from fd2834e to 2e9aa5e Compare July 2, 2026 14:30
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-transport branch from 98e8123 to 167f231 Compare July 2, 2026 14:50
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-wireup branch from 2e9aa5e to dc1c997 Compare July 2, 2026 14:50
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Config Audit

PACKAGE: contrib/confluentinc/confluent-kafka-go/kafkatrace
  STATUS      CONFIG                            CALL_SITES
  UNMIGRATED  DD_TRACE_KAFKA_ANALYTICS_ENABLED  1

PACKAGE: ddtrace/opentelemetry/log
  STATUS      CONFIG                            CALL_SITES
  STILL_READ  DD_AGENT_HOST                     2
  STILL_READ  DD_ENV                            1
  STILL_READ  DD_SERVICE                        1
  STILL_READ  DD_TAGS                           1
  STILL_READ  DD_TRACE_AGENT_URL                2
  STILL_READ  DD_TRACE_REPORT_HOSTNAME          1
  STILL_READ  DD_VERSION                        1
  STILL_READ  OTEL_EXPORTER_OTLP_ENDPOINT       4
  STILL_READ  OTEL_EXPORTER_OTLP_HEADERS        2
  UNMIGRATED  DD_HOSTNAME                       1
  UNMIGRATED  OTEL_BLRP_EXPORT_TIMEOUT          1
  UNMIGRATED  OTEL_BLRP_MAX_EXPORT_BATCH_SIZE   1
  UNMIGRATED  OTEL_BLRP_MAX_QUEUE_SIZE          1
  UNMIGRATED  OTEL_BLRP_SCHEDULE_DELAY          1
  UNMIGRATED  OTEL_EXPORTER_OTLP_LOGS_ENDPOINT  4
  UNMIGRATED  OTEL_EXPORTER_OTLP_LOGS_HEADERS   2
  UNMIGRATED  OTEL_EXPORTER_OTLP_LOGS_PROTOCOL  2
  UNMIGRATED  OTEL_EXPORTER_OTLP_LOGS_TIMEOUT   1
  UNMIGRATED  OTEL_EXPORTER_OTLP_PROTOCOL       2
  UNMIGRATED  OTEL_EXPORTER_OTLP_TIMEOUT        1
  UNMIGRATED  OTEL_RESOURCE_ATTRIBUTES          1

PACKAGE: ddtrace/opentelemetry/metric
  STATUS      CONFIG                                             CALL_SITES
  STILL_READ  DD_AGENT_HOST                                      2
  STILL_READ  DD_ENV                                             1
  STILL_READ  DD_METRICS_OTEL_ENABLED                            1
  STILL_READ  DD_SERVICE                                         1
  STILL_READ  DD_TAGS                                            1
  STILL_READ  DD_TRACE_AGENT_URL                                 2
  STILL_READ  DD_TRACE_REPORT_HOSTNAME                           1
  STILL_READ  DD_VERSION                                         1
  STILL_READ  OTEL_EXPORTER_OTLP_ENDPOINT                        2
  STILL_READ  OTEL_EXPORTER_OTLP_HEADERS                         1
  STILL_READ  OTEL_EXPORTER_OTLP_METRICS_ENDPOINT                2
  STILL_READ  OTEL_EXPORTER_OTLP_METRICS_HEADERS                 1
  STILL_READ  OTEL_EXPORTER_OTLP_METRICS_PROTOCOL                2
  STILL_READ  OTEL_METRICS_EXPORTER                              1
  UNMIGRATED  DD_HOSTNAME                                        1
  UNMIGRATED  OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE  1
  UNMIGRATED  OTEL_EXPORTER_OTLP_PROTOCOL                        2
  UNMIGRATED  OTEL_EXPORTER_OTLP_TIMEOUT                         1
  UNMIGRATED  OTEL_RESOURCE_ATTRIBUTES                           1
  UNMIGRATED  OTEL_SERVICE_NAME                                  1

PACKAGE: ddtrace/tracer
  STATUS      CONFIG                                     CALL_SITES
  STILL_READ  DD_API_KEY                                 1
  UNMIGRATED  DD_APM_TRACING_ENABLED                     1
  UNMIGRATED  DD_APP_KEY                                 1
  UNMIGRATED  DD_CIVISIBILITY_AGENTLESS_URL              1
  UNMIGRATED  DD_EXPERIMENTAL_FLAGGING_PROVIDER_ENABLED  1
  UNMIGRATED  DD_LLMOBS_AGENTLESS_ENABLED                1
  UNMIGRATED  DD_LLMOBS_ENABLED                          1
  UNMIGRATED  DD_LLMOBS_ML_APP                           1
  UNMIGRATED  DD_LLMOBS_PROJECT_NAME                     1
  UNMIGRATED  DD_SITE                                    2
  UNMIGRATED  DD_TRACER_EXPERIMENTAL_SPAN_POOL_ENABLED   1
  UNMIGRATED  DD_TRACE_128_BIT_TRACEID_LOGGING_ENABLED   1
  UNMIGRATED  DD_TRACE_DEBUG_SEELOG_WORKAROUND           1
  UNMIGRATED  DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT      1
  UNMIGRATED  DD_TRACE_PROPAGATION_EXTRACT_FIRST         1
  UNMIGRATED  DD_TRACE_PROPAGATION_STYLE_EXTRACT         1
  UNMIGRATED  DD_TRACE_PROPAGATION_STYLE_INJECT          1
  UNMIGRATED  OTEL_TRACES_SAMPLER_ARG                    1

PACKAGE: instrumentation
  STATUS      CONFIG                                       CALL_SITES
  STILL_READ  DD_DATA_STREAMS_ENABLED                      1
  UNMIGRATED  DD_API_SECURITY_ENDPOINT_COLLECTION_ENABLED  1

PACKAGE: instrumentation/graphql
  STATUS      CONFIG                             CALL_SITES
  UNMIGRATED  DD_TRACE_GRAPHQL_ERROR_EXTENSIONS  1

PACKAGE: instrumentation/httptrace
  STATUS      CONFIG                                                 CALL_SITES
  UNMIGRATED  DD_TRACE_BAGGAGE_TAG_KEYS                              1
  UNMIGRATED  DD_TRACE_CLIENT_IP_ENABLED                             1
  UNMIGRATED  DD_TRACE_HTTP_SERVER_ERROR_STATUSES                    1
  UNMIGRATED  DD_TRACE_HTTP_URL_QUERY_STRING_ALLOWLIST               1
  UNMIGRATED  DD_TRACE_HTTP_URL_QUERY_STRING_ALLOWLIST_CLIENT        1
  UNMIGRATED  DD_TRACE_HTTP_URL_QUERY_STRING_ALLOWLIST_SERVER        1
  UNMIGRATED  DD_TRACE_HTTP_URL_QUERY_STRING_DISABLED                1
  UNMIGRATED  DD_TRACE_INFERRED_PROXY_SERVICES_ENABLED               1
  UNMIGRATED  DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP               2
  UNMIGRATED  DD_TRACE_RESOURCE_RENAMING_ALWAYS_SIMPLIFIED_ENDPOINT  1
  UNMIGRATED  DD_TRACE_RESOURCE_RENAMING_ENABLED                     1

PACKAGE: instrumentation/internal/namingschema
  STATUS      CONFIG                                             CALL_SITES
  STILL_READ  DD_SERVICE                                         1
  STILL_READ  DD_TRACE_SPAN_ATTRIBUTE_SCHEMA                     1
  UNMIGRATED  DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED  1

PACKAGE: internal
  STATUS      CONFIG                         CALL_SITES
  STILL_READ  DD_AGENT_HOST                  1
  STILL_READ  DD_TAGS                        1
  STILL_READ  DD_TRACE_AGENT_PORT            1
  STILL_READ  DD_TRACE_AGENT_URL             1
  UNMIGRATED  DD_EXTERNAL_ENV                1
  UNMIGRATED  DD_GIT_COMMIT_SHA              1
  UNMIGRATED  DD_GIT_REPOSITORY_URL          1
  UNMIGRATED  DD_TRACE_GIT_METADATA_ENABLED  1

PACKAGE: internal/appsec
  STATUS      CONFIG           CALL_SITES
  UNMIGRATED  DD_APPSEC_RULES  1

PACKAGE: internal/appsec/config
  STATUS      CONFIG                                                CALL_SITES
  UNMIGRATED  DD_API_SECURITY_DOWNSTREAM_BODY_ANALYSIS_SAMPLE_RATE  1
  UNMIGRATED  DD_API_SECURITY_ENABLED                               1
  UNMIGRATED  DD_API_SECURITY_MAX_DOWNSTREAM_REQUEST_BODY_ANALYSIS  1
  UNMIGRATED  DD_API_SECURITY_PROXY_SAMPLE_RATE                     1
  UNMIGRATED  DD_API_SECURITY_REQUEST_SAMPLE_RATE                   1
  UNMIGRATED  DD_API_SECURITY_SAMPLE_DELAY                          1
  UNMIGRATED  DD_APM_TRACING_ENABLED                                1
  UNMIGRATED  DD_APPSEC_ENABLED                                     1
  UNMIGRATED  DD_APPSEC_RASP_ENABLED                                1
  UNMIGRATED  DD_APPSEC_RULES                                       1
  UNMIGRATED  DD_APPSEC_SCA_ENABLED                                 1
  UNMIGRATED  DD_APPSEC_TRACE_RATE_LIMIT                            1
  UNMIGRATED  DD_APPSEC_WAF_TIMEOUT                                 1

PACKAGE: internal/appsec/listener/httpsec
  STATUS      CONFIG                     CALL_SITES
  UNMIGRATED  DD_TRACE_CLIENT_IP_HEADER  1

PACKAGE: internal/bazel
  STATUS      CONFIG                                  CALL_SITES
  UNMIGRATED  DD_TEST_OPTIMIZATION_MANIFEST_FILE      1
  UNMIGRATED  DD_TEST_OPTIMIZATION_PAYLOADS_IN_FILES  1

PACKAGE: internal/civisibility/envconfig
  STATUS      CONFIG                   CALL_SITES
  STILL_READ  DD_CIVISIBILITY_ENABLED  1

PACKAGE: internal/civisibility/integrations
  STATUS      CONFIG                                               CALL_SITES
  STILL_READ  DD_SERVICE                                           1
  STILL_READ  DD_TRACE_DEBUG                                       1
  UNMIGRATED  DD_CIVISIBILITY_CODE_COVERAGE_REPORT_UPLOAD_ENABLED  1
  UNMIGRATED  DD_CIVISIBILITY_FLAKY_RETRY_COUNT                    1
  UNMIGRATED  DD_CIVISIBILITY_FLAKY_RETRY_ENABLED                  1
  UNMIGRATED  DD_CIVISIBILITY_GIT_UPLOAD_ENABLED                   1
  UNMIGRATED  DD_CIVISIBILITY_IMPACTED_TESTS_DETECTION_ENABLED     1
  UNMIGRATED  DD_CIVISIBILITY_SUBTEST_FEATURES_ENABLED             1
  UNMIGRATED  DD_CIVISIBILITY_TOTAL_FLAKY_RETRY_COUNT              1
  UNMIGRATED  DD_TEST_MANAGEMENT_ATTEMPT_TO_FIX_RETRIES            1
  UNMIGRATED  DD_TEST_MANAGEMENT_ENABLED                           1

PACKAGE: internal/civisibility/integrations/gotesting
  STATUS      CONFIG                                                           CALL_SITES
  UNMIGRATED  DD_CIVISIBILITY_INTERNAL_PARALLEL_EARLY_FLAKE_DETECTION_ENABLED  1
  UNMIGRATED  DD_TEST_MANAGEMENT_ENABLED                                       1

PACKAGE: internal/civisibility/integrations/logs
  STATUS      CONFIG                        CALL_SITES
  UNMIGRATED  DD_CIVISIBILITY_LOGS_ENABLED  1

PACKAGE: internal/civisibility/utils
  STATUS      CONFIG                              CALL_SITES
  STILL_READ  DD_SERVICE                          1
  UNMIGRATED  DD_ACTION_EXECUTION_ID              1
  UNMIGRATED  DD_PIPELINE_EXECUTION_ID            1
  UNMIGRATED  DD_TEST_OPTIMIZATION_ENV_DATA_FILE  1
  UNMIGRATED  DD_TEST_SESSION_NAME                1

PACKAGE: internal/civisibility/utils/net
  STATUS      CONFIG                             CALL_SITES
  STILL_READ  DD_API_KEY                         1
  STILL_READ  DD_CIVISIBILITY_AGENTLESS_ENABLED  1
  STILL_READ  DD_ENV                             1
  STILL_READ  DD_SERVICE                         1
  STILL_READ  DD_TAGS                            1
  STILL_READ  DD_VERSION                         1
  UNMIGRATED  DD_CIVISIBILITY_AGENTLESS_URL      1
  UNMIGRATED  DD_SITE                            1

PACKAGE: internal/civisibility/utils/telemetry
  STATUS      CONFIG                                         CALL_SITES
  UNMIGRATED  DD_CIVISIBILITY_AUTO_INSTRUMENTATION_PROVIDER  1

PACKAGE: internal/globalconfig
  STATUS      CONFIG                           CALL_SITES
  UNMIGRATED  DD_INSTRUMENTATION_INSTALL_ID    1
  UNMIGRATED  DD_INSTRUMENTATION_INSTALL_TIME  1
  UNMIGRATED  DD_INSTRUMENTATION_INSTALL_TYPE  1

PACKAGE: internal/hostname
  STATUS      CONFIG       CALL_SITES
  UNMIGRATED  DD_HOSTNAME  1

PACKAGE: internal/namingschema
  STATUS      CONFIG                                             CALL_SITES
  STILL_READ  DD_SERVICE                                         1
  STILL_READ  DD_TRACE_SPAN_ATTRIBUTE_SCHEMA                     1
  UNMIGRATED  DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED  1

PACKAGE: internal/processtags
  STATUS      CONFIG                                          CALL_SITES
  UNMIGRATED  DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED  1

PACKAGE: internal/remoteconfig
  STATUS      CONFIG                                  CALL_SITES
  STILL_READ  DD_ENV                                  1
  UNMIGRATED  DD_RC_TUF_ROOT                          1
  UNMIGRATED  DD_REMOTE_CONFIGURATION_ENABLED         1
  UNMIGRATED  DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS  1

PACKAGE: internal/stacktrace
  STATUS      CONFIG                           CALL_SITES
  UNMIGRATED  DD_APPSEC_MAX_STACK_TRACE_DEPTH  1
  UNMIGRATED  DD_APPSEC_STACK_TRACE_ENABLED    1

PACKAGE: internal/telemetry
  STATUS      CONFIG                                             CALL_SITES
  STILL_READ  DD_API_KEY                                         1
  UNMIGRATED  DD_API_SECURITY_ENDPOINT_COLLECTION_MESSAGE_LIMIT  1
  UNMIGRATED  DD_INSTRUMENTATION_TELEMETRY_ENABLED               1
  UNMIGRATED  DD_SITE                                            1
  UNMIGRATED  DD_TELEMETRY_DEBUG                                 1
  UNMIGRATED  DD_TELEMETRY_DEPENDENCY_COLLECTION_ENABLED         1
  UNMIGRATED  DD_TELEMETRY_EXTENDED_HEARTBEAT_INTERVAL           1
  UNMIGRATED  DD_TELEMETRY_HEARTBEAT_INTERVAL                    1
  UNMIGRATED  DD_TELEMETRY_LOG_COLLECTION_ENABLED                1
  UNMIGRATED  DD_TELEMETRY_METRICS_ENABLED                       1

PACKAGE: openfeature
  STATUS      CONFIG                                                     CALL_SITES
  STILL_READ  DD_ENV                                                     2
  STILL_READ  DD_SERVICE                                                 2
  STILL_READ  DD_VERSION                                                 2
  UNMIGRATED  DD_EXPERIMENTAL_FLAGGING_PROVIDER_ENABLED                  1
  UNMIGRATED  DD_EXPERIMENTAL_FLAGGING_PROVIDER_SPAN_ENRICHMENT_ENABLED  1
  UNMIGRATED  DD_FLAGGING_EVALUATION_COUNTS_ENABLED                      1

PACKAGE: profiler
  STATUS      CONFIG                                    CALL_SITES
  STILL_READ  DD_API_KEY                                1
  STILL_READ  DD_ENV                                    1
  STILL_READ  DD_SERVICE                                1
  STILL_READ  DD_TAGS                                   1
  STILL_READ  DD_TRACE_STARTUP_LOGS                     1
  STILL_READ  DD_VERSION                                1
  UNMIGRATED  DD_PROFILING_AGENTLESS                    1
  UNMIGRATED  DD_PROFILING_DEBUG_COMPRESSION_SETTINGS   1
  UNMIGRATED  DD_PROFILING_DELTA                        1
  UNMIGRATED  DD_PROFILING_ENABLED                      3
  UNMIGRATED  DD_PROFILING_ENDPOINT_COUNT_ENABLED       1
  UNMIGRATED  DD_PROFILING_EXECUTION_TRACE_ENABLED      1
  UNMIGRATED  DD_PROFILING_EXECUTION_TRACE_LIMIT_BYTES  1
  UNMIGRATED  DD_PROFILING_EXECUTION_TRACE_PERIOD       1
  UNMIGRATED  DD_PROFILING_FLUSH_ON_EXIT                1
  UNMIGRATED  DD_PROFILING_OUTPUT_DIR                   1
  UNMIGRATED  DD_PROFILING_UPLOAD_TIMEOUT               1
  UNMIGRATED  DD_PROFILING_URL                          1
  UNMIGRATED  DD_SITE                                   1

@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-transport branch from 167f231 to 6050a97 Compare July 2, 2026 14:59
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-wireup branch from dc1c997 to cd990d9 Compare July 2, 2026 15:00
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-transport branch from 6050a97 to 3bada97 Compare July 2, 2026 15:04
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-wireup branch from cd990d9 to 2ddc244 Compare July 2, 2026 15:06
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-transport branch from 3bada97 to 7d13e46 Compare July 2, 2026 15:38
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-wireup branch from 2ddc244 to af513d0 Compare July 2, 2026 15:38
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-transport branch from 7d13e46 to f6664fe Compare July 2, 2026 18:02
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-wireup branch from af513d0 to 03f9cb9 Compare July 2, 2026 18:02
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-transport branch from f6664fe to 6e23f98 Compare July 2, 2026 18:28
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-wireup branch from 03f9cb9 to 8fb20f9 Compare July 2, 2026 18:29
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-transport branch from 6e23f98 to 08452dd Compare July 2, 2026 18:35
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-wireup branch from 8fb20f9 to b9861f0 Compare July 2, 2026 18:36
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-transport branch from 08452dd to 563d9b2 Compare July 2, 2026 18:41
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-wireup branch from b9861f0 to b5fdd34 Compare July 2, 2026 18:41
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-transport branch from 563d9b2 to 8c009d6 Compare July 2, 2026 18:46
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-wireup branch 3 times, most recently from 501931b to 2c25330 Compare July 2, 2026 19:00
@rachelyangdog

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2c25330cfa

ℹ️ 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".

Comment thread ddtrace/tracer/tracer.go
Comment on lines +514 to +516
if c.internalConfig.OTLPSpanMetricsEnabled() {
// OTLP span metrics: SDK computes and exports stats; agent /v0.6/stats path unused.
sc = newOTLPMetricsConcentrator(c, statsd)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3 Badge Document the OTLP span-metrics mode

The ddtrace/tracer/AGENTS.md guidance asks for doc.go updates when a significant tracer feature changes user-visible behavior. This new OTLP span-metrics branch changes stats/export behavior when OTLPSpanMetricsEnabled is true, but the commit does not update ddtrace/tracer/doc.go or related README documentation, so users have no tracer docs for enabling, disabling, or understanding the new metrics path.

Useful? React with 👍 / 👎.

@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-transport branch from 1173824 to d1699f0 Compare July 2, 2026 19:49
rachelyangdog and others added 6 commits July 2, 2026 15:52
… path (PR 4)

- Add otlpExporter field to concentrator; flushAndSend branches to OTLP or native /v0.6/stats
- Add newOTLPMetricsConcentrator constructor; select it in newUnstartedTracer when OTLPSpanMetricsEnabled
- FR15: set Datadog-Client-Computed-Stats: yes header when OTLPSpanMetricsEnabled
- FR15: append _dd.stats_computed=true resource attr on OTLP trace payloads
- Fix sketchToHistogram to decode protobuf-serialized DDSketches (agent format)
- Add SetOTLPSpanMetricsEnabled setter in internal/config for test wiring

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ics flush interval

Two bugs prevented OTLP span metrics from being exported in system tests:

1. _DD_TRACE_METRICS_OTEL_FLUSH_INTERVAL was read via env.Get() (allowlist),
   which returned "" for this internal-only override, defaulting to 10s.
   Switch to os.Getenv for this test-only internal variable.

2. tracer.Flush() called flushAndSend() directly while spans may still be
   pending in the concentrator's In channel (not yet processed by runIngester).
   Drain the In channel before flushing when includeCurrent=true so spans
   submitted just before Flush() are included in the export.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add otlpPeerTags to concentrator; inject span.kind="client" only when
  the span carries a peer-tag value (http.route, grpc.method.name) so
  non-top-level unmeasured spans are not made eligible via eligibleSpanKind
- Set Datadog-Client-Computed-Stats header statically in transport headers
  when OTLPSpanMetricsEnabled so it is present from the first request
- Pass transport headers to checkEndpoint startup probe so the header
  is included on the initial 0-trace-chunk connection check

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace for-loop map copy with maps.Copy in stats.go (mapsloop)
- Replace bare int32/int64 atomic vars with atomic.Int32/Int64 types
  in otlp_transport_test.go and otlp_writer_test.go (atomictypes)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e as first-class field

_dd.stats_computed is a string-valued Datadog convention; change from BoolValue(true)
to StringValue("true") to match libdatadog and the system-test spec.

http.route (ext.HTTPRoute) is now captured as the HTTPEndpoint first-class field
with a fallback after ext.HTTPEndpoint, so OTel-instrumented spans get http.route
emitted as a data-point attribute via buildDataPointAttributes. Remove "http.route"
from otlpDefaultPeerTags since it had no effect on attribute emission (only grpc.method.name
peer tags are converted to attributes).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…port field

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@rachelyangdog rachelyangdog force-pushed the rachel.yang/otlp-span-metrics-wireup branch from 2c25330 to 92fe58f Compare July 2, 2026 19:52
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.

1 participant