Skip to content

Define OTLP Trace Metrics Histogram and Writers#11656

Open
mhlidd wants to merge 12 commits into
mhlidd/otlp_trace_metrics_aggregate_entryfrom
mhlidd/otlp_trace_metrics_setup
Open

Define OTLP Trace Metrics Histogram and Writers#11656
mhlidd wants to merge 12 commits into
mhlidd/otlp_trace_metrics_aggregate_entryfrom
mhlidd/otlp_trace_metrics_setup

Conversation

@mhlidd

@mhlidd mhlidd commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

This PR introduces a OTLP Trace Metrics Histogram class and OTLP Trace Metrics Writers. Aggregate metrics are encoded into protobuf and sent out in OTel semantics. Additional Datadog specific attributes are added under a config DD_TRACE_OTEL_SEMANTICS_ENABLED.

Note that OTLP Trace Metrics force temporality delta in order to properly use an OTLP histogram in Datadog.

Motivation

Additional Notes

Contributor Checklist

  • Format the title according to the contribution guidelines
  • Assign the type: and (comp: or inst:) labels in addition to any other useful labels
  • Avoid using close, fix, or any linking keywords when referencing an issue
    Use solves instead, and assign the PR milestone to the issue
  • Update the CODEOWNERS file on source file addition, migration, or deletion
  • Update public documentation with any new configuration flags or behaviors
  • Add your completed PR to the merge queue by commenting /merge. You can also:
    • Customize the commit message associated with the merge with /merge --commit-message "..."
    • Remove your PR from the merge queue with /merge -c
    • Skip all merge queue checks with /merge -f --reason "reason"; please use this judiciously, as some checks do not run at the PR-level (note: the PR still needs to be mergeable, this will only skip the pre-merge build)
    • Get more information in this doc

Jira ticket: [PROJ-IDENT]

@datadog-datadog-prod-us1-2

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

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
Patch Coverage: 85.25%
Overall Coverage: 57.01% (+0.55%)

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

@dd-octo-sts

dd-octo-sts Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 13.93 s 13.97 s [-1.2%; +0.6%] (no difference)
startup:insecure-bank:tracing:Agent 12.87 s 13.03 s [-2.1%; -0.4%] (maybe better)
startup:petclinic:appsec:Agent 16.68 s 17.21 s [-7.2%; +1.1%] (no difference)
startup:petclinic:iast:Agent 17.37 s 17.51 s [-1.8%; +0.3%] (no difference)
startup:petclinic:profiling:Agent 17.44 s 16.67 s [+0.1%; +9.2%] (maybe worse)
startup:petclinic:sca:Agent 17.51 s 17.45 s [-0.4%; +1.1%] (no difference)
startup:petclinic:tracing:Agent 16.50 s 16.66 s [-1.9%; -0.0%] (maybe better)

Commit: 7b264b95 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@mhlidd mhlidd changed the base branch from master to mhlidd/otlp_trace_metrics_config June 17, 2026 17:50
@mhlidd mhlidd changed the base branch from mhlidd/otlp_trace_metrics_config to mhlidd/otlp_trace_metrics_aggregate_entry June 23, 2026 20:32
@mhlidd mhlidd force-pushed the mhlidd/otlp_trace_metrics_setup branch from e11a634 to d202d88 Compare June 23, 2026 20:37
@mhlidd mhlidd changed the title Mhlidd/otlp trace metrics setup Define OTLP Trace Metrics Histogram and Writers Jun 26, 2026
@mhlidd mhlidd added comp: metrics Metrics type: enhancement Enhancements and improvements labels Jun 26, 2026
@mhlidd mhlidd marked this pull request as ready for review June 26, 2026 03:31
@mhlidd mhlidd requested a review from a team as a code owner June 26, 2026 03:31
@mhlidd mhlidd requested a review from ygree June 26, 2026 03:31

@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: 3c217d3251

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

@mhlidd mhlidd requested review from PerfectSlayer and mcculls June 27, 2026 13:32
@mhlidd

mhlidd commented Jun 27, 2026

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: 1c9ae37e55

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

Comment on lines +127 to +128
this.startNanos = start;
this.endNanos = start + duration;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It seems like the report function that calls this startBucket function is sending the clock time when report is called. I followed the precedence set in SerializingMetricWriter that uses the clock time passed in as the start time.

This seems odd, because when report is called, I would imagine that's the "end" time. Is this difference something that we've accepted, or is it a bug? cc: @mcculls

@@ -0,0 +1,70 @@
package datadog.trace.common.metrics;

@mhlidd mhlidd Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Note that I don't like how these classes are in the common package, but that is the only way the Writer can access AggregateEntry.

@mhlidd mhlidd force-pushed the mhlidd/otlp_trace_metrics_aggregate_entry branch from fb6b228 to 2d8a515 Compare July 2, 2026 18:23
@mhlidd mhlidd force-pushed the mhlidd/otlp_trace_metrics_setup branch from 94fbcc0 to 7b264b9 Compare July 2, 2026 19:57
Comment on lines +164 to +165
writeStringAttribute(SPAN_NAME, entry.getResource());
writeStringAttribute(SPAN_KIND, entry.getSpanKind());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe these need to be gated w/ a not empty check.

Comment on lines +180 to +181
writeStringAttribute(DATADOG_OPERATION_NAME, entry.getOperationName());
writeStringAttribute(DATADOG_SPAN_TYPE, entry.getType());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe these need to be gated w/ a not empty check.

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

Labels

comp: metrics Metrics type: enhancement Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant