Skip to content

[Tracer] (Event Grid 1/5) Add contract and core behavior - #8911

Open
pablomartinezbernardo wants to merge 1 commit into
masterfrom
pmartinez/event-grid-contract-core
Open

pablomartinezbernardo wants to merge 1 commit into
masterfrom
pmartinez/event-grid-contract-core

Conversation

@pablomartinezbernardo

@pablomartinezbernardo pablomartinezbernardo commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary of changes

Adds the contracts and core tracing behavior for Azure Event Grid producer spans.

Reason for change

Provides the shared foundation for Azure Event Grid auto-instrumentation while preserving trace context across published events.

Implementation details

  • Adds Event Grid integration registration, telemetry, span metadata, and V0/V1 tags.
  • Creates producer spans with endpoint, batch size, and message ID metadata.
  • Injects W3C trace context and baggage into CloudEvent extension attributes.
    • Do not support other styles because of extension attributes limitations.
    • EventGridEvent does not support context propagation because it doesn't support attributes.
  • Lazily observes event enumerables without changing customer enumeration behavior.

Test coverage

  • Adds unit coverage for lazy, one-shot, partial, and failing enumerable scenarios.
  • Adds unit coverage for V1 peer service tags.

Other details

This is the base PR in a larger Graphite stack.

@pr-commenter

pr-commenter Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-10-02 09:27:13

Comparing candidate commit c58e89b in PR branch pmartinez/event-grid-contract-core with baseline commit ec526ec in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 11 performance regressions! Performance is the same for 61 metrics, 0 unstable metrics, 71 known flaky benchmarks, 53 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

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+10.133%; +10.144%]
  • 🟥 throughput [-28964.292op/s; -26002.849op/s] or [-8.158%; -7.324%]

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

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+9.750%; +9.761%]
  • 🟥 throughput [-38233.199op/s; -27703.212op/s] or [-7.254%; -5.256%]

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

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+9.830%; +9.841%]

scenario:Benchmarks.Trace.HttpClientBenchmark.SendAsync net472

  • 🟥 allocated_mem [+271 bytes; +272 bytes] or [+9.338%; +9.348%]
  • 🟥 throughput [-9924.119op/s; -9693.402op/s] or [-11.329%; -11.066%]

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

  • 🟥 allocated_mem [+199 bytes; +200 bytes] or [+9.426%; +9.438%]

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

  • 🟥 allocated_mem [+199 bytes; +200 bytes] or [+7.569%; +7.581%]
  • 🟥 throughput [-13839.581op/s; -12701.610op/s] or [-10.982%; -10.079%]

scenario:Benchmarks.Trace.NLogBenchmark.EnrichedLog net472

  • 🟥 throughput [-9430.280op/s; -8694.157op/s] or [-7.224%; -6.660%]

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.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net472

  • 🟥 throughput [-8790.875op/s; -7482.425op/s] or [-5.877%; -5.002%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net472

  • 🟥 throughput [-9721.680op/s; -8905.766op/s] or [-11.527%; -10.560%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net6.0

  • 🟥 throughput [-13510.067op/s; -8457.741op/s] or [-11.356%; -7.109%]

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

  • 🟥 throughput [-10766.289op/s; -9574.870op/s] or [-10.947%; -9.736%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 allocated_mem [+1.573KB; +1.573KB] or [+47.789%; +47.804%]
  • 🟥 execution_time [+304.860ms; +307.343ms] or [+151.282%; +152.514%]
  • 🟥 throughput [-53.499op/s; -49.420op/s] or [-9.626%; -8.892%]

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

  • 🟥 allocated_mem [+1.012KB; +1.012KB] or [+37.524%; +37.537%]
  • unstable execution_time [+291.952ms; +354.460ms] or [+230.660%; +280.045%]
  • 🟩 throughput [+66.240op/s; +72.340op/s] or [+8.733%; +9.538%]

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

  • 🟥 allocated_mem [+1.090KB; +1.090KB] or [+40.417%; +40.429%]
  • 🟥 execution_time [+392.499ms; +396.808ms] or [+347.347%; +351.160%]

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

  • 🟥 allocated_mem [+4.758KB; +4.758KB] or [+100.159%; +100.174%]
  • 🟥 throughput [-59765.889op/s; -59412.730op/s] or [-46.501%; -46.226%]

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

  • 🟥 allocated_mem [+3.880KB; +3.880KB] or [+82.058%; +82.072%]
  • 🟥 throughput [-61724.435op/s; -58748.776op/s] or [-45.055%; -42.883%]

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

  • 🟥 allocated_mem [+4.608KB; +4.608KB] or [+99.641%; +99.654%]
  • 🟥 throughput [-48597.886op/s; -46351.799op/s] or [-43.938%; -41.907%]

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

  • 🟥 allocated_mem [+1.380KB; +1.380KB] or [+111.648%; +111.662%]
  • 🟥 throughput [-298119.355op/s; -293520.191op/s] or [-30.439%; -29.970%]

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

  • 🟥 allocated_mem [+543 bytes; +544 bytes] or [+44.437%; +44.446%]
  • 🟩 execution_time [-26.682ms; -21.844ms] or [-11.899%; -9.742%]
  • 🟥 throughput [-99866.203op/s; -77256.204op/s] or [-10.669%; -8.253%]

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

  • 🟥 allocated_mem [+1.344KB; +1.344KB] or [+111.253%; +111.267%]
  • 🟥 throughput [-169591.830op/s; -153843.043op/s] or [-24.367%; -22.104%]

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

  • 🟥 allocated_mem [+3.378KB; +3.378KB] or [+89.003%; +89.017%]
  • 🟥 throughput [-73058.505op/s; -72283.547op/s] or [-49.168%; -48.646%]

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

  • 🟥 allocated_mem [+3.336KB; +3.336KB] or [+88.150%; +88.161%]
  • 🟥 throughput [-74969.775op/s; -72057.351op/s] or [-47.702%; -45.849%]

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

  • 🟥 allocated_mem [+3.264KB; +3.264KB] or [+88.493%; +88.506%]
  • 🟥 throughput [-56302.963op/s; -53678.624op/s] or [-44.853%; -42.762%]

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

  • 🟩 throughput [+212035.535op/s; +243607.988op/s] or [+7.070%; +8.123%]

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

  • 🟩 execution_time [-18.571ms; -14.217ms] or [-8.561%; -6.554%]

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

  • 🟩 allocated_mem [-13.759KB; -13.757KB] or [-42.326%; -42.318%]
  • 🟥 execution_time [+300.020ms; +300.787ms] or [+149.910%; +150.293%]
  • 🟩 throughput [+940.322op/s; +975.330op/s] or [+10.386%; +10.772%]

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

  • 🟩 allocated_mem [-13.722KB; -13.718KB] or [-42.341%; -42.329%]
  • 🟥 execution_time [+298.916ms; +302.424ms] or [+150.744%; +152.513%]
  • 🟩 throughput [+2238.765op/s; +2460.940op/s] or [+17.123%; +18.823%]

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

  • 🟩 allocated_mem [-13.722KB; -13.718KB] or [-42.341%; -42.329%]
  • 🟥 execution_time [+300.723ms; +303.360ms] or [+151.481%; +152.809%]
  • 🟩 throughput [+1864.761op/s; +1993.838op/s] or [+18.003%; +19.250%]

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

  • 🟥 execution_time [+294.250ms; +295.760ms] or [+144.524%; +145.265%]
  • 🟩 throughput [+557.876op/s; +575.130op/s] or [+14.789%; +15.247%]

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

  • 🟥 execution_time [+291.204ms; +293.330ms] or [+142.359%; +143.398%]
  • 🟩 throughput [+2806.851op/s; +2852.911op/s] or [+40.778%; +41.447%]

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

  • 🟥 execution_time [+302.170ms; +303.431ms] or [+151.024%; +151.654%]
  • 🟩 throughput [+1366.775op/s; +1385.826op/s] or [+27.129%; +27.508%]

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

  • 🟩 execution_time [-146.506µs; -141.998µs] or [-30.080%; -29.154%]
  • 🟩 throughput [+849.283op/s; +880.370op/s] or [+41.364%; +42.878%]

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

  • 🟩 execution_time [-132.042µs; -105.189µs] or [-30.284%; -24.125%]
  • 🟩 throughput [+789.203op/s; +915.109op/s] or [+34.311%; +39.785%]

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

  • 🟩 execution_time [-142.054µs; -119.770µs] or [-30.435%; -25.661%]
  • 🟩 throughput [+769.158op/s; +856.494op/s] or [+35.506%; +39.537%]

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

  • 🟩 execution_time [-127.985µs; -123.763µs] or [-34.555%; -33.415%]
  • 🟩 throughput [+1366.794op/s; +1415.621op/s] or [+50.620%; +52.428%]

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

  • 🟩 execution_time [-89.646µs; -60.937µs] or [-28.619%; -19.454%]
  • 🟩 throughput [+894.190op/s; +1192.800op/s] or [+27.875%; +37.183%]

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

  • 🟩 execution_time [-136.588µs; -114.220µs] or [-37.365%; -31.246%]
  • 🟩 throughput [+1310.218op/s; +1446.104op/s] or [+47.019%; +51.895%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+299.571ms; +300.294ms] or [+149.517%; +149.877%]

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

  • 🟥 execution_time [+414.656ms; +422.432ms] or [+450.540%; +458.989%]

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

  • unstable execution_time [+264.419ms; +321.551ms] or [+200.771%; +244.151%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [+312.715ms; +357.440ms] or [+143.784%; +164.347%]
  • 🟥 throughput [-557.063op/s; -504.637op/s] or [-50.475%; -45.725%]

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

  • unstable execution_time [+202.628ms; +335.881ms] or [+86.351%; +143.138%]
  • 🟥 throughput [-664.668op/s; -581.150op/s] or [-44.334%; -38.763%]

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

  • 🟥 execution_time [+335.240ms; +343.855ms] or [+200.513%; +205.665%]
  • 🟥 throughput [-424.976op/s; -387.705op/s] or [-29.590%; -26.995%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 allocated_mem [+96 bytes; +97 bytes] or [+12.092%; +12.103%]
  • 🟥 execution_time [+304.074ms; +306.163ms] or [+153.126%; +154.178%]
  • 🟥 throughput [-17950.530op/s; -16153.609op/s] or [-5.776%; -5.198%]

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

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+12.114%; +12.124%]
  • 🟥 execution_time [+303.306ms; +307.207ms] or [+151.987%; +153.942%]

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

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+12.114%; +12.124%]
  • 🟥 execution_time [+302.123ms; +305.214ms] or [+151.774%; +153.327%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+11.165%; +11.177%]
  • 🟥 execution_time [+301.607ms; +303.131ms] or [+151.457%; +152.222%]

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

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+12.493%; +12.506%]
  • 🟥 execution_time [+300.178ms; +302.660ms] or [+148.425%; +149.652%]
  • 🟥 throughput [-81160.834op/s; -74750.763op/s] or [-13.077%; -12.044%]

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

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+11.422%; +11.434%]
  • 🟥 execution_time [+303.695ms; +307.414ms] or [+153.926%; +155.811%]
  • 🟥 throughput [-33003.237op/s; -24513.303op/s] or [-7.127%; -5.293%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 allocated_mem [+96 bytes; +97 bytes] or [+11.197%; +11.208%]
  • 🟥 execution_time [+303.871ms; +305.413ms] or [+152.516%; +153.290%]
  • 🟥 throughput [-42587.121op/s; -38091.812op/s] or [-11.048%; -9.882%]

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

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+10.618%; +10.631%]
  • 🟥 execution_time [+300.074ms; +302.278ms] or [+149.559%; +150.658%]

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

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+10.618%; +10.631%]
  • 🟥 execution_time [+300.164ms; +304.493ms] or [+149.329%; +151.483%]

scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net472

  • 🟥 allocated_mem [+96 bytes; +97 bytes] or [+6.002%; +6.011%]
  • 🟥 throughput [-19372.963op/s; -17985.974op/s] or [-7.790%; -7.233%]

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

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+5.627%; +5.636%]
  • 🟩 execution_time [-16.777ms; -13.089ms] or [-7.801%; -6.087%]

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

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+5.605%; +5.617%]

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

  • unstable execution_time [+21.305µs; +66.966µs] or [+5.262%; +16.541%]

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

  • 🟩 allocated_mem [-20.719KB; -20.697KB] or [-7.558%; -7.550%]
  • unstable execution_time [-50.531µs; +5.866µs] or [-9.987%; +1.159%]

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

  • unstable execution_time [-78.280µs; -17.361µs] or [-13.565%; -3.009%]

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

  • unstable execution_time [+6.235µs; +10.760µs] or [+14.737%; +25.433%]
  • 🟥 throughput [-4831.881op/s; -2996.301op/s] or [-20.341%; -12.613%]

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

  • unstable execution_time [-13.999µs; -6.007µs] or [-21.719%; -9.319%]
  • unstable throughput [+1514.924op/s; +3286.356op/s] or [+9.295%; +20.163%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+300.890ms; +302.245ms] or [+152.086%; +152.771%]

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

  • 🟥 execution_time [+300.544ms; +303.526ms] or [+152.976%; +154.494%]

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

  • 🟥 execution_time [+298.791ms; +301.363ms] or [+149.582%; +150.869%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net472

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+9.197%; +9.208%]
  • 🟥 throughput [-35806.823op/s; -34503.947op/s] or [-9.912%; -9.552%]

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

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+9.226%; +9.238%]

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

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+9.226%; +9.238%]
  • 🟥 throughput [-30116.419op/s; -21386.536op/s] or [-7.128%; -5.062%]

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

  • 🟥 allocated_mem [+96 bytes; +96 bytes] or [+6.000%; +6.010%]
  • 🟥 execution_time [+300.624ms; +302.088ms] or [+150.959%; +151.694%]

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

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+5.819%; +5.828%]
  • 🟥 execution_time [+303.400ms; +305.754ms] or [+153.865%; +155.059%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+299.725ms; +300.403ms] or [+149.505%; +149.843%]
  • 🟩 throughput [+65247374.018op/s; +65548626.235op/s] or [+47.517%; +47.737%]

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

  • 🟥 execution_time [+416.119ms; +420.827ms] or [+517.518%; +523.373%]

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

  • 🟥 execution_time [+299.471ms; +300.473ms] or [+149.369%; +149.869%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net472

  • 🟥 allocated_mem [+31 bytes; +32 bytes] or [+5.244%; +5.256%]
  • 🟥 throughput [-67768.754op/s; -62634.432op/s] or [-7.563%; -6.990%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net472

  • 🟥 allocated_mem [+31 bytes; +32 bytes] or [+6.037%; +6.047%]
  • 🟥 throughput [-118112.463op/s; -114109.789op/s] or [-10.812%; -10.445%]

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

  • 🟥 allocated_mem [+31 bytes; +32 bytes] or [+6.057%; +6.065%]

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

  • 🟥 allocated_mem [+31 bytes; +32 bytes] or [+6.059%; +6.069%]

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

  • 🟩 throughput [+33689.012op/s; +40300.442op/s] or [+6.117%; +7.318%]

scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+15.733%; +15.745%]
  • 🟥 throughput [-76639.083op/s; -71045.902op/s] or [-11.217%; -10.398%]

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

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+14.810%; +14.823%]

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 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 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 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.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 net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net6.0
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1

@dd-trace-dotnet-ci-bot

dd-trace-dotnet-ci-bot Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

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

✅ No regressions detected

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

@pablomartinezbernardo pablomartinezbernardo changed the title [Azure Event Grid] Add contract and core behavior [Tracer] (Event Grid 1/5) Add contract and core behavior Jul 21, 2026
@pablomartinezbernardo
pablomartinezbernardo force-pushed the pmartinez/event-grid-contract-core branch 4 times, most recently from a6f6e65 to 4a68967 Compare July 24, 2026 10:46
@pablomartinezbernardo
pablomartinezbernardo marked this pull request as ready for review July 24, 2026 14:52
@pablomartinezbernardo
pablomartinezbernardo requested review from a team as code owners July 24, 2026 14:52
@pablomartinezbernardo
pablomartinezbernardo requested review from vandonr and removed request for a team July 24, 2026 14:52

@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: 4a689671af

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

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

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@pablomartinezbernardo
pablomartinezbernardo force-pushed the pmartinez/event-grid-contract-core branch 2 times, most recently from c67ae6c to 14823fd Compare July 29, 2026 09:43
Comment on lines +35 to +37
// extension through the host's shared FunctionAssemblyLoadContext. In that scenario, accessing
// _uriBuilder through a client duck-type proxy has produced MissingFieldException even though the field
// exists, so retrieve it from the concrete target type before duck casting the field value.

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 statement doesn't make any sense to me, nor does the fix 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was to work around this bug #9167

It has since been solved and merged to master, so this hack was removed

Comment on lines +150 to +154
// Inject W3C trace context and baggage into CloudEvent ExtensionAttributes.
// CloudEvent extension attribute names only allow [a-z0-9], so we can't use
// SpanContextPropagator (which also injects Datadog headers with hyphens).
// Instead, inject W3C traceparent/tracestate/baggage directly. Pre-populating these keys also prevents
// the Azure SDK from overwriting with its own Activity-based context.

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 feels like the wrong behaviour to me - if w3c injection is explicitly not configured, we probably shouldn't start injecting it 🤔 Not saying we should be injecting the others, but we should likely respect the config they provided as best we can? 🤔

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.

Ah, it looks like you do handle that it's just the AI putting confusing comments in unrelated places as usual 😅

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.

would be better suited as a method comment rather than here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It was already mostly explained as a method comment, so I removed this one

@vandonr

vandonr commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 14823fdf5d

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

IRequestUriBuilder? uriBuilder = null;
if ((object?)instance is { } target)
{
uriBuilder = UriBuilderFieldCache<TTarget>.Field?.GetValue(target)?.DuckCast<IRequestUriBuilder>();

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.

I think this code deserves a comment explaining it, but as Andrew, the one above is not really helping me understand what's going on here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was to work around this bug #9167

It has since been solved and merged to master, so this hack was removed

where TTarget : IEventGridSenderClient
{
var tracer = Tracer.Instance;
if (!tracer.CurrentTraceSettings.Settings.IsIntegrationEnabled(IntegrationId.AzureEventGrid, defaultValue: false))

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.

I think we could extract this to a method, it'd at least make it less likely that we forget one when switching it to "enabled" on the last PR

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, done

return state;
}

private static CallTargetState CreateProducerSpan(Tracer tracer, string? host, int port, IEnumerable? events, object? singleEvent)

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.

I have not really dug into this but I feel like we could refactor this to pass the single event as an enumerable of one ? Or maybe there is a perf drawback to doing this ?

Because here there are some special tratments that look wrong, like "ProcessEvent" only for single events and not for multiple ones, except if coming from the other CreateProducerSpan where the injection is done... looks a bit scattered

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Creating an enumarable would be an extra unnecessary allocation.

Otherwise, events from ienumerables can't be processed here, because we would actually initiate enumeration before the SDK does. That's what EventGridEnumerableObserver is fixing. I removed the message count check from ProcessEvent because it is only called for single events, do you think that helps avoid confusion? Or do you maybe have another suggestion given these conditions?

Comment on lines +150 to +154
// Inject W3C trace context and baggage into CloudEvent ExtensionAttributes.
// CloudEvent extension attribute names only allow [a-z0-9], so we can't use
// SpanContextPropagator (which also injects Datadog headers with hyphens).
// Instead, inject W3C traceparent/tracestate/baggage directly. Pre-populating these keys also prevents
// the Azure SDK from overwriting with its own Activity-based context.

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.

would be better suited as a method comment rather than here.

@pablomartinezbernardo
pablomartinezbernardo requested review from anna-git and removed request for a team September 10, 2026 12:34
@pablomartinezbernardo
pablomartinezbernardo force-pushed the pmartinez/event-grid-contract-core branch 3 times, most recently from cd06b71 to edb4c37 Compare September 16, 2026 11:22
@pablomartinezbernardo
pablomartinezbernardo force-pushed the pmartinez/event-grid-contract-core branch from edb4c37 to c58e89b Compare October 2, 2026 08:35
@pablomartinezbernardo
pablomartinezbernardo requested review from a team as code owners October 2, 2026 08:35
@pablomartinezbernardo
pablomartinezbernardo requested review from kathiehuang and removed request for a team October 2, 2026 08:35

This branch has not been deployed

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

Labels

area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants