Skip to content

Conversation

pablomartinezbernardo
Copy link
Contributor

@pablomartinezbernardo pablomartinezbernardo commented Oct 6, 2025

Summary of changes

New integration for Azure Event Hubs configurable by:

  • DD_TRACE_AZUREEVENTHUBS_ENABLED (default true) enables/disables the integration
  • DD_TRACE_AZURE_EVENTHUBS_BATCH_LINKS_ENABLED (default true) enables/disables Span Linking and TryAdd spans

Integration points

  • Azure.Messaging.EventHubs.Producer.EventDataBatch.TryAdd that adds an EventData to a batch. Creates a span and stores context.
  • Azure.Messaging.EventHubs.Producer.EventHubProducerClient.SendAsync(EventDataBatch) sends a batch. Creates a span extracting context for Span Links.
  • Azure.Messaging.EventHubs.Producer.EventHubProducerClient.SendAsync(IEnumerable<EventData>) sends a collection of EventData. Creates a span.
  • Azure.Core.Shared.MessagingClientDiagnostics.InstrumentMessage (In the Azure.Messaging.EventHubs assembly) function to instrument specific messages. Adds context to messages.
  • Azure.Messaging.EventHubs.Amqp.AmqpConsumer.ReceiveAsync receives all messages, single entry point for all reception. Creates span and links.
  • Added context extraction for Event Hubs triggers

Test coverage

Integration tests

Other details

Some refactoring has been made to the Service Bus integration to better reuse components. I also added previously missing calls to IntegrationGeneratedSpan in Service Bus. Unlike the previous Service Bus PRs, these are all changes in a single PR.

This comment has been minimized.

@pablomartinezbernardo pablomartinezbernardo marked this pull request as ready for review October 7, 2025 13:04
@pablomartinezbernardo pablomartinezbernardo requested review from a team as code owners October 7, 2025 13:04
@lucaspimentel
Copy link
Member

@codex review

@lucaspimentel
Copy link
Member

DD_TRACE_AZUREEVENTHUBS_ENABLED (default false) enables/disables the integration

I don't see DD_TRACE_AZUREEVENTHUBS_ENABLED. I assume it's enabled by default?

Copy link

Codex Review: Didn't find any major issues. You're on a roll.

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

src/Datadog.Trace/Tagging/AwsSdkTags.cs
src/Datadog.Trace/Tagging/AwsSnsTags.cs
src/Datadog.Trace/Tagging/AwsSqsTags.cs
src/Datadog.Trace/Tagging/AzureEventHubsTags.cs
Copy link
Member

Choose a reason for hiding this comment

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

When adding new files, always use #nullable enable to prevent adding to this list. We want this list to get smaller over time until it's empty.

using Datadog.Trace.ExtensionMethods;
using Datadog.Trace.SourceGenerators;

#pragma warning disable SA1402 // File must contain single type
Copy link
Member

Choose a reason for hiding this comment

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

New files should use #nullable enable until we have migrated everything and we can enable it solution-wide.

Copy link
Collaborator

@bouwkast bouwkast left a comment

Choose a reason for hiding this comment

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

Still going through it, quite a large PR

Why is this disabled by default?

"SampleProjectName": "Samples.AzureEventHubs",
"NugetPackageSearchName": "Azure.Messaging.EventHubs",
"MinVersion": "5.11.0",
"MaxVersionExclusive": "5.13.0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"MaxVersionExclusive": "5.13.0",
"MaxVersionExclusive": "6.0.0",

Otherwise we'd stop testing right away basically whereas we'd likely want to test all 5.11.0+

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Changed it for SB as well

# Conflicts:
#	tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_Count.g.cs
#	tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_Count.g.cs
#	tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_Count.g.cs
#	tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_Count.g.cs
@pablomartinezbernardo
Copy link
Contributor Author

Still going through it, quite a large PR

Why is this disabled by default?

Because of a misunderstanding on previous talks. Changed it to enabled by default along with SB

@pr-commenter
Copy link

pr-commenter bot commented Oct 10, 2025

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #7620 compared to master:

  • 3 benchmarks are faster, with geometric mean 1.158
  • 3 benchmarks have fewer allocations
  • 12 benchmarks have more allocations

The following thresholds were used for comparing the benchmark speeds:

  • Mann–Whitney U test with statistical test for significance of 5%
  • Only results indicating a difference greater than 10% and 0.3 ns are considered.

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.ActivityBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7620

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑netcoreapp3.1 5.69 KB 5.73 KB 39 B 0.69%

Fewer allocations 🎉 in #7620

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472 6.11 KB 5.99 KB -120 B -1.96%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 10.5μs 58.5ns 361ns 0 0 0 5.51 KB
master StartStopWithChild netcoreapp3.1 14μs 70.9ns 333ns 0 0 0 5.69 KB
master StartStopWithChild net472 22.1μs 119ns 676ns 0.952 0.212 0 6.11 KB
#7620 StartStopWithChild net6.0 10.5μs 58.9ns 377ns 0 0 0 5.52 KB
#7620 StartStopWithChild netcoreapp3.1 13.2μs 69.4ns 347ns 0 0 0 5.73 KB
#7620 StartStopWithChild net472 22.1μs 123ns 797ns 0.968 0.43 0.108 5.99 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 927μs 173ns 624ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.05ms 599ns 2.32μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.18ms 71.7ns 268ns 0 0 0 3.31 KB
#7620 WriteAndFlushEnrichedTraces net6.0 945μs 223ns 834ns 0 0 0 2.71 KB
#7620 WriteAndFlushEnrichedTraces netcoreapp3.1 1.02ms 67.8ns 235ns 0 0 0 2.7 KB
#7620 WriteAndFlushEnrichedTraces net472 1.2ms 43.3ns 156ns 0 0 0 3.31 KB
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7620

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑net6.0 178.25 KB 180.41 KB 2.16 KB 1.21%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody‑net6.0 181.77 KB 183.93 KB 2.16 KB 1.19%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑netcoreapp3.1 184.01 KB 186.17 KB 2.16 KB 1.17%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody‑netcoreapp3.1 187.44 KB 189.6 KB 2.16 KB 1.15%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody‑net472 203.96 KB 206.21 KB 2.25 KB 1.10%
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody‑net472 207.5 KB 209.74 KB 2.24 KB 1.08%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 345μs 1.64μs 6.75μs 0 0 0 178.25 KB
master AllCycleSimpleBody netcoreapp3.1 505μs 1.46μs 5.66μs 0 0 0 184.01 KB
master AllCycleSimpleBody net472 462μs 84ns 314ns 31.2 0 0 203.96 KB
master AllCycleMoreComplexBody net6.0 353μs 1.01μs 3.76μs 0 0 0 181.77 KB
master AllCycleMoreComplexBody netcoreapp3.1 502μs 1.71μs 6.61μs 0 0 0 187.44 KB
master AllCycleMoreComplexBody net472 472μs 97.3ns 351ns 32.4 0 0 207.5 KB
master ObjectExtractorSimpleBody net6.0 325ns 0.203ns 0.784ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 388ns 2.21ns 15.2ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 308ns 0.0144ns 0.05ns 0.0445 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.39μs 31.1ns 136ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.77μs 35.6ns 138ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.75μs 1.81ns 6.79ns 0.573 0 0 3.8 KB
#7620 AllCycleSimpleBody net6.0 348μs 164ns 590ns 0 0 0 180.41 KB
#7620 AllCycleSimpleBody netcoreapp3.1 495μs 1.07μs 4.14μs 0 0 0 186.17 KB
#7620 AllCycleSimpleBody net472 463μs 69.4ns 260ns 32.4 0 0 206.21 KB
#7620 AllCycleMoreComplexBody net6.0 354μs 279ns 1.08μs 0 0 0 183.93 KB
#7620 AllCycleMoreComplexBody netcoreapp3.1 539μs 1.43μs 5.54μs 0 0 0 189.6 KB
#7620 AllCycleMoreComplexBody net472 471μs 114ns 427ns 32.4 0 0 209.74 KB
#7620 ObjectExtractorSimpleBody net6.0 323ns 0.14ns 0.523ns 0 0 0 280 B
#7620 ObjectExtractorSimpleBody netcoreapp3.1 395ns 2.23ns 14.4ns 0 0 0 272 B
#7620 ObjectExtractorSimpleBody net472 296ns 0.0253ns 0.0913ns 0.0432 0 0 281 B
#7620 ObjectExtractorMoreComplexBody net6.0 6.34μs 30.4ns 114ns 0 0 0 3.78 KB
#7620 ObjectExtractorMoreComplexBody netcoreapp3.1 7.67μs 37.8ns 156ns 0 0 0 3.69 KB
#7620 ObjectExtractorMoreComplexBody net472 6.64μs 0.923ns 3.57ns 0.599 0 0 3.8 KB
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EncodeArgs net6.0 78.7μs 87.4ns 327ns 0 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 98.3μs 231ns 896ns 0 0 0 32.4 KB
master EncodeArgs net472 109μs 13.2ns 49.4ns 4.9 0 0 32.51 KB
master EncodeLegacyArgs net6.0 147μs 193ns 749ns 0 0 0 2.15 KB
master EncodeLegacyArgs netcoreapp3.1 198μs 183ns 709ns 0 0 0 2.14 KB
master EncodeLegacyArgs net472 265μs 109ns 423ns 0 0 0 2.16 KB
#7620 EncodeArgs net6.0 76.8μs 272ns 1.05μs 0 0 0 32.4 KB
#7620 EncodeArgs netcoreapp3.1 97.7μs 171ns 663ns 0 0 0 32.4 KB
#7620 EncodeArgs net472 110μs 15.4ns 59.6ns 4.95 0 0 32.51 KB
#7620 EncodeLegacyArgs net6.0 143μs 33.5ns 125ns 0 0 0 2.15 KB
#7620 EncodeLegacyArgs netcoreapp3.1 197μs 164ns 636ns 0 0 0 2.14 KB
#7620 EncodeLegacyArgs net472 262μs 79.4ns 308ns 0 0 0 2.16 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7620

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑netcoreapp3.1 4.48 KB 4.51 KB 27 B 0.60%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 409μs 147ns 510ns 0 0 0 4.55 KB
master RunWafRealisticBenchmark netcoreapp3.1 819μs 11.4μs 113μs 0 0 0 4.48 KB
master RunWafRealisticBenchmark net472 434μs 80.3ns 311ns 0 0 0 4.68 KB
master RunWafRealisticBenchmarkWithAttack net6.0 296μs 62.9ns 244ns 0 0 0 2.24 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 298μs 224ns 866ns 0 0 0 2.22 KB
master RunWafRealisticBenchmarkWithAttack net472 312μs 56.3ns 218ns 0 0 0 2.29 KB
#7620 RunWafRealisticBenchmark net6.0 398μs 111ns 417ns 0 0 0 4.55 KB
#7620 RunWafRealisticBenchmark netcoreapp3.1 853μs 3.99μs 15.4μs 0 0 0 4.51 KB
#7620 RunWafRealisticBenchmark net472 431μs 52.7ns 197ns 0 0 0 4.66 KB
#7620 RunWafRealisticBenchmarkWithAttack net6.0 288μs 45.6ns 171ns 0 0 0 2.24 KB
#7620 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 297μs 71ns 246ns 0 0 0 2.22 KB
#7620 RunWafRealisticBenchmarkWithAttack net472 312μs 32.5ns 122ns 0 0 0 2.29 KB
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 62μs 56.9ns 220ns 0 0 0 14.52 KB
master SendRequest netcoreapp3.1 72.8μs 106ns 381ns 0 0 0 17.42 KB
master SendRequest net472 0.00389ns 0.0018ns 0.00698ns 0 0 0 0 b
#7620 SendRequest net6.0 61.1μs 95.8ns 358ns 0 0 0 14.52 KB
#7620 SendRequest netcoreapp3.1 71.9μs 99.7ns 359ns 0 0 0 17.42 KB
#7620 SendRequest net472 0.000379ns 0.000379ns 0.00147ns 0 0 0 0 b
Benchmarks.Trace.CharSliceBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7620

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 1 B 2 B 1 B 100.00%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net6.0 4 B 7 B 3 B 75.00%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master OriginalCharSlice net6.0 1.95ms 609ns 2.28μs 0 0 0 640.01 KB
master OriginalCharSlice netcoreapp3.1 2.06ms 4.72μs 17.7μs 0 0 0 640 KB
master OriginalCharSlice net472 2.71ms 1.73μs 6.7μs 100 0 0 641.95 KB
master OptimizedCharSlice net6.0 1.51ms 210ns 814ns 0 0 0 4 B
master OptimizedCharSlice netcoreapp3.1 1.67ms 365ns 1.42μs 0 0 0 1 B
master OptimizedCharSlice net472 1.94ms 249ns 965ns 0 0 0 0 b
master OptimizedCharSliceWithPool net6.0 807μs 59.1ns 229ns 0 0 0 1 B
master OptimizedCharSliceWithPool netcoreapp3.1 835μs 151ns 586ns 0 0 0 0 b
master OptimizedCharSliceWithPool net472 1.2ms 197ns 738ns 0 0 0 0 b
#7620 OriginalCharSlice net6.0 1.91ms 1.22μs 4.58μs 0 0 0 640.01 KB
#7620 OriginalCharSlice netcoreapp3.1 2.14ms 1.13μs 3.9μs 0 0 0 640 KB
#7620 OriginalCharSlice net472 2.57ms 3.17μs 12.3μs 100 0 0 641.95 KB
#7620 OptimizedCharSlice net6.0 1.42ms 253ns 978ns 0 0 0 7 B
#7620 OptimizedCharSlice netcoreapp3.1 1.71ms 722ns 2.8μs 0 0 0 1 B
#7620 OptimizedCharSlice net472 1.9ms 255ns 989ns 0 0 0 0 b
#7620 OptimizedCharSliceWithPool net6.0 833μs 21.6ns 83.8ns 0 0 0 2 B
#7620 OptimizedCharSliceWithPool netcoreapp3.1 843μs 117ns 452ns 0 0 0 0 b
#7620 OptimizedCharSliceWithPool net472 1.14ms 99.5ns 385ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #7620

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 1.171 984,761.30 840,784.38

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 695μs 4.01μs 33.8μs 0 0 0 41.82 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 759μs 4.01μs 20.4μs 0 0 0 42.29 KB
master WriteAndFlushEnrichedTraces net472 987μs 3.03μs 11.3μs 4.81 0 0 55.97 KB
#7620 WriteAndFlushEnrichedTraces net6.0 685μs 712ns 2.76μs 0 0 0 41.84 KB
#7620 WriteAndFlushEnrichedTraces netcoreapp3.1 776μs 6.25μs 62.5μs 0 0 0 42.09 KB
#7620 WriteAndFlushEnrichedTraces net472 838μs 3.35μs 13μs 7.81 0 0 55.94 KB
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 1.92μs 9.49ns 39.1ns 0 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 2.57μs 11.6ns 44.8ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.77μs 5.69ns 21.3ns 0.15 0.0136 0 987 B
#7620 ExecuteNonQuery net6.0 1.88μs 9.5ns 43.5ns 0 0 0 1.02 KB
#7620 ExecuteNonQuery netcoreapp3.1 2.51μs 5.99ns 22.4ns 0 0 0 1.02 KB
#7620 ExecuteNonQuery net472 2.7μs 3.56ns 13.8ns 0.149 0.0136 0 987 B
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.75μs 7.58ns 36.4ns 0 0 0 1.03 KB
master CallElasticsearch netcoreapp3.1 2.32μs 11.3ns 46.7ns 0 0 0 1.03 KB
master CallElasticsearch net472 3.5μs 4ns 15.5ns 0.158 0 0 1.04 KB
master CallElasticsearchAsync net6.0 1.84μs 6.28ns 24.3ns 0 0 0 1.01 KB
master CallElasticsearchAsync netcoreapp3.1 2.43μs 8.84ns 34.2ns 0 0 0 1.08 KB
master CallElasticsearchAsync net472 3.88μs 3.58ns 13.4ns 0.173 0 0 1.1 KB
#7620 CallElasticsearch net6.0 1.8μs 6.63ns 25.7ns 0 0 0 1.03 KB
#7620 CallElasticsearch netcoreapp3.1 2.31μs 10.3ns 38.4ns 0 0 0 1.03 KB
#7620 CallElasticsearch net472 3.51μs 4.86ns 18.8ns 0.159 0 0 1.04 KB
#7620 CallElasticsearchAsync net6.0 1.92μs 8.16ns 31.6ns 0 0 0 1.01 KB
#7620 CallElasticsearchAsync netcoreapp3.1 2.45μs 12.2ns 54.4ns 0 0 0 1.08 KB
#7620 CallElasticsearchAsync net472 3.74μs 5.3ns 20.5ns 0.168 0 0 1.1 KB
Benchmarks.Trace.GraphQLBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #7620

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net6.0 1.118 2,024.43 1,810.02

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net6.0 2.01μs 8.69ns 33.6ns 0 0 0 952 B
master ExecuteAsync netcoreapp3.1 2.33μs 9.79ns 35.3ns 0 0 0 952 B
master ExecuteAsync net472 2.52μs 7.62ns 29.5ns 0.141 0 0 915 B
#7620 ExecuteAsync net6.0 1.8μs 8.54ns 33.1ns 0 0 0 952 B
#7620 ExecuteAsync netcoreapp3.1 2.43μs 11.9ns 54.6ns 0 0 0 952 B
#7620 ExecuteAsync net472 2.54μs 2.49ns 9.31ns 0.14 0 0 915 B
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendAsync net6.0 6.98μs 5.84ns 20.2ns 0 0 0 2.36 KB
master SendAsync netcoreapp3.1 8.65μs 24.5ns 91.5ns 0 0 0 2.9 KB
master SendAsync net472 12.3μs 12.9ns 50.1ns 0.493 0 0 3.18 KB
#7620 SendAsync net6.0 7.22μs 7.08ns 25.5ns 0 0 0 2.36 KB
#7620 SendAsync netcoreapp3.1 8.56μs 17.3ns 64.9ns 0 0 0 2.9 KB
#7620 SendAsync net472 12.4μs 12.6ns 48.8ns 0.496 0 0 3.18 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Faster 🎉 More allocations ⚠️

Faster 🎉 in #7620

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 1.185 553,600.00 467,300.00

More allocations ⚠️ in #7620

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 248.67 KB 275.54 KB 26.86 KB 10.80%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1 42.78 KB 43.93 KB 1.14 KB 2.67%

Fewer allocations 🎉 in #7620

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 44.9 KB 43.82 KB -1.07 KB -2.39%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 277.88 KB 257.91 KB -19.97 KB -7.19%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 51.7μs 809ns 8μs 0 0 0 44.9 KB
master StringConcatBenchmark netcoreapp3.1 50.4μs 444ns 4.28μs 0 0 0 42.78 KB
master StringConcatBenchmark net472 57.4μs 281ns 1.16μs 0 0 0 57.34 KB
master StringConcatAspectBenchmark net6.0 555μs 2.58μs 9.65μs 0 0 0 277.88 KB
master StringConcatAspectBenchmark netcoreapp3.1 523μs 2.44μs 9.11μs 0 0 0 248.67 KB
master StringConcatAspectBenchmark net472 404μs 2.29μs 16.8μs 0 0 0 278.53 KB
#7620 StringConcatBenchmark net6.0 42.7μs 241ns 1.52μs 0 0 0 43.82 KB
#7620 StringConcatBenchmark netcoreapp3.1 48.4μs 241ns 1.08μs 0 0 0 43.93 KB
#7620 StringConcatBenchmark net472 55.9μs 213ns 929ns 0 0 0 57.34 KB
#7620 StringConcatAspectBenchmark net6.0 469μs 1.76μs 6.33μs 0 0 0 257.91 KB
#7620 StringConcatAspectBenchmark netcoreapp3.1 511μs 2.54μs 10.8μs 0 0 0 275.54 KB
#7620 StringConcatAspectBenchmark net472 402μs 2.17μs 11.5μs 0 0 0 278.53 KB
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 2.48μs 8.94ns 34.6ns 0 0 0 1.7 KB
master EnrichedLog netcoreapp3.1 3.58μs 12.9ns 50.1ns 0 0 0 1.7 KB
master EnrichedLog net472 3.78μs 6.93ns 26.9ns 0.246 0 0 1.64 KB
#7620 EnrichedLog net6.0 2.49μs 0.815ns 3.05ns 0 0 0 1.7 KB
#7620 EnrichedLog netcoreapp3.1 3.54μs 17ns 70.3ns 0 0 0 1.7 KB
#7620 EnrichedLog net472 3.63μs 2.87ns 11.1ns 0.254 0 0 1.64 KB
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 125μs 546ns 2.5μs 0 0 0 4.31 KB
master EnrichedLog netcoreapp3.1 127μs 133ns 498ns 0 0 0 4.31 KB
master EnrichedLog net472 167μs 105ns 405ns 0 0 0 4.52 KB
#7620 EnrichedLog net6.0 126μs 722ns 5.64μs 0 0 0 4.31 KB
#7620 EnrichedLog netcoreapp3.1 128μs 190ns 711ns 0 0 0 4.31 KB
#7620 EnrichedLog net472 167μs 92.8ns 347ns 0 0 0 4.52 KB
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 4.98μs 10.8ns 41.6ns 0 0 0 2.26 KB
master EnrichedLog netcoreapp3.1 6.8μs 13.1ns 50.6ns 0 0 0 2.26 KB
master EnrichedLog net472 7.26μs 5.4ns 20.9ns 0.325 0 0 2.08 KB
#7620 EnrichedLog net6.0 5.1μs 17.3ns 64.8ns 0 0 0 2.26 KB
#7620 EnrichedLog netcoreapp3.1 6.92μs 14.6ns 56.4ns 0 0 0 2.26 KB
#7620 EnrichedLog net472 7.68μs 10.3ns 40.1ns 0.307 0 0 2.08 KB
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net6.0 1.94μs 10.1ns 50.5ns 0 0 0 1.2 KB
master SendReceive netcoreapp3.1 2.86μs 7.7ns 29.8ns 0 0 0 1.2 KB
master SendReceive net472 3.05μs 4.77ns 18.5ns 0.186 0 0 1.2 KB
#7620 SendReceive net6.0 2.04μs 9.73ns 40.1ns 0 0 0 1.2 KB
#7620 SendReceive netcoreapp3.1 2.68μs 10.7ns 41.4ns 0 0 0 1.2 KB
#7620 SendReceive net472 3.12μs 3.66ns 13.7ns 0.185 0 0 1.2 KB
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 4.16μs 17.2ns 61.9ns 0 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 5.47μs 12.8ns 49.6ns 0 0 0 1.63 KB
master EnrichedLog net472 6.43μs 4.53ns 16.3ns 0.322 0 0 2.03 KB
#7620 EnrichedLog net6.0 4.06μs 2.57ns 9.62ns 0 0 0 1.58 KB
#7620 EnrichedLog netcoreapp3.1 5.49μs 11.8ns 45.8ns 0 0 0 1.63 KB
#7620 EnrichedLog net472 6.48μs 7.92ns 30.7ns 0.291 0 0 2.03 KB
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 742ns 3.39ns 13.6ns 0 0 0 576 B
master StartFinishSpan netcoreapp3.1 919ns 0.601ns 2.33ns 0 0 0 576 B
master StartFinishSpan net472 891ns 0.563ns 2.18ns 0.0895 0 0 578 B
master StartFinishScope net6.0 878ns 4.86ns 24.8ns 0 0 0 696 B
master StartFinishScope netcoreapp3.1 1.14μs 6.1ns 32.3ns 0 0 0 696 B
master StartFinishScope net472 1.11μs 1.53ns 5.92ns 0.0995 0 0 658 B
#7620 StartFinishSpan net6.0 738ns 3.76ns 16.4ns 0 0 0 576 B
#7620 StartFinishSpan netcoreapp3.1 923ns 5.05ns 28.5ns 0 0 0 576 B
#7620 StartFinishSpan net472 894ns 0.131ns 0.471ns 0.0893 0 0 578 B
#7620 StartFinishScope net6.0 874ns 3.76ns 14.6ns 0 0 0 696 B
#7620 StartFinishScope netcoreapp3.1 1.16μs 6.02ns 30.1ns 0 0 0 696 B
#7620 StartFinishScope net472 1.07μs 0.245ns 0.918ns 0.102 0 0 658 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 1.03μs 5.57ns 31ns 0 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 1.45μs 6.05ns 23.4ns 0 0 0 696 B
master RunOnMethodBegin net472 1.44μs 0.394ns 1.42ns 0.101 0 0 658 B
#7620 RunOnMethodBegin net6.0 1.02μs 5.61ns 28.1ns 0 0 0 696 B
#7620 RunOnMethodBegin netcoreapp3.1 1.39μs 6.91ns 29.3ns 0 0 0 696 B
#7620 RunOnMethodBegin net472 1.41μs 1.35ns 5.06ns 0.0989 0 0 658 B

@dd-trace-dotnet-ci-bot
Copy link

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing the following branches/commits:

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 shown 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).

gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7620) - mean (72ms)  : 71, 73
     .   : milestone, 72,
    master - mean (72ms)  : 71, 73
     .   : milestone, 72,

    section Baseline
    This PR (7620) - mean (68ms)  : 66, 70
     .   : milestone, 68,
    master - mean (68ms)  : 66, 70
     .   : milestone, 68,

    section CallTarget+Inlining+NGEN
    This PR (7620) - mean (1,051ms)  : 992, 1110
     .   : milestone, 1051,
    master - mean (1,056ms)  : 985, 1127
     .   : milestone, 1056,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7620) - mean (107ms)  : 105, 108
     .   : milestone, 107,
    master - mean (106ms)  : 105, 108
     .   : milestone, 106,

    section Baseline
    This PR (7620) - mean (106ms)  : 103, 109
     .   : milestone, 106,
    master - mean (106ms)  : 103, 108
     .   : milestone, 106,

    section CallTarget+Inlining+NGEN
    This PR (7620) - mean (739ms)  : 715, 764
     .   : milestone, 739,
    master - mean (750ms)  : 700, 799
     .   : milestone, 750,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7620) - mean (101ms)  : 100, 101
     .   : milestone, 101,
    master - mean (100ms)  : 99, 101
     .   : milestone, 100,

    section Baseline
    This PR (7620) - mean (100ms)  : 98, 102
     .   : milestone, 100,
    master - mean (100ms)  : 98, 102
     .   : milestone, 100,

    section CallTarget+Inlining+NGEN
    This PR (7620) - mean (775ms)  : 735, 815
     .   : milestone, 775,
    master - mean (779ms)  : 738, 820
     .   : milestone, 779,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7620) - mean (93ms)  : 92, 94
     .   : milestone, 93,
    master - mean (93ms)  : 92, 94
     .   : milestone, 93,

    section Baseline
    This PR (7620) - mean (92ms)  : 89, 95
     .   : milestone, 92,
    master - mean (92ms)  : 90, 95
     .   : milestone, 92,

    section CallTarget+Inlining+NGEN
    This PR (7620) - mean (658ms)  : 640, 676
     .   : milestone, 658,
    master - mean (663ms)  : 648, 679
     .   : milestone, 663,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7620) - mean (198ms)  : 193, 202
     .   : milestone, 198,
    master - mean (197ms)  : 194, 201
     .   : milestone, 197,

    section Baseline
    This PR (7620) - mean (194ms)  : 191, 196
     .   : milestone, 194,
    master - mean (194ms)  : 189, 199
     .   : milestone, 194,

    section CallTarget+Inlining+NGEN
    This PR (7620) - mean (1,176ms)  : 1111, 1241
     .   : milestone, 1176,
    master - mean (1,168ms)  : 1113, 1223
     .   : milestone, 1168,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7620) - mean (284ms)  : 276, 291
     .   : milestone, 284,
    master - mean (278ms)  : 275, 282
     .   : milestone, 278,

    section Baseline
    This PR (7620) - mean (283ms)  : 274, 292
     .   : milestone, 283,
    master - mean (278ms)  : 273, 283
     .   : milestone, 278,

    section CallTarget+Inlining+NGEN
    This PR (7620) - mean (953ms)  : 904, 1002
     .   : milestone, 953,
    master - mean (944ms)  : 882, 1007
     .   : milestone, 944,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7620) - mean (285ms)  : 280, 290
     .   : milestone, 285,
    master - mean (282ms)  : 277, 287
     .   : milestone, 282,

    section Baseline
    This PR (7620) - mean (286ms)  : 279, 293
     .   : milestone, 286,
    master - mean (283ms)  : 276, 290
     .   : milestone, 283,

    section CallTarget+Inlining+NGEN
    This PR (7620) - mean (1,003ms)  : 963, 1043
     .   : milestone, 1003,
    master - mean (996ms)  : 957, 1035
     .   : milestone, 996,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7620) - mean (271ms)  : 266, 275
     .   : milestone, 271,
    master - mean (271ms)  : 265, 276
     .   : milestone, 271,

    section Baseline
    This PR (7620) - mean (271ms)  : 267, 276
     .   : milestone, 271,
    master - mean (270ms)  : 266, 274
     .   : milestone, 270,

    section CallTarget+Inlining+NGEN
    This PR (7620) - mean (854ms)  : 830, 879
     .   : milestone, 854,
    master - mean (857ms)  : 837, 877
     .   : milestone, 857,

Loading

Copy link
Contributor

@duncanpharvey duncanpharvey left a comment

Choose a reason for hiding this comment

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

LGTM! Just one question - will spans be generated for EventHubBufferedProducerClient.EnqueueEventAsync? It looks like this is another option users have to send events

https://learn.microsoft.com/en-us/dotnet/api/azure.messaging.eventhubs.producer.eventhubbufferedproducerclient?view=azure-dotnet

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants