Skip to content

feat(otel): Optimize processing of OpenTelemetry consistent probability sampling - #9184

Open
zacharycmontoya wants to merge 3 commits into
milan.garnier/ot.th-reopenfrom
zach.montoya/optimize-otel-tracestate
Open

feat(otel): Optimize processing of OpenTelemetry consistent probability sampling#9184
zacharycmontoya wants to merge 3 commits into
milan.garnier/ot.th-reopenfrom
zach.montoya/optimize-otel-tracestate

Conversation

@zacharycmontoya

Copy link
Copy Markdown
Contributor

Summary of changes

Builds directly on top of the original feature PR (#8983) and "revert-the-revert" PR (#9178) to reduce the overhead of the feature. This should now have minimal changes to the default tracing code paths, as demonstrated in our microbenchmarks.

There is also one other bug fix: When the incoming ot tracestate list-member is not modified from its incoming value, it now remains in the same position in the tracestate header rather than moving to the front -- the order of unchanged list-members must remain unchanged, as required by the W3C Trace Context specification.

The results are improved (nearly pre-feature level) execution time and similar (post-feature level) allocations.

Reason for change

Performance is critical because this feature is essentially on the hot path of every trace scenario. If the SDK is configured to propagate W3C Trace Context headers, then we must calculate these consistent probability values when we make a sampling decision and later insert them into the tracestate propagation header. Further, whenever we emit OTLP spans, we must ensure these OpenTelemetry values are emitted in the OTLP span's tracestate field.

This PR aims to minimize the overhead of the feature so that cost of creating the header string is only incurred when it is needed, which is currently for injecting trace context injection into a downstream HTTP request and later when serializing OTLP spans. This means that the default scenario where W3C propagation is enabled (but no trace context injection is performed) and spans are exported in Datdog MessagePack, there should be minimal overhead costs.

Local benchmarks

I had Claude run the Benchmarks.Trace.RedisBenchmark.SendReceive and Benchmarks.Trace.SerilogBenchmark.EnrichedLog microbenchmarks to measure the effects on the default case that doesn't use the results of the tracestate handling. This measures the execution-time and allocation cost of the OpenTelemetry consistent-probability-sampling feature (#8983) and the results are the AI's own words.

Variants compared

Label Commit Description
A aa978b874b Baseline — immediately before the feature landed
B 34861f39c7 [Propagators] Add OpenTelemetry consistent probability sampling (#8983), as merged
C this branch Lazy OtelTraceStaterv/th kept as ulong? and the ot= string materialized only at injection time

Results

Benchmarks.Trace.RedisBenchmark.SendReceive

Variant Mean Range (4 runs) Allocated Δ time vs A Δ alloc vs A
A 282.6 ns 276.9 – 290.0 1016 B
B 368.7 ns 362.9 – 375.5 1104 B +86.1 ns (+30.5%) +88 B (+8.7%)
C 300.4 ns 295.8 – 305.1 1096 B +17.8 ns (+6.3%) +80 B (+7.9%)

Benchmarks.Trace.SerilogBenchmark.EnrichedLog

Variant Mean Range (4 runs) Allocated Δ time vs A Δ alloc vs A
A 698.0 ns 695.0 – 700.7 1608 B
B 778.1 ns 762.3 – 788.5 1696 B +80.1 ns (+11.5%) +88 B (+5.5%)
C 701.6 ns 694.9 – 709.0 1688 B +3.6 ns (+0.5%) +80 B (+5.0%)

C removes 79% (Redis) and 96% (Serilog) of the execution-time overhead introduced by B.
For EnrichedLog the residual overhead is within run-to-run noise — C's range overlaps A's. For SendReceive the residual +17.8 ns is real; the two ranges do not overlap.

Allocation overhead is only reduced by 9% (+88 B+80 B).

Implementation details

The main change: Create a OtelTraceState class to store all of the needed logic, including the cached input tracestate header, the newly calculated ulong? rv, and the newly calculated ulong? th so that we do not serialize a new OpenTelemetry tracestate list-member in the sampling hot path.

The rest of the changes follow from this modification, including:

  • Updating the SpanContext.OtelTraceState and TraceContext.OtelTraceState to have type OtelTraceState
  • Moving the OtelTraceStateHelpers.Normalize implementation into the static OtelTraceState.Parse(string? raw) method, which creates a new OtelTraceState object and records the well-known values to be serialized later. Also, the loop is optimized to work in one pass of the original header.
  • Implements the tracestate ordering fix by using the OtelTraceState.IsModified and OtelTraceState.CachedHeaderString properties

One enhancement in this PR

Test coverage

  • Existing unit tests were updated to serialize the new OtelTraceState object into a string for assertions (since the object is no longer a string primitive)
  • Add unit tests CreateTraceStateHeader_EmitsOtInOriginalPosition_WhenOtelTraceStateIsUnchanged and CreateTraceStateHeader_DoesNotEmitEmptySubKey_WhenOnlyUnknownOtItemsRemain to assert tracestate ordering properties

Other details

Possible improvements suggested by Claude:

  • Make OtelTraceState a struct so when we store it by value on a TraceContext we increase the baseline size of TraceContext but we reduce heap allocations (seems reasonable as this field is needed on every trace context now)
  • Hold values rv and th as ulong? fields directly on TraceContext, but I'm not a fan of this since we do need several additional fields to keep track of

…ant information in a OtelTraceState object and only serialize it at the time of context injection.
…t.OtelTraceState store a _copy_. This ensures that when a TraceContext is started from a remote SpanContext, its OtelTraceState updates do not affect other TraceContext objects started from the same SpanContext
@zacharycmontoya
zacharycmontoya requested review from a team as code owners September 4, 2026 20:46
@zacharycmontoya
zacharycmontoya requested review from link04 and removed request for a team September 4, 2026 20:46
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-04T20:50:41.826415Z e84dbe2 PR opened
🔒 Security Review Completed 2026-09-04T20:50:27.967985Z e84dbe2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

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

@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: e84dbe2e19

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

spanContext.PropagatedTags = traceTags;
spanContext.AdditionalW3CTraceState = traceState.AdditionalValues;
spanContext.OtelTraceState = OtelTraceStateHelpers.Normalize(traceState.OtTraceState);
spanContext.OtelTraceState = OtelTraceState.Parse(traceState.OtTraceState);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Skip state allocation when ot is absent

For every successful W3C extraction whose tracestate has no ot= member, OtelTraceState.Parse(null) still constructs an OtelTraceState before checking for empty input; continuing the extracted context then creates another copy in TraceContext. This adds avoidable heap allocations to the context-propagation hot path, including the common default case, so leave the property null unless an ot member was actually extracted.

AGENTS.md reference: AGENTS.md:L219-L225

Useful? React with 👍 / 👎.

{
var inheritedRv = _containsLocallyGeneratedOtelRandomValue ? null : OtelTraceStateHelpers.ExtractRv(_otelTraceState);
OtelTraceState = OtelTraceStateHelpers.SetRvTh(_otelTraceState, inheritedRv, th: null);
_otelTraceState ??= new(headerString: null);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid allocating empty state for manual decisions

Whenever a trace with no prior ot state receives a Manual or Asm sampling decision, this creates and mutates an OtelTraceState whose serialized content is still empty; the injector ultimately emits no ot= member. This adds an otherwise unused allocation to manual sampling and AppSec sampling-decision paths, even when W3C injection is disabled, so only rewrite the state here when one already exists.

AGENTS.md reference: AGENTS.md:L219-L225

Useful? React with 👍 / 👎.

@pr-commenter

pr-commenter Bot commented Sep 4, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-09-04 21:25:29

Comparing candidate commit e84dbe2 in PR branch zach.montoya/optimize-otel-tracestate with baseline commit a700999 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 22 performance regressions! Performance is the same for 50 metrics, 0 unstable metrics, 93 known flaky benchmarks, 33 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.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartActiveSpan net6.0

  • 🟥 allocated_mem [+79 bytes; +80 bytes] or [+5.581%; +5.588%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartActiveSpan netcoreapp3.1

  • 🟥 allocated_mem [+79 bytes; +80 bytes] or [+5.405%; +5.413%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartRootSpan net6.0

  • 🟥 allocated_mem [+79 bytes; +80 bytes] or [+5.581%; +5.588%]
  • 🟥 throughput [-17771.367op/s; -14473.066op/s] or [-6.385%; -5.200%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartRootSpan netcoreapp3.1

  • 🟥 allocated_mem [+79 bytes; +80 bytes] or [+5.405%; +5.413%]
  • 🟥 throughput [-14728.760op/s; -12090.508op/s] or [-6.757%; -5.547%]

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

  • 🟥 allocated_mem [+79 bytes; +80 bytes] or [+5.581%; +5.588%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartSpan netcoreapp3.1

  • 🟥 allocated_mem [+79 bytes; +80 bytes] or [+5.405%; +5.413%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartSpan_GetCurrentSpan net472

  • 🟥 throughput [-12638.988op/s; -11289.953op/s] or [-6.815%; -6.087%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartSpan_GetCurrentSpan net6.0

  • 🟥 allocated_mem [+79 bytes; +80 bytes] or [+5.581%; +5.588%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartSpan_GetCurrentSpan netcoreapp3.1

  • 🟥 allocated_mem [+79 bytes; +80 bytes] or [+5.405%; +5.413%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartSpan_SetActive net6.0

  • 🟥 throughput [-19172.661op/s; -16225.877op/s] or [-7.684%; -6.503%]

scenario:Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery net472

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+9.290%; +9.300%]
  • 🟥 throughput [-29660.925op/s; -26876.289op/s] or [-8.354%; -7.570%]

scenario:Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery net6.0

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+8.939%; +8.950%]

scenario:Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery netcoreapp3.1

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+9.009%; +9.021%]
  • 🟥 throughput [-29793.001op/s; -21464.408op/s] or [-7.364%; -5.305%]

scenario:Benchmarks.Trace.HttpClientBenchmark.SendAsync net472

  • 🟥 allocated_mem [+296 bytes; +297 bytes] or [+10.196%; +10.207%]
  • 🟥 throughput [-10814.747op/s; -10448.919op/s] or [-12.346%; -11.928%]

scenario:Benchmarks.Trace.HttpClientBenchmark.SendAsync net6.0

  • 🟥 allocated_mem [+191 bytes; +192 bytes] or [+9.052%; +9.064%]

scenario:Benchmarks.Trace.HttpClientBenchmark.SendAsync netcoreapp3.1

  • 🟥 allocated_mem [+191 bytes; +192 bytes] or [+7.267%; +7.279%]
  • 🟥 throughput [-11953.156op/s; -10371.990op/s] or [-9.485%; -8.231%]

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

  • 🟥 allocated_mem [+79 bytes; +80 bytes] or [+5.678%; +5.684%]
  • 🟥 throughput [-26421.717op/s; -23240.493op/s] or [-9.045%; -7.956%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan netcoreapp3.1

  • 🟥 allocated_mem [+80 bytes; +80 bytes] or [+5.496%; +5.503%]

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

  • 🟥 allocated_mem [+79 bytes; +80 bytes] or [+5.678%; +5.684%]
  • 🟥 throughput [-31418.649op/s; -24924.065op/s] or [-10.606%; -8.413%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1

  • 🟥 allocated_mem [+80 bytes; +80 bytes] or [+5.496%; +5.503%]

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

  • 🟥 allocated_mem [+79 bytes; +80 bytes] or [+5.678%; +5.684%]
  • 🟥 throughput [-25026.651op/s; -21309.478op/s] or [-8.240%; -7.017%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1

  • 🟥 allocated_mem [+80 bytes; +80 bytes] or [+5.496%; +5.503%]

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

  • 🟥 allocated_mem [+79 bytes; +80 bytes] or [+5.678%; +5.684%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1

  • 🟥 allocated_mem [+80 bytes; +80 bytes] or [+5.496%; +5.503%]

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

  • 🟥 allocated_mem [+79 bytes; +80 bytes] or [+5.581%; +5.588%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan netcoreapp3.1

  • 🟥 allocated_mem [+79 bytes; +80 bytes] or [+5.405%; +5.413%]

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

  • 🟥 throughput [-14116.119op/s; -12486.567op/s] or [-7.707%; -6.817%]

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

  • 🟥 allocated_mem [+79 bytes; +80 bytes] or [+5.581%; +5.588%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1

  • 🟥 allocated_mem [+79 bytes; +80 bytes] or [+5.405%; +5.413%]

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

  • 🟥 allocated_mem [+79 bytes; +80 bytes] or [+5.289%; +5.297%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1

  • 🟥 allocated_mem [+79 bytes; +80 bytes] or [+5.125%; +5.132%]

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

  • 🟥 allocated_mem [+79 bytes; +80 bytes] or [+5.581%; +5.588%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1

  • 🟥 allocated_mem [+79 bytes; +80 bytes] or [+5.405%; +5.413%]
  • 🟥 throughput [-19131.352op/s; -17479.127op/s] or [-8.613%; -7.869%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net472

  • 🟥 throughput [-10881.320op/s; -10152.906op/s] or [-12.902%; -12.038%]

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

  • 🟥 throughput [-10279.004op/s; -8602.942op/s] or [-10.451%; -8.747%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 allocated_mem [+1.573KB; +1.573KB] or [+47.789%; +47.804%]
  • 🟥 execution_time [+309.420ms; +312.662ms] or [+153.545%; +155.154%]
  • 🟥 throughput [-58.553op/s; -54.036op/s] or [-10.535%; -9.722%]

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

  • 🟥 allocated_mem [+1.012KB; +1.012KB] or [+37.524%; +37.537%]
  • 🟥 execution_time [+375.126ms; +378.233ms] or [+296.372%; +298.827%]
  • 🟩 throughput [+72.725op/s; +76.279op/s] or [+9.589%; +10.057%]

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

  • 🟥 allocated_mem [+1.090KB; +1.090KB] or [+40.417%; +40.429%]
  • 🟥 execution_time [+397.490ms; +398.836ms] or [+351.763%; +352.955%]

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

  • 🟥 allocated_mem [+4.742KB; +4.742KB] or [+99.823%; +99.838%]
  • 🟥 throughput [-60384.360op/s; -59996.960op/s] or [-46.982%; -46.681%]

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

  • 🟥 allocated_mem [+3.864KB; +3.864KB] or [+81.715%; +81.730%]
  • 🟩 execution_time [-15.715ms; -11.542ms] or [-7.339%; -5.391%]
  • 🟥 throughput [-60367.201op/s; -57609.771op/s] or [-44.065%; -42.052%]

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

  • 🟥 allocated_mem [+4.592KB; +4.592KB] or [+99.295%; +99.306%]
  • 🟥 throughput [-48656.736op/s; -46410.654op/s] or [-43.991%; -41.961%]

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

  • 🟥 allocated_mem [+1.364KB; +1.364KB] or [+110.358%; +110.374%]
  • 🟥 throughput [-273822.489op/s; -270306.349op/s] or [-27.959%; -27.600%]

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

  • 🟥 allocated_mem [+527 bytes; +528 bytes] or [+43.133%; +43.143%]
  • 🟩 execution_time [-25.516ms; -14.639ms] or [-11.379%; -6.528%]
  • 🟥 throughput [-140414.398op/s; -104912.817op/s] or [-15.001%; -11.208%]

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

  • 🟥 allocated_mem [+1.328KB; +1.328KB] or [+109.927%; +109.941%]
  • 🟥 throughput [-164717.846op/s; -148991.687op/s] or [-23.667%; -21.407%]

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

  • 🟥 allocated_mem [+3.378KB; +3.378KB] or [+89.003%; +89.017%]
  • 🟥 throughput [-72498.379op/s; -71725.375op/s] or [-48.791%; -48.270%]

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

  • 🟥 allocated_mem [+3.336KB; +3.336KB] or [+88.150%; +88.161%]
  • 🟥 throughput [-73317.850op/s; -70440.399op/s] or [-46.651%; -44.820%]

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

  • 🟥 allocated_mem [+3.264KB; +3.264KB] or [+88.493%; +88.506%]
  • 🟥 throughput [-56105.508op/s; -53487.944op/s] or [-44.695%; -42.610%]

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

  • 🟩 throughput [+276046.483op/s; +346336.489op/s] or [+9.205%; +11.548%]

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

  • 🟩 execution_time [-19.043ms; -14.713ms] or [-8.778%; -6.782%]

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

  • 🟩 allocated_mem [-13.759KB; -13.756KB] or [-42.324%; -42.316%]
  • 🟥 execution_time [+300.291ms; +301.051ms] or [+150.045%; +150.425%]
  • 🟩 throughput [+890.436op/s; +988.659op/s] or [+9.835%; +10.920%]

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

  • 🟩 allocated_mem [-13.722KB; -13.718KB] or [-42.341%; -42.329%]
  • 🟥 execution_time [+300.555ms; +303.651ms] or [+151.571%; +153.132%]
  • 🟩 throughput [+2378.624op/s; +2590.161op/s] or [+18.193%; +19.811%]

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

  • 🟩 allocated_mem [-13.722KB; -13.718KB] or [-42.341%; -42.329%]
  • 🟥 execution_time [+300.738ms; +303.340ms] or [+151.488%; +152.799%]
  • 🟩 throughput [+1775.448op/s; +1904.181op/s] or [+17.141%; +18.384%]

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

  • 🟥 execution_time [+295.969ms; +296.791ms] or [+145.368%; +145.772%]
  • 🟩 throughput [+566.202op/s; +581.189op/s] or [+15.010%; +15.408%]

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

  • 🟥 execution_time [+299.882ms; +301.234ms] or [+146.601%; +147.262%]
  • 🟩 throughput [+2734.354op/s; +2797.157op/s] or [+39.725%; +40.637%]

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

  • 🟥 execution_time [+300.462ms; +301.297ms] or [+150.170%; +150.588%]
  • 🟩 throughput [+1439.620op/s; +1464.320op/s] or [+28.575%; +29.066%]

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

  • 🟩 execution_time [-143.831µs; -139.169µs] or [-29.530%; -28.573%]
  • 🟩 throughput [+825.311op/s; +858.092op/s] or [+40.196%; +41.793%]

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

  • 🟩 execution_time [-133.283µs; -106.188µs] or [-30.569%; -24.354%]
  • 🟩 throughput [+799.395op/s; +929.676op/s] or [+34.755%; +40.419%]

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

  • 🟩 execution_time [-142.137µs; -120.139µs] or [-30.453%; -25.740%]
  • 🟩 throughput [+772.456op/s; +855.352op/s] or [+35.658%; +39.485%]

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

  • 🟩 execution_time [-125.534µs; -121.038µs] or [-33.893%; -32.679%]
  • 🟩 throughput [+1321.855op/s; +1375.772op/s] or [+48.955%; +50.952%]

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

  • 🟩 execution_time [-100.379µs; -76.703µs] or [-32.046%; -24.487%]
  • 🟩 throughput [+1142.150op/s; +1347.249op/s] or [+35.604%; +41.998%]

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

  • 🟩 execution_time [-136.807µs; -114.437µs] or [-37.425%; -31.305%]
  • 🟩 throughput [+1313.948op/s; +1450.000op/s] or [+47.152%; +52.035%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+299.392ms; +300.154ms] or [+149.427%; +149.808%]

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

  • 🟥 execution_time [+411.291ms; +417.888ms] or [+446.885%; +454.052%]
  • 🟩 throughput [+636.666op/s; +813.765op/s] or [+5.232%; +6.687%]

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

  • unstable execution_time [+325.157ms; +358.464ms] or [+246.888%; +272.178%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [+303.951ms; +347.409ms] or [+139.754%; +159.735%]
  • 🟥 throughput [-528.441op/s; -486.962op/s] or [-47.882%; -44.123%]

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

  • unstable execution_time [+212.206ms; +345.464ms] or [+90.433%; +147.222%]
  • 🟥 throughput [-668.448op/s; -584.756op/s] or [-44.586%; -39.003%]

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

  • 🟥 execution_time [+358.184ms; +371.611ms] or [+214.236%; +222.266%]
  • 🟥 throughput [-425.392op/s; -387.705op/s] or [-29.619%; -26.995%]

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

  • 🟩 execution_time [-212.621µs; -154.253µs] or [-10.771%; -7.814%]
  • 🟩 throughput [+45.999op/s; +60.866op/s] or [+9.081%; +12.016%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 allocated_mem [+88 bytes; +89 bytes] or [+11.094%; +11.104%]
  • 🟥 execution_time [+302.760ms; +304.279ms] or [+152.464%; +153.229%]

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

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+11.101%; +11.112%]
  • 🟥 execution_time [+298.976ms; +304.231ms] or [+149.817%; +152.451%]
  • 🟥 throughput [-47027.066op/s; -40512.750op/s] or [-7.414%; -6.387%]

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

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+11.101%; +11.112%]
  • 🟥 execution_time [+301.311ms; +304.480ms] or [+151.366%; +152.958%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+10.235%; +10.247%]
  • 🟥 execution_time [+300.636ms; +302.023ms] or [+150.969%; +151.666%]

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

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+11.451%; +11.465%]
  • 🟥 execution_time [+298.213ms; +300.239ms] or [+147.453%; +148.455%]
  • 🟥 throughput [-51817.946op/s; -47476.132op/s] or [-8.349%; -7.649%]

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

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+10.469%; +10.481%]
  • 🟥 execution_time [+303.470ms; +307.701ms] or [+153.812%; +155.956%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 allocated_mem [+88 bytes; +89 bytes] or [+10.268%; +10.280%]
  • 🟥 execution_time [+303.133ms; +308.076ms] or [+152.145%; +154.626%]
  • 🟥 throughput [-25412.150op/s; -22907.520op/s] or [-6.593%; -5.943%]

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

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+9.730%; +9.743%]
  • 🟥 execution_time [+300.886ms; +304.925ms] or [+149.964%; +151.977%]

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

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+9.730%; +9.743%]
  • 🟥 execution_time [+299.529ms; +302.580ms] or [+149.013%; +150.531%]
  • 🟥 throughput [-38797.076op/s; -33702.260op/s] or [-9.183%; -7.977%]

scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net472

  • 🟥 allocated_mem [+88 bytes; +89 bytes] or [+5.504%; +5.513%]

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

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+5.160%; +5.169%]
  • 🟩 execution_time [-16.728ms; -12.393ms] or [-7.779%; -5.763%]

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

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+5.136%; +5.148%]

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

  • unstable execution_time [+7.648µs; +51.710µs] or [+1.889%; +12.773%]

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

  • 🟩 allocated_mem [-26.821KB; -26.798KB] or [-9.784%; -9.775%]
  • unstable execution_time [-34.107µs; +25.969µs] or [-6.741%; +5.133%]
  • unstable throughput [-85.481op/s; +126.208op/s] or [-4.266%; +6.298%]

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

  • unstable execution_time [-50.280µs; +13.299µs] or [-8.713%; +2.305%]
  • unstable throughput [-25.452op/s; +155.587op/s] or [-1.454%; +8.889%]

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

  • unstable execution_time [+6.761µs; +11.166µs] or [+15.980%; +26.393%]
  • 🟥 throughput [-5023.664op/s; -3169.563op/s] or [-21.148%; -13.343%]

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

  • unstable execution_time [-15.112µs; -7.278µs] or [-23.446%; -11.291%]
  • unstable throughput [+1921.644op/s; +3616.641op/s] or [+11.790%; +22.189%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+303.086ms; +305.128ms] or [+153.197%; +154.229%]

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

  • 🟥 execution_time [+302.122ms; +304.369ms] or [+153.779%; +154.923%]

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

  • 🟥 execution_time [+299.251ms; +302.392ms] or [+149.812%; +151.385%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net472

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+8.432%; +8.443%]
  • 🟥 throughput [-45328.664op/s; -43485.952op/s] or [-12.548%; -12.038%]

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

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+8.456%; +8.467%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+8.456%; +8.466%]
  • 🟥 throughput [-45080.386op/s; -33151.361op/s] or [-10.669%; -7.846%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+300.518ms; +302.455ms] or [+149.781%; +150.747%]

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

  • 🟥 allocated_mem [+88 bytes; +88 bytes] or [+5.502%; +5.512%]
  • 🟥 execution_time [+301.840ms; +303.526ms] or [+151.570%; +152.416%]

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

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+5.333%; +5.343%]
  • 🟥 execution_time [+304.102ms; +306.388ms] or [+154.221%; +155.381%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+300.339ms; +301.374ms] or [+149.811%; +150.327%]
  • 🟩 throughput [+60844352.463op/s; +61155060.731op/s] or [+44.311%; +44.537%]

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

  • 🟥 execution_time [+421.323ms; +426.140ms] or [+523.990%; +529.981%]

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

  • 🟥 execution_time [+300.263ms; +301.584ms] or [+149.764%; +150.423%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net472

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+14.421%; +14.433%]
  • 🟥 throughput [-80081.985op/s; -77374.900op/s] or [-8.937%; -8.635%]

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

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+13.576%; +13.589%]

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

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+13.578%; +13.589%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net472

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+16.604%; +16.615%]
  • 🟥 throughput [-98772.266op/s; -94506.351op/s] or [-9.041%; -8.651%]

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

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+16.664%; +16.674%]

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

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+16.667%; +16.678%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+8.059%; +8.069%]

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

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+7.280%; +7.293%]
  • 🟩 throughput [+29720.434op/s; +36259.170op/s] or [+5.397%; +6.584%]

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

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+7.277%; +7.288%]

scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+14.421%; +14.433%]
  • 🟥 throughput [-84324.715op/s; -78452.135op/s] or [-12.341%; -11.482%]

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

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+13.576%; +13.589%]

scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

  • 🟥 allocated_mem [+87 bytes; +88 bytes] or [+13.576%; +13.587%]
  • 🟥 throughput [-68019.525op/s; -53532.163op/s] or [-9.497%; -7.474%]

Known flaky benchmarks without significant changes:

  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net472
  • 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_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_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net472
  • 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_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_UpdateName_Sampled net472
  • 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.Iast.StringAspectsBenchmark.StringConcatBenchmark net472

@andrewlock andrewlock added type:performance Performance, speed, latency, resource usage (CPU, memory) area:opentelemetry OpenTelemetry support labels Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:opentelemetry OpenTelemetry support type:performance Performance, speed, latency, resource usage (CPU, memory)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants