-
Notifications
You must be signed in to change notification settings - Fork 145
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
[Tracing] Provide default implementation for OpenTelemetry.Context.Propagation.Propagators.DefaultTextMapPropagator [AIDM-504] #6544
[Tracing] Provide default implementation for OpenTelemetry.Context.Propagation.Propagators.DefaultTextMapPropagator [AIDM-504] #6544
Conversation
Snapshots difference summaryThe following differences have been observed in committed snapshots. It is meant to help the reviewer. 1 occurrences of : + custom.opentelemetry.defaulttextmappropagator.baggage: key=value,
|
Datadog ReportBranch report: ✅ 0 Failed, 239794 Passed, 1986 Skipped, 19h 4m 28.99s Total Time |
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:
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.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6544) - mean (69ms) : 65, 73
. : milestone, 69,
master - mean (69ms) : 65, 73
. : milestone, 69,
section CallTarget+Inlining+NGEN
This PR (6544) - mean (981ms) : 959, 1003
. : milestone, 981,
master - mean (985ms) : 956, 1015
. : milestone, 985,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6544) - mean (107ms) : 104, 110
. : milestone, 107,
master - mean (115ms) : 100, 129
. : milestone, 115,
section CallTarget+Inlining+NGEN
This PR (6544) - mean (679ms) : 666, 693
. : milestone, 679,
master - mean (682ms) : 669, 696
. : milestone, 682,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6544) - mean (91ms) : 89, 92
. : milestone, 91,
master - mean (92ms) : 90, 94
. : milestone, 92,
section CallTarget+Inlining+NGEN
This PR (6544) - mean (629ms) : 610, 648
. : milestone, 629,
master - mean (635ms) : 620, 650
. : milestone, 635,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6544) - mean (190ms) : 185, 195
. : milestone, 190,
master - mean (190ms) : 186, 194
. : milestone, 190,
section CallTarget+Inlining+NGEN
This PR (6544) - mean (1,091ms) : 1057, 1125
. : milestone, 1091,
master - mean (1,090ms) : 1061, 1119
. : milestone, 1090,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6544) - mean (275ms) : 270, 280
. : milestone, 275,
master - mean (274ms) : 270, 279
. : milestone, 274,
section CallTarget+Inlining+NGEN
This PR (6544) - mean (864ms) : 833, 896
. : milestone, 864,
master - mean (867ms) : 839, 894
. : milestone, 867,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6544) - mean (264ms) : 260, 267
. : milestone, 264,
master - mean (264ms) : 260, 269
. : milestone, 264,
section CallTarget+Inlining+NGEN
This PR (6544) - mean (837ms) : 810, 864
. : milestone, 837,
master - mean (850ms) : 818, 882
. : milestone, 850,
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think ForceDefaultIdFormat
should be removed as it seems to change the IDs of Hierarchical Activities to be W3C
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Benchmarks Report for tracer 🐌Benchmarks for #6544 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ More allocations
|
Benchmark | Base Allocated | Diff Allocated | Change | Change % |
---|---|---|---|---|
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 | 41.6 KB | 41.81 KB | 209 B | 0.50% |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | WriteAndFlushEnrichedTraces |
net6.0 | 571μs | 2.67μs | 10μs | 0.584 | 0 | 0 | 41.6 KB |
master | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 695μs | 3.86μs | 23.5μs | 0.353 | 0 | 0 | 41.76 KB |
master | WriteAndFlushEnrichedTraces |
net472 | 825μs | 2.97μs | 10.7μs | 8.5 | 2.55 | 0.425 | 53.27 KB |
#6544 | WriteAndFlushEnrichedTraces |
net6.0 | 606μs | 3.22μs | 16.1μs | 0.553 | 0 | 0 | 41.81 KB |
#6544 | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 683μs | 3.88μs | 27.7μs | 0.317 | 0 | 0 | 41.85 KB |
#6544 | WriteAndFlushEnrichedTraces |
net472 | 845μs | 3.54μs | 13.7μs | 8.28 | 2.48 | 0.414 | 53.29 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.32μs | 1ns | 3.87ns | 0.0147 | 0 | 0 | 1.02 KB |
master | ExecuteNonQuery |
netcoreapp3.1 | 1.77μs | 1.85ns | 6.92ns | 0.0133 | 0 | 0 | 1.02 KB |
master | ExecuteNonQuery |
net472 | 2.06μs | 3.08ns | 11.9ns | 0.156 | 0.00102 | 0 | 987 B |
#6544 | ExecuteNonQuery |
net6.0 | 1.21μs | 1.61ns | 6.04ns | 0.0141 | 0 | 0 | 1.02 KB |
#6544 | ExecuteNonQuery |
netcoreapp3.1 | 1.76μs | 1.45ns | 5.43ns | 0.0133 | 0 | 0 | 1.02 KB |
#6544 | ExecuteNonQuery |
net472 | 2.04μs | 2.76ns | 10.7ns | 0.156 | 0.00102 | 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.26μs | 1.05ns | 3.94ns | 0.0133 | 0 | 0 | 976 B |
master | CallElasticsearch |
netcoreapp3.1 | 1.57μs | 1.18ns | 4.58ns | 0.0132 | 0 | 0 | 976 B |
master | CallElasticsearch |
net472 | 2.64μs | 1.83ns | 7.08ns | 0.157 | 0 | 0 | 995 B |
master | CallElasticsearchAsync |
net6.0 | 1.28μs | 0.793ns | 2.97ns | 0.0133 | 0 | 0 | 952 B |
master | CallElasticsearchAsync |
netcoreapp3.1 | 1.59μs | 0.636ns | 2.38ns | 0.0135 | 0 | 0 | 1.02 KB |
master | CallElasticsearchAsync |
net472 | 2.65μs | 2.23ns | 8.62ns | 0.166 | 0 | 0 | 1.05 KB |
#6544 | CallElasticsearch |
net6.0 | 1.26μs | 0.38ns | 1.47ns | 0.0134 | 0 | 0 | 976 B |
#6544 | CallElasticsearch |
netcoreapp3.1 | 1.55μs | 1.43ns | 5.55ns | 0.0132 | 0 | 0 | 976 B |
#6544 | CallElasticsearch |
net472 | 2.57μs | 1.86ns | 6.97ns | 0.157 | 0 | 0 | 995 B |
#6544 | CallElasticsearchAsync |
net6.0 | 1.38μs | 0.768ns | 2.97ns | 0.013 | 0 | 0 | 952 B |
#6544 | CallElasticsearchAsync |
netcoreapp3.1 | 1.62μs | 1.77ns | 6.87ns | 0.0137 | 0 | 0 | 1.02 KB |
#6544 | CallElasticsearchAsync |
net472 | 2.74μs | 1.57ns | 6.1ns | 0.166 | 0 | 0 | 1.05 KB |
Benchmarks.Trace.GraphQLBenchmark - Slower ⚠️ Same allocations ✔️
Slower ⚠️ in #6544
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net6.0
1.174
1,229.89
1,443.54
Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net6.0 | 1.174 | 1,229.89 | 1,443.54 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | ExecuteAsync |
net6.0 | 1.23μs | 0.583ns | 2.18ns | 0.0132 | 0 | 0 | 952 B |
master | ExecuteAsync |
netcoreapp3.1 | 1.57μs | 2.12ns | 7.92ns | 0.0126 | 0 | 0 | 952 B |
master | ExecuteAsync |
net472 | 1.83μs | 0.494ns | 1.91ns | 0.145 | 0 | 0 | 915 B |
#6544 | ExecuteAsync |
net6.0 | 1.44μs | 0.778ns | 2.91ns | 0.013 | 0 | 0 | 952 B |
#6544 | ExecuteAsync |
netcoreapp3.1 | 1.6μs | 0.661ns | 2.38ns | 0.0127 | 0 | 0 | 952 B |
#6544 | ExecuteAsync |
net472 | 1.78μs | 0.436ns | 1.57ns | 0.144 | 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 | 4.4μs | 2.07ns | 7.76ns | 0.0325 | 0 | 0 | 2.31 KB |
master | SendAsync |
netcoreapp3.1 | 5.21μs | 1.27ns | 4.76ns | 0.039 | 0 | 0 | 2.85 KB |
master | SendAsync |
net472 | 7.35μs | 2.08ns | 8.06ns | 0.493 | 0 | 0 | 3.12 KB |
#6544 | SendAsync |
net6.0 | 4.32μs | 1.88ns | 7.29ns | 0.0326 | 0 | 0 | 2.31 KB |
#6544 | SendAsync |
netcoreapp3.1 | 5.19μs | 1.69ns | 6.1ns | 0.0391 | 0 | 0 | 2.85 KB |
#6544 | SendAsync |
net472 | 7.29μs | 1.94ns | 7.5ns | 0.493 | 0 | 0 | 3.12 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 | 1.5μs | 0.724ns | 2.8ns | 0.0233 | 0 | 0 | 1.64 KB |
master | EnrichedLog |
netcoreapp3.1 | 2.24μs | 5.12ns | 19.8ns | 0.022 | 0 | 0 | 1.64 KB |
master | EnrichedLog |
net472 | 2.63μs | 1.34ns | 5.19ns | 0.25 | 0 | 0 | 1.57 KB |
#6544 | EnrichedLog |
net6.0 | 1.44μs | 0.726ns | 2.81ns | 0.0231 | 0 | 0 | 1.64 KB |
#6544 | EnrichedLog |
netcoreapp3.1 | 2.28μs | 1.49ns | 5.78ns | 0.0212 | 0 | 0 | 1.64 KB |
#6544 | EnrichedLog |
net472 | 2.43μs | 1.4ns | 5.43ns | 0.249 | 0 | 0 | 1.57 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 | 117μs | 178ns | 689ns | 0.0579 | 0 | 0 | 4.28 KB |
master | EnrichedLog |
netcoreapp3.1 | 123μs | 186ns | 722ns | 0 | 0 | 0 | 4.28 KB |
master | EnrichedLog |
net472 | 150μs | 117ns | 452ns | 0.684 | 0.228 | 0 | 4.46 KB |
#6544 | EnrichedLog |
net6.0 | 115μs | 152ns | 590ns | 0.0572 | 0 | 0 | 4.28 KB |
#6544 | EnrichedLog |
netcoreapp3.1 | 119μs | 155ns | 579ns | 0 | 0 | 0 | 4.28 KB |
#6544 | EnrichedLog |
net472 | 150μs | 134ns | 521ns | 0.676 | 0.225 | 0 | 4.46 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 | 2.98μs | 0.65ns | 2.52ns | 0.0299 | 0 | 0 | 2.2 KB |
master | EnrichedLog |
netcoreapp3.1 | 4.33μs | 2.1ns | 8.15ns | 0.0281 | 0 | 0 | 2.2 KB |
master | EnrichedLog |
net472 | 4.88μs | 1.59ns | 6.17ns | 0.319 | 0 | 0 | 2.02 KB |
#6544 | EnrichedLog |
net6.0 | 2.95μs | 1.45ns | 5.6ns | 0.031 | 0 | 0 | 2.2 KB |
#6544 | EnrichedLog |
netcoreapp3.1 | 4.22μs | 0.896ns | 3.35ns | 0.0295 | 0 | 0 | 2.2 KB |
#6544 | EnrichedLog |
net472 | 5.1μs | 1.53ns | 5.92ns | 0.319 | 0 | 0 | 2.02 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.3μs | 0.604ns | 2.34ns | 0.0162 | 0 | 0 | 1.14 KB |
master | SendReceive |
netcoreapp3.1 | 1.78μs | 1.7ns | 6.38ns | 0.0154 | 0 | 0 | 1.14 KB |
master | SendReceive |
net472 | 2.11μs | 1.65ns | 6.4ns | 0.183 | 0 | 0 | 1.16 KB |
#6544 | SendReceive |
net6.0 | 1.31μs | 0.296ns | 1.02ns | 0.0159 | 0 | 0 | 1.14 KB |
#6544 | SendReceive |
netcoreapp3.1 | 1.77μs | 1.83ns | 7.1ns | 0.0152 | 0 | 0 | 1.14 KB |
#6544 | SendReceive |
net472 | 2.15μs | 1.66ns | 6.42ns | 0.183 | 0 | 0 | 1.16 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 | 2.82μs | 1.48ns | 5.72ns | 0.0225 | 0 | 0 | 1.6 KB |
master | EnrichedLog |
netcoreapp3.1 | 3.91μs | 2.99ns | 11.6ns | 0.0214 | 0 | 0 | 1.65 KB |
master | EnrichedLog |
net472 | 4.35μs | 2.51ns | 9.73ns | 0.322 | 0 | 0 | 2.04 KB |
#6544 | EnrichedLog |
net6.0 | 2.73μs | 0.926ns | 3.46ns | 0.0232 | 0 | 0 | 1.6 KB |
#6544 | EnrichedLog |
netcoreapp3.1 | 3.92μs | 1.17ns | 4.55ns | 0.0216 | 0 | 0 | 1.65 KB |
#6544 | EnrichedLog |
net472 | 4.39μs | 3.5ns | 13.6ns | 0.323 | 0 | 0 | 2.04 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 | 398ns | 0.155ns | 0.602ns | 0.00819 | 0 | 0 | 576 B |
master | StartFinishSpan |
netcoreapp3.1 | 615ns | 0.451ns | 1.75ns | 0.00767 | 0 | 0 | 576 B |
master | StartFinishSpan |
net472 | 700ns | 0.374ns | 1.4ns | 0.0917 | 0 | 0 | 578 B |
master | StartFinishScope |
net6.0 | 542ns | 0.325ns | 1.22ns | 0.00975 | 0 | 0 | 696 B |
master | StartFinishScope |
netcoreapp3.1 | 718ns | 0.412ns | 1.49ns | 0.00946 | 0 | 0 | 696 B |
master | StartFinishScope |
net472 | 884ns | 0.661ns | 2.56ns | 0.104 | 0 | 0 | 658 B |
#6544 | StartFinishSpan |
net6.0 | 411ns | 0.208ns | 0.778ns | 0.00804 | 0 | 0 | 576 B |
#6544 | StartFinishSpan |
netcoreapp3.1 | 621ns | 0.554ns | 2.15ns | 0.00774 | 0 | 0 | 576 B |
#6544 | StartFinishSpan |
net472 | 679ns | 0.499ns | 1.93ns | 0.0918 | 0 | 0 | 578 B |
#6544 | StartFinishScope |
net6.0 | 552ns | 0.548ns | 2.05ns | 0.00972 | 0 | 0 | 696 B |
#6544 | StartFinishScope |
netcoreapp3.1 | 719ns | 0.758ns | 2.94ns | 0.00941 | 0 | 0 | 696 B |
#6544 | StartFinishScope |
net472 | 835ns | 0.585ns | 2.26ns | 0.104 | 0 | 0 | 658 B |
Benchmarks.Trace.TraceAnnotationsBenchmark - Slower ⚠️ Same allocations ✔️
Slower ⚠️ in #6544
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net472
1.129
1,069.70
1,207.80
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑netcoreapp3.1
1.117
875.87
978.65
Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net472 | 1.129 | 1,069.70 | 1,207.80 | |
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑netcoreapp3.1 | 1.117 | 875.87 | 978.65 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | RunOnMethodBegin |
net6.0 | 667ns | 0.353ns | 1.32ns | 0.00969 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
netcoreapp3.1 | 876ns | 0.706ns | 2.74ns | 0.00922 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
net472 | 1.07μs | 0.659ns | 2.55ns | 0.104 | 0 | 0 | 658 B |
#6544 | RunOnMethodBegin |
net6.0 | 706ns | 0.783ns | 3.03ns | 0.00993 | 0 | 0 | 696 B |
#6544 | RunOnMethodBegin |
netcoreapp3.1 | 978ns | 0.665ns | 2.57ns | 0.0097 | 0 | 0 | 696 B |
#6544 | RunOnMethodBegin |
net472 | 1.21μs | 1.44ns | 5.59ns | 0.104 | 0 | 0 | 658 B |
…e initialized indepedently of the ActivityListener
Summary of changes
At instrumentation startup, if
OpenTelemetry.Api v1.0.0+
is present, replace theOpenTelemetry.Context.Propagation.Propagators.DefaultTextMapPropagator
implementation (defaults to aNoopTextMapPropagator
) with the following:Reason for change
There is a current feature gap when the user tries to use
OpenTelemetry.Context.Propagation.Propagators.DefaultTextMapPropagator
.If the user is using the OpenTelemetry SDK, the static property gets overwritten with a functioning implementation when the OpenTelemetry.Sdk type is loaded.
However, if the user removes the OpenTelemetry SDK from their application and relies on the Datadog .NET Tracer for implementing the OpenTelemetry Tracing API, the default propagator no longer gets a functional implementation. This change addresses that gap.
Implementation details
At instrumentation initialization, if the OpenTelemetry support is enabled (
DD_TRACE_OTEL_ENABLED=true
), use reflection to call into the staticOpenTelemetry.Context.Propagation.Propagators
class and overwrite theDefaultTextMapPropagator
property in the same way as the OpenTelemetry SDK would, with a propagator that propagates W3C Tracecontext and W3C Baggage.Test coverage
This PR adds to the snapshot testing of the
Samples.NetActivitySdk
application, asserting that the context propagation has a functioning implementation.Other details