Skip to content

[Tracer] Add optional tags to OTLP trace metrics - #9002

Open
mabdinur wants to merge 5 commits into
masterfrom
munir/otlp-trace-metrics-array-tags
Open

[Tracer] Add optional tags to OTLP trace metrics#9002
mabdinur wants to merge 5 commits into
masterfrom
munir/otlp-trace-metrics-array-tags

Conversation

@mabdinur

@mabdinur mabdinur commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • emits datadog.process_tags as a resource string array
  • emits datadog.peer_tags as a data-point string array
  • emits configured additional metric tags as individual data-point attributes
  • writes pre-encoded additional tags directly to protobuf without UTF-8 decoding

This keeps optional tag serialization separate from the core OTLP trace metrics implementation in #8992.

Test plan

  • managed tracer build succeeds with no warnings
  • all 64 OtlpSpanStatsSerializerTests pass on .NET 10

@pr-commenter

pr-commenter Bot commented Aug 5, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-08-31 15:03:00

Comparing candidate commit bcaef7a in PR branch munir/otlp-trace-metrics-array-tags with baseline commit 5094f73 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 1 performance regressions! Performance is the same for 71 metrics, 0 unstable metrics, 72 known flaky benchmarks, 54 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:Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery net472

  • 🟥 throughput [-35096.257op/s; -32227.664op/s] or [-9.885%; -9.077%]

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.

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net6.0

  • 🟩 throughput [+22089.719op/s; +34452.537op/s] or [+8.364%; +13.045%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net6.0

  • 🟩 throughput [+32960.246op/s; +45757.187op/s] or [+12.649%; +17.560%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net472

  • 🟩 throughput [+9899.881op/s; +11849.528op/s] or [+5.102%; +6.107%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net6.0

  • 🟩 throughput [+11784.252op/s; +22146.166op/s] or [+5.095%; +9.574%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net472

  • 🟩 throughput [+10177.405op/s; +11121.774op/s] or [+5.767%; +6.303%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net6.0

  • 🟩 throughput [+17274.069op/s; +29210.985op/s] or [+11.199%; +18.938%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net6.0

  • 🟩 throughput [+23090.209op/s; +40220.056op/s] or [+12.000%; +20.902%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net472

  • 🟥 throughput [-8705.335op/s; -8209.628op/s] or [-10.322%; -9.734%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild netcoreapp3.1

  • 🟥 throughput [-12078.807op/s; -9622.375op/s] or [-12.281%; -9.784%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 allocated_mem [+708 bytes; +709 bytes] or [+21.535%; +21.549%]
  • 🟥 execution_time [+303.825ms; +306.261ms] or [+150.769%; +151.977%]
  • 🟥 throughput [-52.434op/s; -48.380op/s] or [-9.434%; -8.704%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • 🟥 allocated_mem [+391 bytes; +392 bytes] or [+14.530%; +14.542%]
  • 🟥 execution_time [+375.163ms; +376.334ms] or [+296.402%; +297.327%]
  • 🟩 throughput [+68.711op/s; +70.711op/s] or [+9.059%; +9.323%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 allocated_mem [+391 bytes; +392 bytes] or [+14.530%; +14.542%]
  • 🟥 execution_time [+400.311ms; +402.937ms] or [+354.260%; +356.584%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net472

  • 🟥 allocated_mem [+4.692KB; +4.693KB] or [+98.785%; +98.801%]
  • 🟥 throughput [-60406.135op/s; -60039.282op/s] or [-46.999%; -46.714%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net6.0

  • 🟥 allocated_mem [+3.816KB; +3.816KB] or [+80.699%; +80.711%]
  • 🟥 throughput [-62062.525op/s; -57608.598op/s] or [-45.302%; -42.051%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody netcoreapp3.1

  • 🟥 allocated_mem [+4.544KB; +4.544KB] or [+98.261%; +98.274%]
  • 🟥 throughput [-48724.020op/s; -46479.312op/s] or [-44.052%; -42.023%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net472

  • 🟥 allocated_mem [+1.315KB; +1.315KB] or [+106.388%; +106.404%]
  • 🟥 throughput [-258320.425op/s; -253363.199op/s] or [-26.376%; -25.870%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net6.0

  • 🟥 allocated_mem [+479 bytes; +480 bytes] or [+39.212%; +39.221%]
  • 🟩 execution_time [-26.204ms; -21.339ms] or [-11.686%; -9.516%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1

  • 🟥 allocated_mem [+1.280KB; +1.280KB] or [+105.947%; +105.963%]
  • 🟥 throughput [-166538.571op/s; -149751.946op/s] or [-23.928%; -21.516%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net472

  • 🟥 allocated_mem [+3.378KB; +3.378KB] or [+89.003%; +89.017%]
  • 🟥 throughput [-73083.576op/s; -72306.934op/s] or [-49.184%; -48.662%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net6.0

  • 🟥 allocated_mem [+3.336KB; +3.336KB] or [+88.150%; +88.161%]
  • 🟥 throughput [-73181.488op/s; -70296.936op/s] or [-46.564%; -44.729%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody netcoreapp3.1

  • 🟥 allocated_mem [+3.264KB; +3.264KB] or [+88.493%; +88.506%]
  • 🟥 throughput [-56271.263op/s; -53644.765op/s] or [-44.827%; -42.735%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net6.0

  • 🟩 throughput [+264716.258op/s; +386988.447op/s] or [+8.827%; +12.904%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody netcoreapp3.1

  • 🟩 execution_time [-18.994ms; -14.665ms] or [-8.755%; -6.760%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net472

  • 🟩 allocated_mem [-13.759KB; -13.757KB] or [-42.326%; -42.318%]
  • 🟥 execution_time [+299.856ms; +300.845ms] or [+149.828%; +150.322%]
  • 🟩 throughput [+940.450op/s; +977.203op/s] or [+10.387%; +10.793%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net6.0

  • 🟩 allocated_mem [-13.722KB; -13.718KB] or [-42.341%; -42.329%]
  • 🟥 execution_time [+299.974ms; +303.497ms] or [+151.278%; +153.054%]
  • 🟩 throughput [+2254.680op/s; +2482.320op/s] or [+17.245%; +18.986%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs netcoreapp3.1

  • 🟩 allocated_mem [-13.722KB; -13.718KB] or [-42.341%; -42.329%]
  • 🟥 execution_time [+299.571ms; +302.598ms] or [+150.900%; +152.425%]
  • 🟩 throughput [+1818.638op/s; +1959.644op/s] or [+17.558%; +18.919%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net472

  • 🟥 execution_time [+296.944ms; +298.244ms] or [+145.847%; +146.486%]
  • 🟩 throughput [+585.590op/s; +604.566op/s] or [+15.524%; +16.027%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net6.0

  • 🟥 execution_time [+298.186ms; +300.244ms] or [+145.772%; +146.778%]
  • 🟩 throughput [+2683.228op/s; +2721.570op/s] or [+38.982%; +39.539%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs netcoreapp3.1

  • 🟥 execution_time [+300.956ms; +301.672ms] or [+150.418%; +150.775%]
  • 🟩 throughput [+1382.122op/s; +1395.627op/s] or [+27.434%; +27.702%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net472

  • 🟩 execution_time [-128.522µs; -124.434µs] or [-26.387%; -25.548%]
  • 🟩 throughput [+708.015op/s; +733.349op/s] or [+34.484%; +35.717%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net6.0

  • 🟩 execution_time [-130.975µs; -103.999µs] or [-30.039%; -23.852%]
  • 🟩 throughput [+777.351op/s; +906.001op/s] or [+33.796%; +39.389%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark netcoreapp3.1

  • 🟩 execution_time [-140.623µs; -118.385µs] or [-30.129%; -25.364%]
  • 🟩 throughput [+756.672op/s; +843.930op/s] or [+34.929%; +38.957%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net472

  • 🟩 execution_time [-125.015µs; -119.177µs] or [-33.753%; -32.177%]
  • 🟩 throughput [+1292.954op/s; +1371.297op/s] or [+47.885%; +50.786%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net6.0

  • 🟩 execution_time [-99.976µs; -76.082µs] or [-31.917%; -24.289%]
  • 🟩 throughput [+1130.572op/s; +1343.963op/s] or [+35.243%; +41.895%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack netcoreapp3.1

  • 🟩 execution_time [-135.861µs; -113.267µs] or [-37.166%; -30.985%]
  • 🟩 throughput [+1293.170op/s; +1438.443op/s] or [+46.407%; +51.620%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+300.459ms; +301.214ms] or [+149.960%; +150.337%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net6.0

  • 🟥 execution_time [+413.377ms; +420.207ms] or [+449.151%; +456.573%]
  • 🟩 throughput [+724.474op/s; +875.915op/s] or [+5.953%; +7.198%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest netcoreapp3.1

  • unstable execution_time [+245.023ms; +309.981ms] or [+186.044%; +235.365%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [+368.451ms; +417.858ms] or [+169.410%; +192.127%]
  • 🟥 throughput [-576.930op/s; -529.159op/s] or [-52.275%; -47.947%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • unstable execution_time [+198.355ms; +331.609ms] or [+84.531%; +141.318%]
  • 🟥 throughput [-669.931op/s; -586.441op/s] or [-44.685%; -39.116%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 execution_time [+339.158ms; +348.470ms] or [+202.856%; +208.425%]
  • 🟥 throughput [-401.336op/s; -366.646op/s] or [-27.944%; -25.529%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net6.0

  • 🟩 execution_time [-167.540µs; -103.909µs] or [-8.487%; -5.264%]
  • 🟩 throughput [+31.063op/s; +47.306op/s] or [+6.132%; +9.339%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 execution_time [+301.616ms; +303.956ms] or [+151.888%; +153.067%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net6.0

  • 🟥 execution_time [+296.789ms; +300.114ms] or [+148.721%; +150.388%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch netcoreapp3.1

  • 🟥 execution_time [+299.205ms; +302.282ms] or [+150.308%; +151.854%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 execution_time [+301.285ms; +302.679ms] or [+151.295%; +151.995%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net6.0

  • 🟥 execution_time [+296.824ms; +299.176ms] or [+146.766%; +147.929%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync netcoreapp3.1

  • 🟥 execution_time [+302.380ms; +306.400ms] or [+153.259%; +155.297%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 execution_time [+299.764ms; +303.063ms] or [+150.455%; +152.110%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net6.0

  • 🟥 execution_time [+298.827ms; +302.788ms] or [+148.938%; +150.912%]
  • 🟩 throughput [+42647.529op/s; +52621.041op/s] or [+8.468%; +10.449%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync netcoreapp3.1

  • 🟥 execution_time [+298.730ms; +301.392ms] or [+148.615%; +149.940%]

scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net6.0

  • 🟩 execution_time [-16.140ms; -12.441ms] or [-7.505%; -5.785%]
  • 🟩 throughput [+25262.943op/s; +32181.795op/s] or [+6.930%; +8.828%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net472

  • unstable execution_time [+15.081µs; +59.394µs] or [+3.725%; +14.671%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net6.0

  • 🟩 allocated_mem [-19.040KB; -19.018KB] or [-6.945%; -6.937%]
  • unstable execution_time [-41.192µs; +16.683µs] or [-8.141%; +3.297%]
  • unstable throughput [-54.073op/s; +150.942op/s] or [-2.698%; +7.532%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1

  • 🟩 allocated_mem [-14.555KB; -14.535KB] or [-5.306%; -5.299%]
  • unstable execution_time [-51.214µs; +14.041µs] or [-8.875%; +2.433%]
  • unstable throughput [-23.370op/s; +158.388op/s] or [-1.335%; +9.049%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net6.0

  • 🟥 execution_time [+4.917µs; +9.094µs] or [+11.622%; +21.495%]
  • 🟥 throughput [-4254.806op/s; -2454.053op/s] or [-17.911%; -10.331%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark netcoreapp3.1

  • unstable execution_time [-13.490µs; -4.956µs] or [-20.929%; -7.689%]
  • unstable throughput [+1306.271op/s; +3200.717op/s] or [+8.014%; +19.637%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+301.371ms; +302.566ms] or [+152.329%; +152.934%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net6.0

  • 🟥 execution_time [+304.452ms; +307.978ms] or [+154.965%; +156.760%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 execution_time [+299.953ms; +302.216ms] or [+150.164%; +151.296%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net6.0

  • 🟩 throughput [+34784.615op/s; +37228.236op/s] or [+6.584%; +7.047%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+298.265ms; +300.174ms] or [+148.658%; +149.610%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net6.0

  • 🟥 execution_time [+299.435ms; +309.190ms] or [+150.362%; +155.260%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 execution_time [+302.877ms; +305.133ms] or [+153.600%; +154.744%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+299.506ms; +300.450ms] or [+149.395%; +149.866%]
  • 🟩 throughput [+61163879.050op/s; +61502562.318op/s] or [+44.543%; +44.790%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net6.0

  • 🟥 execution_time [+421.323ms; +424.511ms] or [+523.990%; +527.955%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore netcoreapp3.1

  • 🟥 execution_time [+299.456ms; +300.565ms] or [+149.362%; +149.915%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net6.0

  • 🟩 throughput [+111034.237op/s; +118645.847op/s] or [+10.367%; +11.078%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0

  • 🟩 throughput [+84790.224op/s; +116725.137op/s] or [+6.563%; +9.035%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan netcoreapp3.1

  • 🟩 throughput [+70181.020op/s; +77688.003op/s] or [+6.970%; +7.716%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net6.0

  • 🟩 throughput [+55770.410op/s; +62511.991op/s] or [+10.127%; +11.351%]

scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net6.0

  • 🟩 throughput [+56725.349op/s; +76885.156op/s] or [+6.338%; +8.590%]

Known flaky benchmarks without significant changes:

  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net472
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog netcoreapp3.1
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

@mabdinur mabdinur changed the title [Agent] Wire datadog.process_tags and datadog.peer_tags into OTLP stats [Agent] Add OTLP process, peer, and additional metric tags Aug 11, 2026
@dd-trace-dotnet-ci-bot

dd-trace-dotnet-ci-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (9002) and master.

⚠️ Potential regressions detected

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration201.13 ± (201.15 - 202.03) ms215.92 ± (215.79 - 216.73) ms+7.4%❌⬆️
.NET Framework 4.8 - Bailout
duration206.79 ± (206.24 - 207.27) ms220.00 ± (219.81 - 220.72) ms+6.4%❌⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1206.04 ± (1205.34 - 1212.01) ms1280.85 ± (1281.66 - 1288.56) ms+6.2%❌⬆️

📄 View the full report (charts + all metrics) →

@mabdinur mabdinur changed the title [Agent] Add OTLP process, peer, and additional metric tags [Agent] Add process, peer, and additional metric tags to OTLP trace metrics Aug 12, 2026
@mabdinur
mabdinur force-pushed the munir/otlp-trace-metrics-fixes branch from b2caa13 to d0cd8d9 Compare August 12, 2026 16:24
mabdinur added a commit that referenced this pull request Aug 13, 2026
## Summary

Aligns .NET OTLP trace metrics with the cross-tracer contract in
DataDog/system-tests#7466.

- Emits OTLP metric attributes independently of
`DD_TRACE_OTEL_SEMANTICS_ENABLED` while retaining that setting for its
other consumers.
- Emits core SMC attributes first in the order `service.name`,
`status.code`, `span.kind`, and `span.name`; unknown span kinds default
to `SPAN_KIND_INTERNAL`.
- Always emits `datadog.operation.name`, emits known trace-root and
top-level values as booleans, and emits `datadog.svc_src` when present.

Process and peer-tag arrays remain intentionally deferred to
#9002.

## Validation

- Focused `OtlpSpanStatsSerializerTests`: 59 passed
- Production and test `dotnet format --verify-no-changes`: passed
- `Datadog.Trace.csproj -f netstandard2.0 --no-restore`: passed with no
warnings or errors
- `git diff --check`: passed
Base automatically changed from munir/otlp-trace-metrics-fixes to master August 13, 2026 14:39
@mabdinur
mabdinur force-pushed the munir/otlp-trace-metrics-array-tags branch from 5444ae8 to d2c36d2 Compare August 13, 2026 15:01
@mabdinur mabdinur changed the title [Agent] Add process, peer, and additional metric tags to OTLP trace metrics [Tracer] Add optional tags to OTLP trace metrics Aug 13, 2026
@mabdinur
mabdinur marked this pull request as ready for review August 13, 2026 17:02
@mabdinur
mabdinur requested a review from a team as a code owner August 13, 2026 17: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: d2c36d2512

ℹ️ 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 on lines +741 to +742
// TODO: Preserve the cardinality-limit sentinel once its OTLP representation is defined.
return Array.IndexOf(encodedTag, (byte)':');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve the cardinality-overflow dimension

When the additional-tag cardinality limiter folds a bucket, AdditionalMetricTags contains the separator-less tracer_blocked_value sentinel, so this returns -1 and both the JSON and protobuf loops omit the dimension entirely. If the same core dimensions also have spans with no configured additional tag, the normal and overflow buckets serialize with identical attributes, allowing the OTLP receiver to merge or discard one data point and corrupt the histogram totals; encode an explicit overflow attribute instead of dropping the sentinel.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yeah, what this said 😅

Comment thread tracer/src/Datadog.Trace/Agent/OtlpSpanStatsSerializer.cs
@mabdinur

Copy link
Copy Markdown
Contributor Author

With this change, the following tests pass (link):

XPASS tests/parametric/test_otlp_trace_metrics.py::Test_FR08_Datadog_Attributes::test_fr08_8_process_tags[library_env0] missing_feature (process tags are not yet emitted on the OTLP trace metrics resource)
XPASS tests/parametric/test_otlp_trace_metrics.py::Test_FR08_AdditionalTags::test_fr08_12_stats_additional_tags[library_env0] missing_feature (pending implementation release)

Although this PR adds support for serializing peer tags in OTLP, the value is not set in the aggregator. The corresponding system test continues to fail. This is expected.

@andrewlock andrewlock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think fundamentally the design here is not sound. We're doing huge allocations to try to decode utf8 byte arrays, but given we have access to those sources further up the pipeline, we should be looking at how we can expose these values instead


private static int FindEncodedTagSeparator(byte[] encodedTag)
{
// TODO: Preserve the cardinality-limit sentinel once its OTLP representation is defined.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems like something we need to decide on/handle before we can merge this PR, otherwise you will be reporting incorrect stats? 🤔

Comment on lines +741 to +742
// TODO: Preserve the cardinality-limit sentinel once its OTLP representation is defined.
return Array.IndexOf(encodedTag, (byte)':');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yeah, what this said 😅

Comment thread tracer/src/Datadog.Trace/Agent/OtlpSpanStatsSerializer.cs Outdated
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