Skip to content

Minor and performance updates for client-side-stats#8822

Merged
andrewlock merged 3 commits into
masterfrom
andrew/css-encoding-improvements-2
Jun 30, 2026
Merged

Minor and performance updates for client-side-stats#8822
andrewlock merged 3 commits into
masterfrom
andrew/css-encoding-improvements-2

Conversation

@andrewlock

@andrewlock andrewlock commented Jun 24, 2026

Copy link
Copy Markdown
Member

Summary of changes

  • Mark testing only methods with [TestingAndPrivateOnly]
  • Pre-encode header tags for static UTF-8 messagepack keys
  • Avoid re-encoding the peer_tags, seeing as we already have that data

Reason for change

Minor tweaks (mostly perf) before adding the additional client-side-stats features

Implementation details

Mostly self-evident, written as distinct commits. The most interesting one is avoiding the additional interpolated string when encoding peer_tags. We also avoid re-encoding the tags seeing as we already do that work up front

Test coverage

Covered by existing tests, this is all refactoring

Other details

Part of a client-side stats stack of PRs.

https://datadoghq.atlassian.net/browse/APMLP-1446

@andrewlock andrewlock added area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) type:refactor area:client-side-stats labels Jun 24, 2026
@pr-commenter

pr-commenter Bot commented Jun 24, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-06-26 09:27:12

Comparing candidate commit ab84d18 in PR branch andrew/css-encoding-improvements-2 with baseline commit 51ca7e7 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 72 metrics, 0 unstable metrics, 63 known flaky benchmarks, 63 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 ----------------------------------'

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_GetContext_Sampled net6.0

  • 🟥 throughput [-21690.697op/s; -16763.158op/s] or [-7.311%; -5.650%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net472

  • 🟥 throughput [-7431.497op/s; -7026.887op/s] or [-8.812%; -8.332%]

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

  • 🟥 throughput [-7275.375op/s; -5940.311op/s] or [-7.397%; -6.040%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 execution_time [+302.769ms; +308.697ms] or [+150.244%; +153.187%]
  • 🟥 throughput [-46.821op/s; -42.880op/s] or [-8.424%; -7.715%]

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

  • 🟥 execution_time [+379.000ms; +380.838ms] or [+299.434%; +300.885%]
  • 🟩 throughput [+92.938op/s; +96.068op/s] or [+12.253%; +12.666%]

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

  • 🟥 execution_time [+393.829ms; +400.026ms] or [+348.524%; +354.008%]

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

  • 🟥 allocated_mem [+1.308KB; +1.308KB] or [+27.528%; +27.540%]

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

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+9.976%; +9.987%]
  • 🟩 execution_time [-16.127ms; -11.889ms] or [-7.532%; -5.553%]

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

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+27.500%; +27.510%]

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

  • 🟥 allocated_mem [+1.307KB; +1.307KB] or [+105.743%; +105.758%]
  • 🟥 throughput [-276366.682op/s; -269201.753op/s] or [-28.218%; -27.487%]

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

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+38.557%; +38.566%]
  • 🟩 execution_time [-25.985ms; -21.108ms] or [-11.588%; -9.413%]

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

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+105.288%; +105.304%]
  • 🟥 throughput [-151608.960op/s; -135753.731op/s] or [-21.783%; -19.505%]

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

  • 🟩 throughput [+9351.537op/s; +12234.782op/s] or [+5.950%; +7.785%]

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

  • 🟩 throughput [+8153.380op/s; +10809.052op/s] or [+6.495%; +8.611%]

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

  • 🟩 throughput [+486671.424op/s; +507136.505op/s] or [+16.228%; +16.910%]

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

  • 🟩 execution_time [-19.235ms; -14.892ms] or [-8.867%; -6.865%]
  • 🟩 throughput [+181881.863op/s; +236148.771op/s] or [+7.219%; +9.373%]

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

  • 🟥 execution_time [+299.433ms; +300.150ms] or [+149.617%; +149.975%]

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

  • 🟥 execution_time [+300.505ms; +303.963ms] or [+151.546%; +153.289%]

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

  • 🟥 execution_time [+299.451ms; +302.349ms] or [+150.840%; +152.300%]

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

  • 🟥 execution_time [+296.688ms; +297.890ms] or [+145.721%; +146.312%]

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

  • 🟥 execution_time [+294.854ms; +297.248ms] or [+144.143%; +145.313%]

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

  • 🟥 execution_time [+301.599ms; +303.656ms] or [+150.739%; +151.767%]

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

  • 🟥 execution_time [+23.356µs; +46.969µs] or [+7.456%; +14.995%]
  • 🟥 throughput [-436.628op/s; -237.933op/s] or [-13.611%; -7.417%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+299.528ms; +300.312ms] or [+149.495%; +149.887%]

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

  • 🟥 execution_time [+407.343ms; +413.794ms] or [+442.595%; +449.604%]
  • 🟩 throughput [+657.197op/s; +893.321op/s] or [+5.400%; +7.341%]

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

  • unstable execution_time [+295.153ms; +349.300ms] or [+224.107%; +265.220%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [+335.448ms; +385.742ms] or [+154.236%; +177.360%]
  • 🟥 throughput [-546.304op/s; -491.430op/s] or [-49.501%; -44.528%]

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

  • unstable execution_time [+201.910ms; +335.190ms] or [+86.046%; +142.844%]
  • 🟥 throughput [-669.760op/s; -586.251op/s] or [-44.673%; -39.103%]

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

  • 🟥 execution_time [+335.811ms; +348.945ms] or [+200.854%; +208.710%]
  • 🟥 throughput [-412.934op/s; -370.512op/s] or [-28.752%; -25.798%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1

  • unstable execution_time [-561.209µs; -266.271µs] or [-19.524%; -9.263%]
  • unstable throughput [+51.042op/s; +113.922op/s] or [+14.672%; +32.747%]

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

  • 🟩 execution_time [-195.877µs; -170.404µs] or [-9.922%; -8.632%]
  • 🟩 throughput [+48.287op/s; +56.007op/s] or [+9.532%; +11.056%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 execution_time [+302.933ms; +305.125ms] or [+152.552%; +153.655%]

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

  • 🟥 execution_time [+301.174ms; +303.417ms] or [+150.919%; +152.043%]
  • 🟩 throughput [+37244.239op/s; +45082.075op/s] or [+5.872%; +7.108%]

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

  • 🟥 execution_time [+298.383ms; +302.203ms] or [+149.895%; +151.814%]
  • 🟩 throughput [+26013.785op/s; +33929.012op/s] or [+5.480%; +7.147%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 execution_time [+301.737ms; +303.578ms] or [+151.522%; +152.447%]

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

  • 🟥 execution_time [+296.351ms; +298.166ms] or [+146.532%; +147.430%]

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

  • 🟥 execution_time [+305.711ms; +309.476ms] or [+154.948%; +156.856%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 execution_time [+301.689ms; +303.987ms] or [+151.421%; +152.574%]

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

  • 🟥 execution_time [+298.875ms; +311.145ms] or [+148.962%; +155.077%]
  • 🟩 throughput [+35198.948op/s; +47885.051op/s] or [+6.989%; +9.508%]

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

  • 🟥 execution_time [+301.462ms; +304.464ms] or [+149.975%; +151.468%]

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

  • 🟩 execution_time [-16.920ms; -13.275ms] or [-7.868%; -6.173%]

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

  • unstable execution_time [+11.303µs; +56.520µs] or [+2.792%; +13.961%]

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

  • 🟩 allocated_mem [-17.720KB; -17.697KB] or [-6.464%; -6.455%]
  • unstable execution_time [-34.781µs; +21.540µs] or [-6.874%; +4.257%]

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

  • 🟩 allocated_mem [-15.984KB; -15.963KB] or [-5.827%; -5.819%]
  • unstable execution_time [-38.891µs; +21.802µs] or [-6.740%; +3.778%]

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

  • unstable execution_time [+4.659µs; +9.995µs] or [+11.014%; +23.626%]
  • 🟥 throughput [-4303.024op/s; -2288.667op/s] or [-18.114%; -9.635%]

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

  • unstable execution_time [-12.608µs; -3.898µs] or [-19.562%; -6.047%]
  • unstable throughput [+1006.643op/s; +2898.336op/s] or [+6.176%; +17.782%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+302.159ms; +303.703ms] or [+152.728%; +153.508%]

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

  • 🟥 execution_time [+302.606ms; +305.059ms] or [+154.025%; +155.274%]

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

  • unstable execution_time [+271.126ms; +292.400ms] or [+135.732%; +146.383%]

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

  • 🟩 throughput [+27731.219op/s; +30250.411op/s] or [+5.249%; +5.726%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+299.949ms; +302.168ms] or [+149.498%; +150.603%]

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

  • 🟥 execution_time [+300.576ms; +302.525ms] or [+150.935%; +151.914%]

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

  • 🟥 execution_time [+301.436ms; +304.140ms] or [+152.869%; +154.240%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+299.311ms; +300.498ms] or [+149.298%; +149.890%]
  • 🟩 throughput [+61324180.540op/s; +61674592.351op/s] or [+44.660%; +44.915%]

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

  • unstable execution_time [+332.127ms; +396.218ms] or [+413.059%; +492.768%]

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

  • 🟥 execution_time [+299.132ms; +300.199ms] or [+149.200%; +149.732%]

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

  • 🟩 throughput [+85284.290op/s; +94071.383op/s] or [+7.963%; +8.783%]

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

  • 🟩 throughput [+61888.657op/s; +81041.016op/s] or [+7.163%; +9.380%]

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

  • 🟩 throughput [+65411.076op/s; +96381.529op/s] or [+5.063%; +7.460%]

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

  • 🟩 throughput [+89343.816op/s; +97925.727op/s] or [+8.873%; +9.726%]

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

  • 🟩 throughput [+46511.414op/s; +50726.486op/s] or [+8.446%; +9.211%]

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

  • 🟩 throughput [+24672.239op/s; +35561.014op/s] or [+5.522%; +7.960%]

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

  • 🟩 throughput [+80155.529op/s; +101352.864op/s] or [+8.955%; +11.324%]

Known flaky benchmarks without significant changes:

  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net6.0
  • 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 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 net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net472
  • 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 net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net472
  • 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 net6.0
  • 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 net6.0
  • 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.ObjectExtractorMoreComplexBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0
  • 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.StartFinishSpan net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

@dd-trace-dotnet-ci-bot

dd-trace-dotnet-ci-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

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

✅ No regressions detected - check the details below

Full Metrics Comparison

FakeDbCommand

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration70.19 ± (70.27 - 70.57) ms69.66 ± (69.70 - 69.99) ms-0.8%
.NET Framework 4.8 - Bailout
duration74.02 ± (73.92 - 74.22) ms76.34 ± (76.08 - 76.57) ms+3.1%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1077.38 ± (1079.68 - 1086.55) ms1079.53 ± (1079.82 - 1085.89) ms+0.2%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms22.07 ± (22.03 - 22.11) ms22.11 ± (22.08 - 22.15) ms+0.2%✅⬆️
process.time_to_main_ms80.78 ± (80.59 - 80.96) ms81.28 ± (81.06 - 81.50) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.92 ± (10.91 - 10.92) MB10.94 ± (10.94 - 10.94) MB+0.2%✅⬆️
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.04 ± (22.01 - 22.07) ms22.28 ± (22.23 - 22.32) ms+1.1%✅⬆️
process.time_to_main_ms82.06 ± (81.94 - 82.18) ms84.41 ± (84.16 - 84.65) ms+2.9%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.96 ± (10.96 - 10.96) MB10.98 ± (10.97 - 10.98) MB+0.2%✅⬆️
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms209.08 ± (208.10 - 210.06) ms208.22 ± (207.27 - 209.16) ms-0.4%
process.time_to_main_ms527.96 ± (526.60 - 529.32) ms526.35 ± (525.11 - 527.59) ms-0.3%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.73 ± (48.69 - 48.77) MB48.72 ± (48.68 - 48.76) MB-0.0%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.3%
.NET 6 - Baseline
process.internal_duration_ms20.88 ± (20.85 - 20.91) ms20.77 ± (20.74 - 20.80) ms-0.5%
process.time_to_main_ms70.52 ± (70.38 - 70.65) ms70.12 ± (69.96 - 70.27) ms-0.6%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.63 ± (10.63 - 10.63) MB10.64 ± (10.64 - 10.64) MB+0.1%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms20.75 ± (20.72 - 20.78) ms21.08 ± (21.04 - 21.13) ms+1.6%✅⬆️
process.time_to_main_ms71.25 ± (71.15 - 71.35) ms73.77 ± (73.52 - 74.02) ms+3.5%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.75 ± (10.75 - 10.76) MB10.75 ± (10.75 - 10.76) MB+0.0%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms374.50 ± (372.51 - 376.49) ms374.63 ± (372.22 - 377.04) ms+0.0%✅⬆️
process.time_to_main_ms535.78 ± (534.52 - 537.04) ms532.40 ± (531.23 - 533.57) ms-0.6%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed50.12 ± (50.09 - 50.14) MB50.13 ± (50.11 - 50.16) MB+0.0%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.0%
.NET 8 - Baseline
process.internal_duration_ms19.08 ± (19.06 - 19.11) ms19.15 ± (19.12 - 19.17) ms+0.3%✅⬆️
process.time_to_main_ms69.12 ± (69.01 - 69.23) ms69.75 ± (69.62 - 69.88) ms+0.9%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.68 ± (7.68 - 7.69) MB7.67 ± (7.66 - 7.67) MB-0.2%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.00 ± (18.97 - 19.03) ms18.98 ± (18.94 - 19.01) ms-0.1%
process.time_to_main_ms70.22 ± (70.09 - 70.35) ms70.37 ± (70.27 - 70.46) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.73 ± (7.72 - 7.73) MB7.73 ± (7.73 - 7.74) MB+0.1%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms298.27 ± (295.93 - 300.61) ms296.85 ± (294.62 - 299.08) ms-0.5%
process.time_to_main_ms485.57 ± (484.64 - 486.51) ms487.01 ± (486.03 - 487.99) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed37.17 ± (37.14 - 37.20) MB37.14 ± (37.12 - 37.17) MB-0.1%
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)-0.7%

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration205.05 ± (204.77 - 205.70) ms201.98 ± (201.49 - 202.38) ms-1.5%
.NET Framework 4.8 - Bailout
duration208.74 ± (208.07 - 209.01) ms206.04 ± (205.77 - 206.51) ms-1.3%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1215.29 ± (1213.20 - 1219.75) ms1206.49 ± (1205.57 - 1211.70) ms-0.7%
.NET Core 3.1 - Baseline
process.internal_duration_ms197.27 ± (196.85 - 197.69) ms195.68 ± (195.21 - 196.15) ms-0.8%
process.time_to_main_ms85.44 ± (85.14 - 85.74) ms84.92 ± (84.60 - 85.24) ms-0.6%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.03 ± (16.01 - 16.05) MB16.09 ± (16.06 - 16.11) MB+0.3%✅⬆️
runtime.dotnet.threads.count20 ± (19 - 20)20 ± (20 - 20)+0.2%✅⬆️
.NET Core 3.1 - Bailout
process.internal_duration_ms197.57 ± (197.11 - 198.03) ms193.57 ± (193.08 - 194.07) ms-2.0%
process.time_to_main_ms87.54 ± (87.29 - 87.80) ms85.70 ± (85.42 - 85.99) ms-2.1%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.09 ± (16.06 - 16.12) MB16.15 ± (16.12 - 16.17) MB+0.3%✅⬆️
runtime.dotnet.threads.count20 ± (20 - 21)21 ± (21 - 21)+0.5%✅⬆️
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms392.22 ± (390.92 - 393.52) ms389.05 ± (387.79 - 390.32) ms-0.8%
process.time_to_main_ms549.42 ± (548.27 - 550.58) ms543.49 ± (542.07 - 544.91) ms-1.1%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed59.11 ± (58.94 - 59.29) MB58.24 ± (58.00 - 58.48) MB-1.5%
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)-0.3%
.NET 6 - Baseline
process.internal_duration_ms203.46 ± (203.09 - 203.84) ms199.71 ± (199.24 - 200.17) ms-1.8%
process.time_to_main_ms74.97 ± (74.73 - 75.22) ms73.58 ± (73.30 - 73.86) ms-1.9%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.35 ± (16.33 - 16.37) MB16.43 ± (16.40 - 16.45) MB+0.5%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.2%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms201.85 ± (201.51 - 202.18) ms199.29 ± (198.95 - 199.63) ms-1.3%
process.time_to_main_ms75.65 ± (75.44 - 75.86) ms74.57 ± (74.37 - 74.78) ms-1.4%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.42 ± (16.40 - 16.45) MB16.44 ± (16.42 - 16.47) MB+0.1%✅⬆️
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)-0.6%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms586.13 ± (583.37 - 588.88) ms588.01 ± (585.44 - 590.57) ms+0.3%✅⬆️
process.time_to_main_ms555.07 ± (553.87 - 556.27) ms551.41 ± (550.25 - 552.57) ms-0.7%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed61.47 ± (61.37 - 61.58) MB61.55 ± (61.45 - 61.64) MB+0.1%✅⬆️
runtime.dotnet.threads.count31 ± (31 - 31)31 ± (31 - 31)-0.4%
.NET 8 - Baseline
process.internal_duration_ms199.33 ± (198.84 - 199.81) ms197.85 ± (197.44 - 198.26) ms-0.7%
process.time_to_main_ms73.09 ± (72.86 - 73.33) ms73.22 ± (72.95 - 73.50) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.71 ± (11.69 - 11.73) MB11.71 ± (11.69 - 11.73) MB+0.0%✅⬆️
runtime.dotnet.threads.count19 ± (18 - 19)18 ± (18 - 18)-1.5%
.NET 8 - Bailout
process.internal_duration_ms198.13 ± (197.70 - 198.55) ms197.02 ± (196.64 - 197.40) ms-0.6%
process.time_to_main_ms74.29 ± (74.07 - 74.52) ms73.77 ± (73.59 - 73.96) ms-0.7%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.75 ± (11.73 - 11.77) MB11.78 ± (11.76 - 11.81) MB+0.3%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)-0.1%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms516.69 ± (513.70 - 519.67) ms513.91 ± (511.38 - 516.45) ms-0.5%
process.time_to_main_ms502.54 ± (501.61 - 503.47) ms502.08 ± (501.22 - 502.94) ms-0.1%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed50.92 ± (50.88 - 50.96) MB51.08 ± (51.05 - 51.12) MB+0.3%✅⬆️
runtime.dotnet.threads.count30 ± (29 - 30)30 ± (30 - 30)+0.4%✅⬆️
Comparison explanation

Execution-time benchmarks measure the whole time it takes to execute a program, and are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are highlighted in **red**. The following thresholds were used for comparing the execution times:

  • Welch test with statistical test for significance of 5%
  • Only results indicating a difference greater than 5% and 5 ms are considered.

Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard.

Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph).

Duration charts
FakeDbCommand (.NET Framework 4.8)
gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8822) - mean (70ms)  : 68, 72
    master - mean (70ms)  : 68, 73

    section Bailout
    This PR (8822) - mean (76ms)  : 73, 80
    master - mean (74ms)  : 73, 76

    section CallTarget+Inlining+NGEN
    This PR (8822) - mean (1,083ms)  : 1040, 1126
    master - mean (1,083ms)  : 1033, 1133

Loading
FakeDbCommand (.NET Core 3.1)
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8822) - mean (110ms)  : 105, 115
    master - mean (109ms)  : 106, 113

    section Bailout
    This PR (8822) - mean (114ms)  : 109, 119
    master - mean (110ms)  : 109, 112

    section CallTarget+Inlining+NGEN
    This PR (8822) - mean (772ms)  : 756, 788
    master - mean (774ms)  : 754, 795

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8822) - mean (97ms)  : 94, 100
    master - mean (97ms)  : 94, 100

    section Bailout
    This PR (8822) - mean (102ms)  : 96, 108
    master - mean (98ms)  : 96, 99

    section CallTarget+Inlining+NGEN
    This PR (8822) - mean (939ms)  : 898, 980
    master - mean (942ms)  : 900, 984

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8822) - mean (96ms)  : 93, 99
    master - mean (95ms)  : 92, 97

    section Bailout
    This PR (8822) - mean (96ms)  : 95, 98
    master - mean (96ms)  : 94, 98

    section CallTarget+Inlining+NGEN
    This PR (8822) - mean (814ms)  : 769, 859
    master - mean (813ms)  : 777, 849

Loading
HttpMessageHandler (.NET Framework 4.8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8822) - mean (202ms)  : 197, 206
    master - mean (205ms)  : 200, 210

    section Bailout
    This PR (8822) - mean (206ms)  : 203, 210
    master - mean (209ms)  : 204, 213

    section CallTarget+Inlining+NGEN
    This PR (8822) - mean (1,209ms)  : 1165, 1252
    master - mean (1,216ms)  : 1169, 1264

Loading
HttpMessageHandler (.NET Core 3.1)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8822) - mean (290ms)  : 283, 298
    master - mean (293ms)  : 285, 301

    section Bailout
    This PR (8822) - mean (289ms)  : 282, 296
    master - mean (295ms)  : 288, 301

    section CallTarget+Inlining+NGEN
    This PR (8822) - mean (974ms)  : 953, 996
    master - mean (986ms)  : 966, 1006

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8822) - mean (283ms)  : 277, 289
    master - mean (288ms)  : 282, 294

    section Bailout
    This PR (8822) - mean (282ms)  : 278, 287
    master - mean (287ms)  : 282, 291

    section CallTarget+Inlining+NGEN
    This PR (8822) - mean (1,172ms)  : 1137, 1207
    master - mean (1,173ms)  : 1138, 1208

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8822) - mean (281ms)  : 274, 288
    master - mean (283ms)  : 274, 291

    section Bailout
    This PR (8822) - mean (281ms)  : 275, 286
    master - mean (283ms)  : 277, 288

    section CallTarget+Inlining+NGEN
    This PR (8822) - mean (1,049ms)  : 1003, 1094
    master - mean (1,049ms)  : 994, 1104

Loading

@andrewlock
andrewlock force-pushed the andrew/css-encoding-improvements-2 branch from ba84f2d to ab84d18 Compare June 26, 2026 08:37
@andrewlock
andrewlock marked this pull request as ready for review June 26, 2026 10:04
@andrewlock
andrewlock requested a review from a team as a code owner June 26, 2026 10:04

@zacharycmontoya zacharycmontoya 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.

Nice 👍🏼

@andrewlock
andrewlock merged commit 8b1935f into master Jun 30, 2026
140 checks passed
@andrewlock
andrewlock deleted the andrew/css-encoding-improvements-2 branch June 30, 2026 07:40
@github-actions github-actions Bot added this to the vNext-v3 milestone Jun 30, 2026
andrewlock added a commit that referenced this pull request Jul 2, 2026
…ide-Stats computation (#8766)

## Summary of changes

Implements span-derived primary tags (also called "Additional metric
tags")

## Reason for change

This is a feature requested by customers, and defined in [the
RFC](https://datadoghq.atlassian.net/wiki/spaces/APM/history/6482919540/PENDING+Span-Derived+Primary+Tags+-+V1)

## Implementation details

- Add `DD_TRACE_STATS_ADDITIONAL_TAGS` for controlling which span-tags
to include as metric dimensions in client-side-stats
- This is an experimental feature, so is gated on
`DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED` currently
- Include the defined tags as additional dimensions in the metric key
(similar to peer tags)
- Apply cardinality limits to avoid memory leaks
- NOTE: the cardinality limits implemented here are somewhat superseded
by [a subsequent
RFC](https://datadoghq.atlassian.net/wiki/spaces/APM/pages/6821151019/PENDING+Cardinality+Limits),
and so are only partially implemented here.

## Test coverage

- Added unit tests for all the behaviour
- System tests TBC - once they're implemented, I'll enable them and
confirm they're worked

## Other details

Some aspects of the RFC are missing/modified based on other discussions
- The telemetry metric in the span tags RFC is not defined, we will add
the cardinality limit version instead.
- The required logging will be added as part of the cardinality RFC
implementation
- Cardinality protection doesn't entirely match the RFC, as it follows
the later RFC

Part of a stack

- #8822
- #8766 👈
- #8823
- #8824

https://datadoghq.atlassian.net/browse/APMLP-1446

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
andrewlock added a commit that referenced this pull request Jul 2, 2026
## Summary of changes

Adds support for adding `DD_TAGS` as span-derived primary tags (AKA
Additional tags) in Client Side Stats

## Reason for change

Implements [the
RFC](https://datadoghq.atlassian.net/wiki/spaces/APM/pages/6607667207/PENDING+DD_TAGS+Derived+Primary+Tags)
for adding `DD_TAGS` to the client-side stats payload.

## Implementation details

Relatively simple: we just thread any `DD_TAGS` value through to the
payload, and the backend/agent then ensures they're added as
span-derived primary tags. There's no cardinality issues at play here,
which simplifies things, and we can just include them in every payload

## Test coverage

Added some unit tests, system tests to follow...

## Other details

Part of a stack

- #8822
- #8766
- https://github.com/DataDog/dd-trace-dotnet/pull/8823👈
- #8824

https://datadoghq.atlassian.net/browse/APMLP-1446
andrewlock added a commit that referenced this pull request Jul 2, 2026
## Summary of changes

Implements the Client-Side Stats [cardinality control
RFC](https://datadoghq.atlassian.net/wiki/spaces/APM/pages/6821151019/PENDING+Cardinality+Limits)

## Reason for change

Currently, we have a risk of unbounded memory growth caused by
cardinality explosion. This has not been a big issue so far as CSS is
off by default for .NET. However, resource name explosion (in
particular), as well as span-derived primary tags and peer tags have the
potential to cause OOM issues. This PR adds strict (configurable) caps
to prevent issues from runaway memory growth.

## Implementation details

Largely broken into separate distinct commits

- Convert `StatsAggregationKey` to `readonly record struct`, seeing as
that's basically what it was anyway
- Make `IsTraceRoot` nullable (required for "overflow bucket")
- Make resource length limit configurable (to support "big_resource"
feature from agent)
- Add per-field cardinality limitation to resource, httpendoint,
peertags, additional tags
- Per-field limits stop a single very high cardinality field rendering
everything else useless
  - Only added to these 4 fields for now, but we can expand if necessary
- Add whole-key cardinality limit
  - Essentially a cap on the maximum number of buckets we'll allocate
  - All additional stats flow into an "overflow" bucket
- Add telemetry/heath-metrics/logging for tracking overflow occurences
- Add some tests

## Test coverage

Added a bunch of unit tests. Waiting on system tests to confirm the
implementation.

## Other details

Part of a stack


- #8822
- #8766
- #8823
- #8824 👈

https://datadoghq.atlassian.net/browse/APMLP-1446
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:client-side-stats area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) type:refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants