Skip to content

Conversation

andrewlock
Copy link
Member

Summary of changes

Move some of the bail-out checks from the native loader into the native tracer

Reason for change

As far as I can tell, these checks really should be in the native loader, and they're only in the native tracer currently for historical reasons. This results in both duplication of work and mismatch between traced processes for the profiler and the tracer. This was discovered as part of the work in #7287.

Implementation details

  • Removed duplicate checks (process name variables) from the native tracer
  • Moved the additional CI Visibility checks to the native loader. I'll defer to @tonyredondo if we want to tidy these up at all
  • Moved the AAS checks to the native loader. I'll defer to @lucaspimentel if we want to change any of these.

Test coverage

This should be covered by the existing tests in general, but I may add an additional instrumentation test to make sure we get no tracer logs for previous cases where we would have done.

Other details

Currently the native tracer prints a bunch of env vars for debugging purposes. We could move this to the native loader too if we prefer.

@andrewlock andrewlock requested review from a team as code owners September 3, 2025 13:45
@andrewlock andrewlock added type:refactor area:native-library Automatic instrumentation native C++ code (Datadog.Trace.ClrProfiler.Native) labels Sep 3, 2025

if (!azure_functions_enabled)
{
Log::Info("DATADOG TRACER DIAGNOSTICS - ClrProfiler explicitly disabled for Azure Functions.");
Copy link
Member

Choose a reason for hiding this comment

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

TIL we had a env var for this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Same 😅

}

// AAS checks
const auto isRunningInAas = TryParseBooleanEnvironmentValue(
Copy link
Member

Choose a reason for hiding this comment

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

We should be careful with DD_AZURE_APP_SERVICES. It doesn't mean "we're running inside AAS," it means "we're instrumenting with the site extension."

We now have a nuget package that can be used instead of the site extension, and DD_AZURE_APP_SERVICES won't be set in that case.

Copy link
Member

Choose a reason for hiding this comment

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

In managed code, we now use WEBSITE_SITE_NAME to determine if we are running in Azure App Services.

Copy link
Member

Choose a reason for hiding this comment

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

(no action required in this PR, just an observation)

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Sep 3, 2025

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 3a7af88 | Docs | Was this helpful? Give us feedback!

@pr-commenter
Copy link

pr-commenter bot commented Sep 3, 2025

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #7462 compared to master:

  • 1 benchmarks are slower, with geometric mean 2.071
  • 7 benchmarks have fewer allocations
  • 5 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 ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #7462

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net6.0 5.5 KB 5.47 KB -30 B -0.55%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 10.1μs 57.5ns 410ns 0 0 0 5.5 KB
master StartStopWithChild netcoreapp3.1 13.6μs 50.3ns 195ns 0 0 0 5.71 KB
master StartStopWithChild net472 21.6μs 115ns 640ns 0.873 0.218 0 6.07 KB
#7462 StartStopWithChild net6.0 10.7μs 54ns 253ns 0 0 0 5.47 KB
#7462 StartStopWithChild netcoreapp3.1 13.7μs 70.7ns 324ns 0 0 0 5.7 KB
#7462 StartStopWithChild net472 21.8μs 116ns 626ns 0.997 0.332 0.111 6.06 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 923μs 78.7ns 295ns 0 0 0 2.71 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.04ms 349ns 1.31μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.19ms 70.7ns 245ns 0 0 0 3.31 KB
#7462 WriteAndFlushEnrichedTraces net6.0 919μs 51.3ns 185ns 0 0 0 2.71 KB
#7462 WriteAndFlushEnrichedTraces netcoreapp3.1 1.03ms 41.8ns 151ns 0 0 0 2.7 KB
#7462 WriteAndFlushEnrichedTraces net472 1.2ms 121ns 469ns 0 0 0 3.31 KB
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 319μs 1.51μs 6.41μs 0 0 0 172.08 KB
master AllCycleSimpleBody netcoreapp3.1 496μs 359ns 1.39μs 0 0 0 174.18 KB
master AllCycleSimpleBody net472 427μs 298ns 1.15μs 29.2 0 0 194.24 KB
master AllCycleMoreComplexBody net6.0 333μs 1.33μs 5.16μs 0 0 0 175.58 KB
master AllCycleMoreComplexBody netcoreapp3.1 495μs 291ns 1.13μs 0 0 0 177.6 KB
master AllCycleMoreComplexBody net472 437μs 173ns 668ns 30.2 0 0 197.76 KB
master ObjectExtractorSimpleBody net6.0 322ns 1.68ns 8.55ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 410ns 2.05ns 8.46ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 300ns 0.0527ns 0.183ns 0.0436 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.34μs 31.6ns 134ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.86μs 38.3ns 153ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.77μs 2.73ns 10.6ns 0.573 0 0 3.8 KB
#7462 AllCycleSimpleBody net6.0 324μs 573ns 2.14μs 0 0 0 172.07 KB
#7462 AllCycleSimpleBody netcoreapp3.1 480μs 1.53μs 5.92μs 0 0 0 174.18 KB
#7462 AllCycleSimpleBody net472 426μs 130ns 502ns 29.2 0 0 194.24 KB
#7462 AllCycleMoreComplexBody net6.0 331μs 241ns 902ns 0 0 0 175.58 KB
#7462 AllCycleMoreComplexBody netcoreapp3.1 484μs 1.42μs 5.13μs 0 0 0 177.6 KB
#7462 AllCycleMoreComplexBody net472 432μs 154ns 596ns 30.2 0 0 197.78 KB
#7462 ObjectExtractorSimpleBody net6.0 329ns 1.73ns 8.66ns 0 0 0 280 B
#7462 ObjectExtractorSimpleBody netcoreapp3.1 395ns 2.11ns 11.6ns 0 0 0 272 B
#7462 ObjectExtractorSimpleBody net472 304ns 0.037ns 0.143ns 0.0443 0 0 281 B
#7462 ObjectExtractorMoreComplexBody net6.0 6.35μs 25.6ns 99.3ns 0 0 0 3.78 KB
#7462 ObjectExtractorMoreComplexBody netcoreapp3.1 7.81μs 19.5ns 75.5ns 0 0 0 3.69 KB
#7462 ObjectExtractorMoreComplexBody net472 6.79μs 3.71ns 14.4ns 0.575 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 77.9μs 31.3ns 117ns 0 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 97.7μs 19.9ns 74.4ns 0 0 0 32.4 KB
master EncodeArgs net472 109μs 7.05ns 26.4ns 4.91 0 0 32.51 KB
master EncodeLegacyArgs net6.0 146μs 120ns 450ns 0 0 0 2.15 KB
master EncodeLegacyArgs netcoreapp3.1 198μs 171ns 617ns 0 0 0 2.14 KB
master EncodeLegacyArgs net472 268μs 26ns 93.7ns 0 0 0 2.16 KB
#7462 EncodeArgs net6.0 76.8μs 194ns 750ns 0 0 0 32.4 KB
#7462 EncodeArgs netcoreapp3.1 96.5μs 156ns 602ns 0 0 0 32.4 KB
#7462 EncodeArgs net472 109μs 11.4ns 44ns 4.9 0 0 32.51 KB
#7462 EncodeLegacyArgs net6.0 148μs 91.7ns 355ns 0 0 0 2.14 KB
#7462 EncodeLegacyArgs netcoreapp3.1 196μs 28.4ns 102ns 0 0 0 2.14 KB
#7462 EncodeLegacyArgs net472 263μs 70.8ns 274ns 0 0 0 2.16 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Slower ⚠️ More allocations ⚠️

Slower ⚠️ in #7462

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑netcoreapp3.1 2.071 413,581.77 856,600.21

More allocations ⚠️ in #7462

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑netcoreapp3.1 4.48 KB 4.5 KB 23 B 0.51%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 401μs 43.1ns 156ns 0 0 0 4.55 KB
master RunWafRealisticBenchmark netcoreapp3.1 414μs 125ns 434ns 0 0 0 4.48 KB
master RunWafRealisticBenchmark net472 440μs 110ns 425ns 0 0 0 4.66 KB
master RunWafRealisticBenchmarkWithAttack net6.0 289μs 92.2ns 357ns 0 0 0 2.24 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 300μs 81.1ns 303ns 0 0 0 2.22 KB
master RunWafRealisticBenchmarkWithAttack net472 318μs 35.9ns 139ns 0 0 0 2.28 KB
#7462 RunWafRealisticBenchmark net6.0 396μs 87.1ns 326ns 0 0 0 4.55 KB
#7462 RunWafRealisticBenchmark netcoreapp3.1 852μs 3.61μs 14μs 0 0 0 4.5 KB
#7462 RunWafRealisticBenchmark net472 434μs 54.4ns 211ns 0 0 0 4.66 KB
#7462 RunWafRealisticBenchmarkWithAttack net6.0 286μs 35.7ns 133ns 0 0 0 2.24 KB
#7462 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 303μs 811ns 2.81μs 0 0 0 2.22 KB
#7462 RunWafRealisticBenchmarkWithAttack net472 313μs 30.1ns 104ns 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 60.1μs 53.3ns 199ns 0 0 0 14.52 KB
master SendRequest netcoreapp3.1 71.2μs 47.3ns 177ns 0 0 0 17.42 KB
master SendRequest net472 0ns 0ns 0ns 0 0 0 0 b
#7462 SendRequest net6.0 59.8μs 113ns 391ns 0 0 0 14.52 KB
#7462 SendRequest netcoreapp3.1 72.2μs 125ns 484ns 0 0 0 17.42 KB
#7462 SendRequest net472 0.011ns 0.00193ns 0.00748ns 0 0 0 0 b
Benchmarks.Trace.CharSliceBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7462

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 1 B 4 B 3 B 300.00%

Fewer allocations 🎉 in #7462

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net6.0 4 B 2 B -2 B -50.00%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑netcoreapp3.1 1 B 0 b -1 B -100.00%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master OriginalCharSlice net6.0 1.9ms 4.8μs 18.6μs 0 0 0 640.01 KB
master OriginalCharSlice netcoreapp3.1 2.09ms 3.55μs 13.7μs 0 0 0 640 KB
master OriginalCharSlice net472 2.64ms 439ns 1.7μs 100 0 0 641.95 KB
master OptimizedCharSlice net6.0 1.37ms 861ns 3.33μs 0 0 0 4 B
master OptimizedCharSlice netcoreapp3.1 1.68ms 687ns 2.66μs 0 0 0 1 B
master OptimizedCharSlice net472 1.98ms 619ns 2.4μs 0 0 0 0 b
master OptimizedCharSliceWithPool net6.0 804μs 33.2ns 124ns 0 0 0 1 B
master OptimizedCharSliceWithPool netcoreapp3.1 833μs 164ns 636ns 0 0 0 1 B
master OptimizedCharSliceWithPool net472 1.13ms 75.3ns 282ns 0 0 0 0 b
#7462 OriginalCharSlice net6.0 1.88ms 3.01μs 11.7μs 0 0 0 640.01 KB
#7462 OriginalCharSlice netcoreapp3.1 2.14ms 6.96μs 26.9μs 0 0 0 640 KB
#7462 OriginalCharSlice net472 2.68ms 207ns 775ns 100 0 0 641.95 KB
#7462 OptimizedCharSlice net6.0 1.42ms 5μs 19.4μs 0 0 0 2 B
#7462 OptimizedCharSlice netcoreapp3.1 1.68ms 282ns 1.09μs 0 0 0 1 B
#7462 OptimizedCharSlice net472 2ms 291ns 1.13μs 0 0 0 0 b
#7462 OptimizedCharSliceWithPool net6.0 849μs 33.2ns 124ns 0 0 0 4 B
#7462 OptimizedCharSliceWithPool netcoreapp3.1 796μs 112ns 433ns 0 0 0 0 b
#7462 OptimizedCharSliceWithPool net472 1.14ms 27.6ns 99.6ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7462

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 55.89 KB 56.36 KB 470 B 0.84%

Fewer allocations 🎉 in #7462

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 42.32 KB 41.95 KB -372 B -0.88%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 724μs 2.59μs 10.3μs 0 0 0 41.69 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 701μs 3.9μs 24.4μs 0 0 0 42.32 KB
master WriteAndFlushEnrichedTraces net472 914μs 2.05μs 7.65μs 4.46 0 0 55.89 KB
#7462 WriteAndFlushEnrichedTraces net6.0 675μs 1.11μs 4.31μs 0 0 0 41.8 KB
#7462 WriteAndFlushEnrichedTraces netcoreapp3.1 667μs 3.01μs 14.4μs 0 0 0 41.95 KB
#7462 WriteAndFlushEnrichedTraces net472 933μs 4.4μs 16.5μs 8.93 4.46 0 56.36 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.81μs 6.06ns 23.5ns 0 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 2.5μs 4.05ns 15.2ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.77μs 1.83ns 7.09ns 0.151 0.0137 0 987 B
#7462 ExecuteNonQuery net6.0 1.91μs 1.12ns 4.32ns 0 0 0 1.02 KB
#7462 ExecuteNonQuery netcoreapp3.1 2.52μs 10.1ns 39ns 0 0 0 1.02 KB
#7462 ExecuteNonQuery net472 2.69μs 3.33ns 12.9ns 0.148 0.0135 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.67μs 7.13ns 26.7ns 0 0 0 1.03 KB
master CallElasticsearch netcoreapp3.1 2.28μs 8.4ns 32.5ns 0 0 0 1.03 KB
master CallElasticsearch net472 3.48μs 2.69ns 10.1ns 0.158 0 0 1.04 KB
master CallElasticsearchAsync net6.0 1.88μs 2.04ns 7.89ns 0 0 0 1.01 KB
master CallElasticsearchAsync netcoreapp3.1 2.39μs 11.5ns 47.3ns 0 0 0 1.08 KB
master CallElasticsearchAsync net472 3.75μs 4.27ns 16.5ns 0.168 0 0 1.1 KB
#7462 CallElasticsearch net6.0 1.71μs 8.94ns 41.9ns 0 0 0 1.03 KB
#7462 CallElasticsearch netcoreapp3.1 2.2μs 10.5ns 43.1ns 0 0 0 1.03 KB
#7462 CallElasticsearch net472 3.57μs 3.13ns 12.1ns 0.159 0 0 1.04 KB
#7462 CallElasticsearchAsync net6.0 1.85μs 4.5ns 16.8ns 0 0 0 1.01 KB
#7462 CallElasticsearchAsync netcoreapp3.1 2.39μs 9.05ns 35.1ns 0 0 0 1.08 KB
#7462 CallElasticsearchAsync net472 3.85μs 6.66ns 25.8ns 0.174 0 0 1.1 KB
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net6.0 1.78μs 8.08ns 31.3ns 0 0 0 952 B
master ExecuteAsync netcoreapp3.1 2.27μs 7.1ns 27.5ns 0 0 0 952 B
master ExecuteAsync net472 2.44μs 0.844ns 3.27ns 0.135 0 0 915 B
#7462 ExecuteAsync net6.0 1.77μs 5.24ns 20.3ns 0 0 0 952 B
#7462 ExecuteAsync netcoreapp3.1 2.32μs 5.24ns 20.3ns 0 0 0 952 B
#7462 ExecuteAsync net472 2.42μs 4.63ns 17.9ns 0.134 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.96μs 18.3ns 71ns 0 0 0 2.36 KB
master SendAsync netcoreapp3.1 8.82μs 8.4ns 32.5ns 0 0 0 2.9 KB
master SendAsync net472 12.2μs 5.42ns 21ns 0.487 0 0 3.18 KB
#7462 SendAsync net6.0 7.03μs 24.3ns 94.3ns 0 0 0 2.36 KB
#7462 SendAsync netcoreapp3.1 8.43μs 11.2ns 41.7ns 0 0 0 2.9 KB
#7462 SendAsync net472 12.1μs 14ns 54.3ns 0.483 0 0 3.18 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7462

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1 42.64 KB 44.04 KB 1.4 KB 3.28%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 43.15 KB 44.34 KB 1.19 KB 2.76%

Fewer allocations 🎉 in #7462

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 275.65 KB 273.08 KB -2.57 KB -0.93%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472 286.72 KB 278.53 KB -8.19 KB -2.86%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 275.96 KB 254.61 KB -21.35 KB -7.74%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 48.1μs 262ns 1.53μs 0 0 0 43.15 KB
master StringConcatBenchmark netcoreapp3.1 47.8μs 228ns 1.21μs 0 0 0 42.64 KB
master StringConcatBenchmark net472 57.5μs 132ns 477ns 0 0 0 57.34 KB
master StringConcatAspectBenchmark net6.0 481μs 2.38μs 10.1μs 0 0 0 275.65 KB
master StringConcatAspectBenchmark netcoreapp3.1 464μs 4.71μs 46.4μs 0 0 0 275.96 KB
master StringConcatAspectBenchmark net472 402μs 1.85μs 6.66μs 0 0 0 286.72 KB
#7462 StringConcatBenchmark net6.0 47.3μs 192ns 939ns 0 0 0 44.34 KB
#7462 StringConcatBenchmark netcoreapp3.1 48.7μs 237ns 948ns 0 0 0 44.04 KB
#7462 StringConcatBenchmark net472 57.6μs 263ns 1.02μs 0 0 0 57.34 KB
#7462 StringConcatAspectBenchmark net6.0 482μs 1.42μs 6.2μs 0 0 0 273.08 KB
#7462 StringConcatAspectBenchmark netcoreapp3.1 487μs 2.15μs 8.59μs 0 0 0 254.61 KB
#7462 StringConcatAspectBenchmark net472 405μs 2.14μs 16.3μ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.54μs 13ns 59.6ns 0 0 0 1.7 KB
master EnrichedLog netcoreapp3.1 3.44μs 11.9ns 46ns 0 0 0 1.7 KB
master EnrichedLog net472 3.97μs 5.55ns 21.5ns 0.256 0 0 1.64 KB
#7462 EnrichedLog net6.0 2.5μs 13.5ns 70ns 0 0 0 1.7 KB
#7462 EnrichedLog netcoreapp3.1 3.45μs 1.99ns 7.46ns 0 0 0 1.7 KB
#7462 EnrichedLog net472 3.99μs 6.1ns 22.8ns 0.26 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 122μs 119ns 431ns 0 0 0 4.31 KB
master EnrichedLog netcoreapp3.1 127μs 153ns 574ns 0 0 0 4.31 KB
master EnrichedLog net472 167μs 40.1ns 150ns 0 0 0 4.51 KB
#7462 EnrichedLog net6.0 123μs 58.8ns 220ns 0 0 0 4.31 KB
#7462 EnrichedLog netcoreapp3.1 127μs 194ns 698ns 0 0 0 4.31 KB
#7462 EnrichedLog net472 166μs 112ns 417ns 0 0 0 4.51 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.91μs 17.1ns 66.1ns 0 0 0 2.26 KB
master EnrichedLog netcoreapp3.1 6.72μs 15.6ns 58.4ns 0 0 0 2.26 KB
master EnrichedLog net472 7.62μs 5.1ns 18.4ns 0.306 0 0 2.08 KB
#7462 EnrichedLog net6.0 5.12μs 16.9ns 63.2ns 0 0 0 2.26 KB
#7462 EnrichedLog netcoreapp3.1 6.83μs 9.31ns 36ns 0 0 0 2.26 KB
#7462 EnrichedLog net472 7.47μs 4.79ns 18.6ns 0.299 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.99μs 10.1ns 48.6ns 0 0 0 1.2 KB
master SendReceive netcoreapp3.1 2.57μs 7.99ns 30.9ns 0 0 0 1.2 KB
master SendReceive net472 3.05μs 8.15ns 31.6ns 0.181 0 0 1.2 KB
#7462 SendReceive net6.0 2.01μs 10.5ns 53.5ns 0 0 0 1.2 KB
#7462 SendReceive netcoreapp3.1 2.69μs 7.39ns 28.6ns 0 0 0 1.2 KB
#7462 SendReceive net472 3.17μs 3.76ns 14.6ns 0.19 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.1μs 4.21ns 15.8ns 0 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 5.58μs 2.41ns 9.34ns 0 0 0 1.63 KB
master EnrichedLog net472 6.63μs 13.7ns 53.1ns 0.299 0 0 2.03 KB
#7462 EnrichedLog net6.0 4.24μs 3.32ns 12.8ns 0 0 0 1.58 KB
#7462 EnrichedLog netcoreapp3.1 5.64μs 13.3ns 51.7ns 0 0 0 1.63 KB
#7462 EnrichedLog net472 6.79μs 9.13ns 35.3ns 0.305 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 740ns 3.97ns 22.5ns 0 0 0 576 B
master StartFinishSpan netcoreapp3.1 954ns 4.83ns 22.1ns 0 0 0 576 B
master StartFinishSpan net472 891ns 0.194ns 0.725ns 0.0896 0 0 578 B
master StartFinishScope net6.0 885ns 3.96ns 14.8ns 0 0 0 696 B
master StartFinishScope netcoreapp3.1 1.16μs 6.02ns 28.2ns 0 0 0 696 B
master StartFinishScope net472 1.08μs 0.187ns 0.726ns 0.103 0 0 658 B
#7462 StartFinishSpan net6.0 734ns 0.263ns 0.984ns 0 0 0 576 B
#7462 StartFinishSpan netcoreapp3.1 926ns 5.05ns 28.1ns 0 0 0 576 B
#7462 StartFinishSpan net472 916ns 0.0619ns 0.232ns 0.0918 0 0 578 B
#7462 StartFinishScope net6.0 887ns 4.97ns 30.2ns 0 0 0 696 B
#7462 StartFinishScope netcoreapp3.1 1.13μs 5.97ns 31ns 0 0 0 696 B
#7462 StartFinishScope net472 1.09μs 0.0831ns 0.311ns 0.0992 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.01ns 20ns 0 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 1.32μs 6.28ns 25.1ns 0 0 0 696 B
master RunOnMethodBegin net472 1.42μs 1.8ns 6.98ns 0.0992 0 0 658 B
#7462 RunOnMethodBegin net6.0 1.02μs 5.02ns 20.7ns 0 0 0 696 B
#7462 RunOnMethodBegin netcoreapp3.1 1.36μs 4.43ns 17.1ns 0 0 0 696 B
#7462 RunOnMethodBegin net472 1.39μs 1.13ns 4.39ns 0.103 0 0 658 B

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

dd-trace-dotnet-ci-bot bot commented Sep 3, 2025

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 (7462) - mean (72ms)  : 71, 73
     .   : milestone, 72,
    master - mean (72ms)  : 71, 73
     .   : milestone, 72,

    section Baseline
    This PR (7462) - mean (70ms)  : 63, 77
     .   : milestone, 70,
    master - mean (72ms)  : 65, 80
     .   : milestone, 72,

    section CallTarget+Inlining+NGEN
    This PR (7462) - mean (991ms)  : 958, 1024
     .   : milestone, 991,
    master - mean (991ms)  : 957, 1025
     .   : milestone, 991,

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

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

    section CallTarget+Inlining+NGEN
    This PR (7462) - mean (698ms)  : 680, 716
     .   : milestone, 698,
    master - mean (700ms)  : 676, 725
     .   : milestone, 700,

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

    section Baseline
    This PR (7462) - mean (94ms)  : 92, 95
     .   : milestone, 94,
    master - mean (94ms)  : 91, 96
     .   : milestone, 94,

    section CallTarget+Inlining+NGEN
    This PR (7462) - mean (653ms)  : 630, 676
     .   : milestone, 653,
    master - mean (654ms)  : 635, 674
     .   : milestone, 654,

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

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

    section CallTarget+Inlining+NGEN
    This PR (7462) - mean (589ms)  : 577, 601
     .   : milestone, 589,
    master - mean (596ms)  : 584, 607
     .   : milestone, 596,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7462) - mean (192ms)  : 186, 197
     .   : milestone, 192,
    master - mean (195ms)  : 191, 200
     .   : milestone, 195,

    section Baseline
    This PR (7462) - mean (189ms)  : 181, 198
     .   : milestone, 189,
    master - mean (191ms)  : 185, 197
     .   : milestone, 191,

    section CallTarget+Inlining+NGEN
    This PR (7462) - mean (1,081ms)  : 1039, 1123
     .   : milestone, 1081,
    master - mean (1,100ms)  : 1067, 1134
     .   : milestone, 1100,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7462) - mean (272ms)  : 264, 280
     .   : milestone, 272,
    master - mean (276ms)  : 272, 280
     .   : milestone, 276,

    section Baseline
    This PR (7462) - mean (270ms)  : 262, 278
     .   : milestone, 270,
    master - mean (276ms)  : 271, 281
     .   : milestone, 276,

    section CallTarget+Inlining+NGEN
    This PR (7462) - mean (878ms)  : 847, 908
     .   : milestone, 878,
    master - mean (897ms)  : 863, 932
     .   : milestone, 897,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7462) - mean (265ms)  : 257, 274
     .   : milestone, 265,
    master - mean (270ms)  : 265, 276
     .   : milestone, 270,

    section Baseline
    This PR (7462) - mean (263ms)  : 255, 271
     .   : milestone, 263,
    master - mean (269ms)  : 264, 274
     .   : milestone, 269,

    section CallTarget+Inlining+NGEN
    This PR (7462) - mean (859ms)  : 817, 901
     .   : milestone, 859,
    master - mean (878ms)  : 846, 910
     .   : milestone, 878,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7462) - mean (265ms)  : 256, 274
     .   : milestone, 265,
    master - mean (269ms)  : 264, 274
     .   : milestone, 269,

    section Baseline
    This PR (7462) - mean (263ms)  : 254, 271
     .   : milestone, 263,
    master - mean (268ms)  : 263, 273
     .   : milestone, 268,

    section CallTarget+Inlining+NGEN
    This PR (7462) - mean (776ms)  : 753, 799
     .   : milestone, 776,
    master - mean (795ms)  : 769, 820
     .   : milestone, 795,

Loading

Copy link
Contributor

@chrisnas chrisnas left a comment

Choose a reason for hiding this comment

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

LGTM
I like the idea of renaming "profiler" depending on native loader (CLR profiler), tracer and continuous profiler

@andrewlock andrewlock force-pushed the andrew/consolidate-bailout-checks branch from 6c1d1f4 to 3a7af88 Compare September 4, 2025 07:55
@andrewlock andrewlock merged commit 3cb7794 into master Sep 4, 2025
157 of 159 checks passed
@andrewlock andrewlock deleted the andrew/consolidate-bailout-checks branch September 4, 2025 09:55
@github-actions github-actions bot added this to the vNext-v3 milestone Sep 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:native-library Automatic instrumentation native C++ code (Datadog.Trace.ClrProfiler.Native) type:refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants