Skip to content

Add ILogger.ErrorSkipTelemetry() to exclude certain logs from telemetry #7028

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 29, 2025

Conversation

andrewlock
Copy link
Member

Summary of changes

Add a new method ErrorSkipTelemetry to allow not sending an error log to telemetry.

Reason for change

By default, we send redacted, aggregated Error logs to telemetry, so that we can investigate and fix any issues. However, some errors we can't fix (e.g. they're a network/configuration issue), so we want to exclude some of those logs.

Today we generally do that in one of two ways

  • Downgrade the errors to warnings
  • Use string comparison to filter out some of the logs from sending to telemetry

The first of these is a bit hacky, as we may want to surface it as an error to customers/support. The second approach is not extensible, and generally a pain.

Implementation details

Add a new method ErrorSkipTelemetry to our standard ILogger. This behaves exactly like Error except that we filter these logs and don't send them to the telemetry sink.

To achieve this we:

  • Push a property onto LogContext.PushProperty, SkipTelemetry
  • Filter any logs with this property from sending to telemetry
  • Remove the property from the file logs (to avoid clutter)

I also

  • Added a new logging test, to make sure this didn't break anything
  • Update the LogAnalyzer to work with the new ErrorSkipTelemetry
  • Update existing usages where we want to skip telemetry
  • Added a couple more usages to fix this telemetry error
  • Minor update in WriteIfNotRateLimited to extract rarely called code, and to use collection expressions instead

Test coverage

Enough, hopefully 🤞

Other details

Other options I considered:

  • Ignoring the problem, and continuing to downgrade logs
  • Passing a skipTelemetry: true named parameter to the existing Error() method. This caused issues with the analyzer, is overall a bit confusing with the existing CallerMemeberFile etc args, and overall seemed more liable to cause errors than the explicit separate method
  • Using the currently used Fatal as meaning "send to telemetry". The downside is that it would require changing all our existing errors to use this + it would generally change the logs. It would prob be a little more efficient than using the LogContext but I don't think it's worth the confusion/change in behaviour

@andrewlock andrewlock requested review from a team as code owners May 29, 2025 10:57
@andrewlock andrewlock added type:enhancement Improvement to an existing feature area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) area:telemetry identified-by:telemetry labels May 29, 2025
@andrewlock andrewlock changed the title Andrew/exclude logs from telemetry Add ILogger.ErrorSkipTelemetry() to exclude certain logs from telemetry May 29, 2025
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.

Very nice thanks!

@pr-commenter
Copy link

pr-commenter bot commented May 29, 2025

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #7028 compared to master:

  • All benchmarks have the same speed
  • 3 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 ✔️ More allocations ⚠️

More allocations ⚠️ in #7028

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑netcoreapp3.1 5.65 KB 5.75 KB 99 B 1.75%

Fewer allocations 🎉 in #7028

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472 6.13 KB 6.05 KB -79 B -1.29%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 10.6μs 57.2ns 314ns 0 0 0 5.55 KB
master StartStopWithChild netcoreapp3.1 13.9μs 65ns 252ns 0 0 0 5.65 KB
master StartStopWithChild net472 22.2μs 124ns 784ns 0.98 0.436 0.109 6.13 KB
#7028 StartStopWithChild net6.0 10.1μs 56ns 345ns 0 0 0 5.56 KB
#7028 StartStopWithChild netcoreapp3.1 13.6μs 71.3ns 371ns 0 0 0 5.75 KB
#7028 StartStopWithChild net472 22.7μs 120ns 691ns 0.97 0.431 0.108 6.05 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 945μs 54.8ns 190ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.02ms 309ns 1.2μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.21ms 57ns 213ns 0 0 0 3.31 KB
#7028 WriteAndFlushEnrichedTraces net6.0 932μs 57.2ns 198ns 0 0 0 2.71 KB
#7028 WriteAndFlushEnrichedTraces netcoreapp3.1 1.01ms 62.5ns 225ns 0 0 0 2.7 KB
#7028 WriteAndFlushEnrichedTraces net472 1.22ms 384ns 1.49μs 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 335μs 560ns 2.17μs 0 0 0 197.06 KB
master AllCycleSimpleBody netcoreapp3.1 476μs 768ns 2.97μs 0 0 0 204.77 KB
master AllCycleSimpleBody net472 456μs 126ns 455ns 35.7 2.23 0 236.37 KB
master AllCycleMoreComplexBody net6.0 336μs 1.69μs 7.54μs 0 0 0 200.56 KB
master AllCycleMoreComplexBody netcoreapp3.1 482μs 1.8μs 6.96μs 0 0 0 208.18 KB
master AllCycleMoreComplexBody net472 448μs 151ns 564ns 37.9 2.23 0 239.88 KB
master ObjectExtractorSimpleBody net6.0 310ns 0.0693ns 0.25ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 390ns 2.1ns 11.7ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 305ns 0.0261ns 0.0977ns 0.0441 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.3μs 8.14ns 31.5ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.75μs 1.15ns 4.13ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.76μs 7.92ns 30.7ns 0.576 0 0 3.8 KB
#7028 AllCycleSimpleBody net6.0 328μs 1.54μs 5.95μs 0 0 0 197.06 KB
#7028 AllCycleSimpleBody netcoreapp3.1 490μs 1.46μs 5.64μs 0 0 0 204.77 KB
#7028 AllCycleSimpleBody net472 440μs 93.8ns 325ns 36.6 2.16 0 236.35 KB
#7028 AllCycleMoreComplexBody net6.0 334μs 1.72μs 8.08μs 0 0 0 200.56 KB
#7028 AllCycleMoreComplexBody netcoreapp3.1 529μs 2.37μs 9.19μs 0 0 0 208.18 KB
#7028 AllCycleMoreComplexBody net472 448μs 234ns 907ns 37.9 2.23 0 239.88 KB
#7028 ObjectExtractorSimpleBody net6.0 314ns 1.6ns 6.79ns 0 0 0 280 B
#7028 ObjectExtractorSimpleBody netcoreapp3.1 407ns 0.256ns 0.992ns 0 0 0 272 B
#7028 ObjectExtractorSimpleBody net472 303ns 0.0278ns 0.108ns 0.0444 0 0 281 B
#7028 ObjectExtractorMoreComplexBody net6.0 6.43μs 25.6ns 92.5ns 0 0 0 3.78 KB
#7028 ObjectExtractorMoreComplexBody netcoreapp3.1 7.88μs 24.4ns 91.2ns 0 0 0 3.69 KB
#7028 ObjectExtractorMoreComplexBody net472 6.69μs 2.35ns 9.1ns 0.602 0 0 3.8 KB
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Unknown 🤷 Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EncodeArgs net6.0 N/A N/A N/A NaN NaN NaN 0 b
master EncodeArgs netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
master EncodeArgs net472 N/A N/A N/A NaN NaN NaN 0 b
master EncodeLegacyArgs net6.0 N/A N/A N/A NaN NaN NaN 0 b
master EncodeLegacyArgs netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
master EncodeLegacyArgs net472 N/A N/A N/A NaN NaN NaN 0 b
#7028 EncodeArgs net6.0 N/A N/A N/A NaN NaN NaN 0 b
#7028 EncodeArgs netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
#7028 EncodeArgs net472 N/A N/A N/A NaN NaN NaN 0 b
#7028 EncodeLegacyArgs net6.0 N/A N/A N/A NaN NaN NaN 0 b
#7028 EncodeLegacyArgs netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
#7028 EncodeLegacyArgs net472 N/A N/A N/A NaN NaN NaN 0 b
Benchmarks.Trace.Asm.AppSecWafBenchmark - Unknown 🤷 Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 N/A N/A N/A NaN NaN NaN 0 b
master RunWafRealisticBenchmark netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
master RunWafRealisticBenchmark net472 N/A N/A N/A NaN NaN NaN 0 b
master RunWafRealisticBenchmarkWithAttack net6.0 N/A N/A N/A NaN NaN NaN 0 b
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
master RunWafRealisticBenchmarkWithAttack net472 N/A N/A N/A NaN NaN NaN 0 b
#7028 RunWafRealisticBenchmark net6.0 N/A N/A N/A NaN NaN NaN 0 b
#7028 RunWafRealisticBenchmark netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
#7028 RunWafRealisticBenchmark net472 N/A N/A N/A NaN NaN NaN 0 b
#7028 RunWafRealisticBenchmarkWithAttack net6.0 N/A N/A N/A NaN NaN NaN 0 b
#7028 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
#7028 RunWafRealisticBenchmarkWithAttack net472 N/A N/A N/A NaN NaN NaN 0 b
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 61.2μs 42.7ns 160ns 0 0 0 14.53 KB
master SendRequest netcoreapp3.1 70.6μs 117ns 407ns 0 0 0 17.42 KB
master SendRequest net472 0.0106ns 0.00294ns 0.0114ns 0 0 0 0 b
#7028 SendRequest net6.0 61.1μs 44.8ns 168ns 0 0 0 14.53 KB
#7028 SendRequest netcoreapp3.1 71μs 71.4ns 257ns 0 0 0 17.42 KB
#7028 SendRequest net472 0.000828ns 0.000451ns 0.00175ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7028

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 41.78 KB 42.58 KB 802 B 1.92%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 682μs 1.28μs 4.95μs 0 0 0 41.78 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 723μs 2.03μs 7.33μs 0 0 0 41.97 KB
master WriteAndFlushEnrichedTraces net472 912μs 2.38μs 9.21μs 4.46 0 0 55.98 KB
#7028 WriteAndFlushEnrichedTraces net6.0 734μs 4.15μs 29.4μs 0 0 0 42.58 KB
#7028 WriteAndFlushEnrichedTraces netcoreapp3.1 689μs 1.15μs 4.13μs 0 0 0 42.16 KB
#7028 WriteAndFlushEnrichedTraces net472 925μs 3.43μs 12.4μs 8.33 0 0 55.98 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 2.03μs 1.22ns 4.74ns 0 0 0 1.03 KB
master ExecuteNonQuery netcoreapp3.1 2.49μs 4.13ns 16ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.71μs 4.4ns 16.5ns 0.147 0.0133 0 995 B
#7028 ExecuteNonQuery net6.0 1.93μs 2.83ns 10.2ns 0 0 0 1.03 KB
#7028 ExecuteNonQuery netcoreapp3.1 2.46μs 5ns 19.4ns 0 0 0 1.02 KB
#7028 ExecuteNonQuery net472 2.63μs 3.35ns 13ns 0.156 0.013 0 995 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.77μs 8.25ns 34ns 0 0 0 1.04 KB
master CallElasticsearch netcoreapp3.1 2.27μs 9.29ns 36ns 0 0 0 1.04 KB
master CallElasticsearch net472 3.48μs 3.06ns 11.8ns 0.155 0 0 1.05 KB
master CallElasticsearchAsync net6.0 1.82μs 2.09ns 7.81ns 0 0 0 1.02 KB
master CallElasticsearchAsync netcoreapp3.1 2.38μs 3.9ns 15.1ns 0 0 0 1.09 KB
master CallElasticsearchAsync net472 3.62μs 3.69ns 14.3ns 0.162 0 0 1.11 KB
#7028 CallElasticsearch net6.0 1.75μs 2.47ns 9.58ns 0 0 0 1.04 KB
#7028 CallElasticsearch netcoreapp3.1 2.3μs 10.6ns 42.5ns 0 0 0 1.04 KB
#7028 CallElasticsearch net472 3.43μs 3.25ns 12.2ns 0.155 0 0 1.05 KB
#7028 CallElasticsearchAsync net6.0 1.92μs 6.73ns 26.1ns 0 0 0 1.02 KB
#7028 CallElasticsearchAsync netcoreapp3.1 2.39μs 8.89ns 34.4ns 0 0 0 1.09 KB
#7028 CallElasticsearchAsync net472 3.65μs 2.96ns 11.5ns 0.165 0 0 1.11 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.75μs 6.92ns 26.8ns 0 0 0 960 B
master ExecuteAsync netcoreapp3.1 2.43μs 4.44ns 17.2ns 0 0 0 960 B
master ExecuteAsync net472 2.5μs 2.92ns 11.3ns 0.138 0 0 923 B
#7028 ExecuteAsync net6.0 1.77μs 7.93ns 30.7ns 0 0 0 960 B
#7028 ExecuteAsync netcoreapp3.1 2.3μs 10.3ns 39.7ns 0 0 0 960 B
#7028 ExecuteAsync net472 2.48μs 0.849ns 3.29ns 0.136 0 0 923 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 12.6ns 48.6ns 0 0 0 2.37 KB
master SendAsync netcoreapp3.1 8.67μs 19.7ns 76.2ns 0 0 0 2.9 KB
master SendAsync net472 12.3μs 4.94ns 18.5ns 0.494 0 0 3.19 KB
#7028 SendAsync net6.0 7.22μs 15.8ns 61.2ns 0 0 0 2.37 KB
#7028 SendAsync netcoreapp3.1 8.58μs 5.85ns 22.6ns 0 0 0 2.9 KB
#7028 SendAsync net472 12μs 13.2ns 51.2ns 0.481 0 0 3.19 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7028

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 259.07 KB 275.14 KB 16.07 KB 6.20%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1 42.78 KB 44.19 KB 1.41 KB 3.29%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472 278.53 KB 286.72 KB 8.19 KB 2.94%

Fewer allocations 🎉 in #7028

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 44.34 KB 44.04 KB -296 B -0.67%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 277.86 KB 255.4 KB -22.46 KB -8.08%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 44.8μs 312ns 2.93μs 0 0 0 44.34 KB
master StringConcatBenchmark netcoreapp3.1 48.4μs 386ns 3.62μs 0 0 0 42.78 KB
master StringConcatBenchmark net472 57.5μs 255ns 988ns 0 0 0 57.34 KB
master StringConcatAspectBenchmark net6.0 477μs 878ns 3.04μs 0 0 0 259.07 KB
master StringConcatAspectBenchmark netcoreapp3.1 547μs 2.6μs 10.7μs 0 0 0 277.86 KB
master StringConcatAspectBenchmark net472 407μs 2.22μs 13.7μs 0 0 0 278.53 KB
#7028 StringConcatBenchmark net6.0 41.8μs 109ns 378ns 0 0 0 44.04 KB
#7028 StringConcatBenchmark netcoreapp3.1 48μs 225ns 1.62μs 0 0 0 44.19 KB
#7028 StringConcatBenchmark net472 58.1μs 162ns 626ns 0 0 0 57.34 KB
#7028 StringConcatAspectBenchmark net6.0 481μs 2.51μs 12.3μs 0 0 0 275.14 KB
#7028 StringConcatAspectBenchmark netcoreapp3.1 505μs 1.57μs 5.66μs 0 0 0 255.4 KB
#7028 StringConcatAspectBenchmark net472 406μs 1.98μs 7.93μs 0 0 0 286.72 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.57μs 10.3ns 39.8ns 0 0 0 1.76 KB
master EnrichedLog netcoreapp3.1 3.45μs 17ns 74.1ns 0 0 0 1.76 KB
master EnrichedLog net472 3.91μs 1.87ns 7.26ns 0.255 0 0 1.69 KB
#7028 EnrichedLog net6.0 2.57μs 12.2ns 50.2ns 0 0 0 1.76 KB
#7028 EnrichedLog netcoreapp3.1 3.45μs 8.63ns 33.4ns 0 0 0 1.76 KB
#7028 EnrichedLog net472 4.03μs 4.63ns 17.9ns 0.261 0 0 1.69 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 123μs 48.9ns 176ns 0 0 0 4.37 KB
master EnrichedLog netcoreapp3.1 128μs 229ns 827ns 0 0 0 4.37 KB
master EnrichedLog net472 167μs 41.5ns 155ns 0 0 0 4.57 KB
#7028 EnrichedLog net6.0 125μs 328ns 1.27μs 0 0 0 4.37 KB
#7028 EnrichedLog netcoreapp3.1 130μs 535ns 2μs 0 0 0 4.37 KB
#7028 EnrichedLog net472 172μs 711ns 2.75μs 0 0 0 4.57 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 5.15μs 13ns 50.3ns 0 0 0 2.32 KB
master EnrichedLog netcoreapp3.1 6.4μs 22.4ns 86.8ns 0 0 0 2.32 KB
master EnrichedLog net472 7.46μs 6.79ns 26.3ns 0.337 0 0 2.14 KB
#7028 EnrichedLog net6.0 5μs 4.42ns 15.9ns 0 0 0 2.32 KB
#7028 EnrichedLog netcoreapp3.1 6.66μs 18.7ns 72.6ns 0 0 0 2.32 KB
#7028 EnrichedLog net472 7.28μs 9.01ns 34.9ns 0.329 0 0 2.14 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.98μs 10.1ns 49.7ns 0 0 0 1.21 KB
master SendReceive netcoreapp3.1 2.57μs 9.19ns 35.6ns 0 0 0 1.21 KB
master SendReceive net472 3.06μs 3.31ns 12.8ns 0.183 0 0 1.21 KB
#7028 SendReceive net6.0 1.93μs 9.12ns 40.8ns 0 0 0 1.21 KB
#7028 SendReceive netcoreapp3.1 2.47μs 11.4ns 44.1ns 0 0 0 1.21 KB
#7028 SendReceive net472 3.08μs 6.85ns 26.5ns 0.184 0 0 1.21 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.37μs 7.63ns 28.5ns 0 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 5.62μs 15.1ns 58.5ns 0 0 0 1.69 KB
master EnrichedLog net472 6.48μs 4.01ns 15.5ns 0.323 0 0 2.08 KB
#7028 EnrichedLog net6.0 4.18μs 9.72ns 37.7ns 0 0 0 1.64 KB
#7028 EnrichedLog netcoreapp3.1 5.47μs 4.57ns 17.7ns 0 0 0 1.69 KB
#7028 EnrichedLog net472 6.6μs 5.14ns 18.5ns 0.33 0 0 2.08 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 757ns 0.25ns 0.967ns 0 0 0 584 B
master StartFinishSpan netcoreapp3.1 957ns 4.84ns 22.2ns 0 0 0 584 B
master StartFinishSpan net472 919ns 0.784ns 3.04ns 0.0927 0 0 586 B
master StartFinishScope net6.0 890ns 4.81ns 25.9ns 0 0 0 704 B
master StartFinishScope netcoreapp3.1 1.12μs 5.99ns 33.3ns 0 0 0 704 B
master StartFinishScope net472 1.14μs 1.06ns 4.12ns 0.102 0 0 666 B
#7028 StartFinishSpan net6.0 763ns 3.78ns 16.9ns 0 0 0 584 B
#7028 StartFinishSpan netcoreapp3.1 954ns 5.19ns 28.9ns 0 0 0 584 B
#7028 StartFinishSpan net472 928ns 0.338ns 1.27ns 0.0888 0 0 586 B
#7028 StartFinishScope net6.0 948ns 4.52ns 19.2ns 0 0 0 704 B
#7028 StartFinishScope netcoreapp3.1 1.15μs 5.45ns 21.8ns 0 0 0 704 B
#7028 StartFinishScope net472 1.1μs 1.77ns 6.87ns 0.106 0 0 666 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.02μs 4.83ns 19.3ns 0 0 0 704 B
master RunOnMethodBegin netcoreapp3.1 1.35μs 6.37ns 24.7ns 0 0 0 704 B
master RunOnMethodBegin net472 1.36μs 0.699ns 2.71ns 0.102 0 0 666 B
#7028 RunOnMethodBegin net6.0 1.05μs 4.24ns 16.4ns 0 0 0 704 B
#7028 RunOnMethodBegin netcoreapp3.1 1.42μs 4.43ns 16.6ns 0 0 0 704 B
#7028 RunOnMethodBegin net472 1.35μs 0.307ns 1.19ns 0.102 0 0 666 B

@andrewlock
Copy link
Member Author

andrewlock commented May 29, 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 Baseline
    This PR (7028) - mean (68ms)  : 66, 70
     .   : milestone, 68,
    master - mean (68ms)  : 65, 71
     .   : milestone, 68,

    section CallTarget+Inlining+NGEN
    This PR (7028) - mean (1,006ms)  : 982, 1030
     .   : milestone, 1006,
    master - mean (1,011ms)  : 981, 1040
     .   : milestone, 1011,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (7028) - mean (102ms)  : 100, 105
     .   : milestone, 102,
    master - mean (102ms)  : 100, 104
     .   : milestone, 102,

    section CallTarget+Inlining+NGEN
    This PR (7028) - mean (691ms)  : 670, 712
     .   : milestone, 691,
    master - mean (697ms)  : 675, 719
     .   : milestone, 697,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (7028) - mean (89ms)  : 88, 91
     .   : milestone, 89,
    master - mean (90ms)  : 87, 92
     .   : milestone, 90,

    section CallTarget+Inlining+NGEN
    This PR (7028) - mean (649ms)  : 626, 671
     .   : milestone, 649,
    master - mean (659ms)  : 643, 675
     .   : milestone, 659,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (7028) - mean (190ms)  : 186, 193
     .   : milestone, 190,
    master - mean (189ms)  : 186, 193
     .   : milestone, 189,

    section CallTarget+Inlining+NGEN
    This PR (7028) - mean (1,114ms)  : 1086, 1141
     .   : milestone, 1114,
    master - mean (1,112ms)  : 1087, 1138
     .   : milestone, 1112,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (7028) - mean (269ms)  : 265, 273
     .   : milestone, 269,
    master - mean (268ms)  : 264, 272
     .   : milestone, 268,

    section CallTarget+Inlining+NGEN
    This PR (7028) - mean (876ms)  : 850, 903
     .   : milestone, 876,
    master - mean (876ms)  : 853, 898
     .   : milestone, 876,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (7028) - mean (262ms)  : 259, 265
     .   : milestone, 262,
    master - mean (262ms)  : 258, 266
     .   : milestone, 262,

    section CallTarget+Inlining+NGEN
    This PR (7028) - mean (869ms)  : 836, 901
     .   : milestone, 869,
    master - mean (871ms)  : 841, 901
     .   : milestone, 871,

Loading

@andrewlock andrewlock force-pushed the andrew/exclude-logs-from-telemetry branch from e97c799 to eb52cbd Compare May 29, 2025 11:48
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented May 29, 2025

Datadog Report

All test runs eb52cbd 🔗

2 Total Test Services: 0 Failed, 2 Passed

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Test Service View
dd-trace-dotnet 0 0 0 251355 2328 18h 3m 20.57s Link
exploration_tests 0 0 0 22085 3 2m 17.14s Link

Copy link
Contributor

@NachoEchevarria NachoEchevarria left a comment

Choose a reason for hiding this comment

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

Cool!

@andrewlock andrewlock merged commit 1e02521 into master May 29, 2025
130 checks passed
@andrewlock andrewlock deleted the andrew/exclude-logs-from-telemetry branch May 29, 2025 15:49
@github-actions github-actions bot added this to the vNext-v3 milestone May 29, 2025
bouwkast added a commit that referenced this pull request Jun 5, 2025
…r config (#7049)

## Summary of changes

This changes the primary file logging configuration to be a sub logging
configuration.

## Reason for change

We added `ErrorSkipTelemetry` in
#7028, but it doesn't
seem to work.
From what I can tell the `Enrich.With(new
RemovePropertyEnricher(LogEventLevel.Error,
DatadogSerilogLogger.SkipTelemetryProperty))` was added to the main
logging configuration and it would hit first and then remove the skip
telemetry property, so now it is it's own sub-logging configuration to
try to not do that.

## Implementation details

Copied the redacted error logging

## Test coverage

Changed previous test to be called "WithoutFile" and added a new one
with a file. The new one fails without the change indicating that the
property is infact removed, and passes with the change.

~~They still pass so I think that is both good and bad as it means we
aren't testing the interaction between the two logging configurations,
but I don't really know how important this is.~~

## Other details

I don't know if this is the right move
<!-- Fixes #{issue} -->

<!-- ⚠️ Note: where possible, please obtain 2 approvals prior to
merging. Unless CODEOWNERS specifies otherwise, for external teams it is
typically best to have one review from a team member, and one review
from apm-dotnet. Trivial changes do not require 2 reviews. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:telemetry area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) identified-by:telemetry type:enhancement Improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants