[Tracer] Use peer.service as dddbs for DBM when available#4619
Conversation
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 (4619) - mean (70ms) : 64, 77
. : milestone, 70,
master - mean (71ms) : 61, 82
. : milestone, 71,
section CallTarget+Inlining+NGEN
This PR (4619) - mean (1,035ms) : 1008, 1062
. : milestone, 1035,
master - mean (1,040ms) : 1009, 1070
. : milestone, 1040,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (4619) - mean (106ms) : 101, 111
. : milestone, 106,
master - mean (105ms) : 102, 109
. : milestone, 105,
section CallTarget+Inlining+NGEN
This PR (4619) - mean (744ms) : 730, 759
. : milestone, 744,
master - mean (747ms) : 723, 772
. : milestone, 747,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (4619) - mean (90ms) : 84, 95
. : milestone, 90,
master - mean (90ms) : 86, 94
. : milestone, 90,
section CallTarget+Inlining+NGEN
This PR (4619) - mean (708ms) : 689, 727
. : milestone, 708,
master - mean (712ms) : 697, 727
. : milestone, 712,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (4619) - mean (184ms) : 177, 191
. : milestone, 184,
master - mean (185ms) : 179, 192
. : milestone, 185,
section CallTarget+Inlining+NGEN
This PR (4619) - mean (1,119ms) : 1090, 1149
. : milestone, 1119,
master - mean (1,116ms) : 1088, 1144
. : milestone, 1116,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (4619) - mean (266ms) : 252, 280
. : milestone, 266,
master - mean (265ms) : 254, 276
. : milestone, 265,
section CallTarget+Inlining+NGEN
This PR (4619) - mean (1,083ms) : 1045, 1120
. : milestone, 1083,
master - mean (1,069ms) : 1035, 1104
. : milestone, 1069,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (4619) - mean (262ms) : 253, 271
. : milestone, 262,
master - mean (256ms) : 245, 266
. : milestone, 256,
section CallTarget+Inlining+NGEN
This PR (4619) - mean (1,044ms) : 1016, 1073
. : milestone, 1044,
master - mean (1,027ms) : 990, 1064
. : milestone, 1027,
|
Datadog ReportBranch report: ❄️ New Flaky Tests (1)
|
Throughput/Crank Report:zap:Throughput results for AspNetCoreSimpleController comparing the following branches/commits: Cases where throughput results for the PR are worse than latest master (5% drop or greater), results are shown in red. Note that these results are based on a single point-in-time result for each branch. For full results, see one of the many, many dashboards! gantt
title Throughput Linux x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (4619) (11.725M) : 0, 11724559
master (11.411M) : 0, 11410575
benchmarks/2.38.0 (11.532M) : 0, 11531559
benchmarks/2.9.0 (11.702M) : 0, 11701871
section Automatic
This PR (4619) (8.230M) : 0, 8229787
master (8.029M) : 0, 8029231
benchmarks/2.38.0 (8.007M) : 0, 8006818
benchmarks/2.9.0 (8.520M) : 0, 8520094
section Trace stats
master (8.282M) : 0, 8281771
benchmarks/2.38.0 (8.303M) : 0, 8302876
section Manual
This PR (4619) (10.295M) : 0, 10294539
master (10.079M) : 0, 10078776
benchmarks/2.38.0 (10.141M) : 0, 10141358
section Manual + Automatic
This PR (4619) (7.842M) : 0, 7842169
master (7.468M) : 0, 7468491
benchmarks/2.38.0 (7.579M) : 0, 7579310
section Version Conflict
master (6.961M) : 0, 6960831
benchmarks/2.38.0 (7.066M) : 0, 7065978
gantt
title Throughput Linux arm64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (4619) (9.513M) : 0, 9512774
master (9.571M) : 0, 9571222
benchmarks/2.38.0 (9.703M) : 0, 9703171
benchmarks/2.9.0 (9.518M) : 0, 9517755
section Automatic
This PR (4619) (6.645M) : 0, 6644919
master (6.807M) : 0, 6806672
benchmarks/2.38.0 (6.646M) : 0, 6646287
section Trace stats
master (6.909M) : 0, 6908980
benchmarks/2.38.0 (6.925M) : 0, 6925272
section Manual
This PR (4619) (8.415M) : 0, 8414601
master (8.273M) : 0, 8273041
benchmarks/2.38.0 (8.478M) : 0, 8477667
section Manual + Automatic
This PR (4619) (6.380M) : 0, 6380270
master (6.317M) : 0, 6317446
benchmarks/2.38.0 (6.421M) : 0, 6421392
section Version Conflict
master (5.844M) : 0, 5844362
benchmarks/2.38.0 (5.868M) : 0, 5867854
gantt
title Throughput Windows x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (4619) (10.553M) : 0, 10552912
master (10.521M) : 0, 10520760
benchmarks/2.38.0 (10.451M) : 0, 10451481
benchmarks/2.9.0 (10.049M) : 0, 10049044
section Automatic
This PR (4619) (7.388M) : 0, 7387694
master (7.508M) : 0, 7507847
benchmarks/2.38.0 (7.619M) : 0, 7619144
benchmarks/2.9.0 (7.760M) : 0, 7759587
section Trace stats
master (7.832M) : 0, 7832385
benchmarks/2.38.0 (7.836M) : 0, 7835831
section Manual
This PR (4619) (9.092M) : 0, 9091536
master (9.406M) : 0, 9406090
benchmarks/2.38.0 (9.548M) : 0, 9548306
section Manual + Automatic
This PR (4619) (7.177M) : 0, 7176706
master (7.347M) : 0, 7346786
benchmarks/2.38.0 (7.321M) : 0, 7321222
section Version Conflict
master (6.660M) : 0, 6659668
benchmarks/2.38.0 (6.644M) : 0, 6643795
gantt
title Throughput Linux x64 (ASM) (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (4619) (7.226M) : 0, 7226271
master (7.517M) : 0, 7517420
benchmarks/2.38.0 (7.569M) : 0, 7569264
benchmarks/2.9.0 (7.723M) : 0, 7723267
section No attack
This PR (4619) (2.087M) : 0, 2087183
master (2.170M) : 0, 2169809
benchmarks/2.38.0 (2.144M) : 0, 2144152
benchmarks/2.9.0 (3.201M) : 0, 3200507
section Attack
This PR (4619) (1.665M) : 0, 1665249
master (1.745M) : 0, 1744808
benchmarks/2.38.0 (1.726M) : 0, 1726094
benchmarks/2.9.0 (2.537M) : 0, 2536997
section Blocking
This PR (4619) (3.299M) : 0, 3299132
master (3.404M) : 0, 3403710
benchmarks/2.38.0 (3.470M) : 0, 3469785
|
Benchmarks Report 🐌Benchmarks for #4619 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.Asm.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SpanBenchmark - Slower
|
| Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 | 1.175 | 401.00 | 471.30 |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StartFinishSpan |
net6.0 | 401ns | 0.372ns | 1.44ns | 0.00755 | 0 | 0 | 536 B |
| master | StartFinishSpan |
netcoreapp3.1 | 575ns | 0.137ns | 0.512ns | 0.00709 | 0 | 0 | 536 B |
| master | StartFinishSpan |
net472 | 647ns | 0.258ns | 1ns | 0.0854 | 0 | 0 | 538 B |
| master | StartFinishScope |
net6.0 | 521ns | 0.265ns | 0.993ns | 0.00917 | 0 | 0 | 656 B |
| master | StartFinishScope |
netcoreapp3.1 | 673ns | 0.593ns | 2.22ns | 0.00894 | 0 | 0 | 656 B |
| master | StartFinishScope |
net472 | 852ns | 0.646ns | 2.5ns | 0.098 | 0 | 0 | 618 B |
| #4619 | StartFinishSpan |
net6.0 | 471ns | 0.163ns | 0.609ns | 0.00745 | 0 | 0 | 536 B |
| #4619 | StartFinishSpan |
netcoreapp3.1 | 577ns | 0.257ns | 0.962ns | 0.00741 | 0 | 0 | 536 B |
| #4619 | StartFinishSpan |
net472 | 605ns | 0.522ns | 2.02ns | 0.0852 | 0 | 0 | 538 B |
| #4619 | StartFinishScope |
net6.0 | 543ns | 1.04ns | 3.75ns | 0.0093 | 0 | 0 | 656 B |
| #4619 | StartFinishScope |
netcoreapp3.1 | 718ns | 0.299ns | 1.16ns | 0.00894 | 0 | 0 | 656 B |
| #4619 | StartFinishScope |
net472 | 838ns | 0.229ns | 0.887ns | 0.098 | 0 | 0 | 618 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 | 616ns | 0.462ns | 1.79ns | 0.009 | 0 | 0 | 656 B |
| master | RunOnMethodBegin |
netcoreapp3.1 | 795ns | 0.278ns | 1.08ns | 0.00913 | 0 | 0 | 656 B |
| master | RunOnMethodBegin |
net472 | 919ns | 0.506ns | 1.96ns | 0.0982 | 0 | 0 | 618 B |
| #4619 | RunOnMethodBegin |
net6.0 | 653ns | 0.35ns | 1.36ns | 0.00919 | 0 | 0 | 656 B |
| #4619 | RunOnMethodBegin |
netcoreapp3.1 | 829ns | 0.33ns | 1.28ns | 0.00883 | 0 | 0 | 656 B |
| #4619 | RunOnMethodBegin |
net472 | 952ns | 0.191ns | 0.739ns | 0.098 | 0 | 0 | 618 B |
andrewlock
left a comment
There was a problem hiding this comment.
LGTM, just a couple of minor suggestions on testing
| { | ||
| var propagatorStringBuilder = StringBuilderCache.Acquire(StringBuilderCache.MaxBuilderSize); | ||
| propagatorStringBuilder.Append(DbmPrefix).Append(Uri.EscapeDataString(context.ServiceNameInternal)).Append('\''); | ||
| var dddbs = (span.Tags is SqlV1Tags sqlTags) ? sqlTags.PeerService : span.Context.ServiceNameInternal; |
There was a problem hiding this comment.
The fact that peer.service can be an override, the dbname or out.host is wanted I assume. But asking just in case.
There was a problem hiding this comment.
As read in the original doc
The correct value is whatever we would expose to the customer on the trace flamegraph and dependency map
Which is not a very technical term, but in this case means whatever is set in peer.service
## Summary of changes - add `ddprs` (peer service) to the comment injected by DBM, contains the peer service value only if set explicitely - revert the behavior introduced in #4619, as per spec, peer service is not supposed to override `dddbs`. ## Reason for change spec: https://docs.google.com/document/d/1Cg9RLydNzK1BTf3EFaEC4NlQtvAO-_rDdPLSO8HgDCs slack thread: https://dd.slack.com/archives/C02U25426A1/p1727254455343209 ## Implementation details By taking the value of `ServiceNameInternal` from the span, dddbs will have either the service name of the calling service or the name of the DB depending on how fake services are configured. The SQL tags V1 record if a peer service override was set https://github.com/DataDog/dd-trace-dotnet/blob/40c8f59154c71dcce502c740304b9ef281f5c355/tracer/src/Datadog.Trace/Tagging/SqlTags.cs#L57-L58 so I'm using that to know if I should use the `PeerService` value (because it always has a value, it falls back to the DB type or the outhost if peer service is not set). https://github.com/DataDog/dd-trace-dotnet/blob/40c8f59154c71dcce502c740304b9ef281f5c355/tracer/src/Datadog.Trace/Tagging/SqlTags.cs#L48 For V0, I'm relying on the fact that the old value is saved when peer service is set. Not sure if I could just always use peer service in that case ? https://github.com/DataDog/dd-trace-dotnet/blob/4bafc78fa25382fefb03fa4e052905ca371d1ffa/tracer/src/Datadog.Trace/Configuration/Schema/NamingSchema.cs#L64-L65 ## Test coverage ## Other details JIRA: AIT-10032 <!-- 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. -->
## Summary of changes - add `ddprs` (peer service) to the comment injected by DBM, contains the peer service value only if set explicitely - revert the behavior introduced in #4619, as per spec, peer service is not supposed to override `dddbs`. ## Reason for change spec: https://docs.google.com/document/d/1Cg9RLydNzK1BTf3EFaEC4NlQtvAO-_rDdPLSO8HgDCs slack thread: https://dd.slack.com/archives/C02U25426A1/p1727254455343209 ## Implementation details By taking the value of `ServiceNameInternal` from the span, dddbs will have either the service name of the calling service or the name of the DB depending on how fake services are configured. The SQL tags V1 record if a peer service override was set https://github.com/DataDog/dd-trace-dotnet/blob/40c8f59154c71dcce502c740304b9ef281f5c355/tracer/src/Datadog.Trace/Tagging/SqlTags.cs#L57-L58 so I'm using that to know if I should use the `PeerService` value (because it always has a value, it falls back to the DB type or the outhost if peer service is not set). https://github.com/DataDog/dd-trace-dotnet/blob/40c8f59154c71dcce502c740304b9ef281f5c355/tracer/src/Datadog.Trace/Tagging/SqlTags.cs#L48 For V0, I'm relying on the fact that the old value is saved when peer service is set. Not sure if I could just always use peer service in that case ? https://github.com/DataDog/dd-trace-dotnet/blob/4bafc78fa25382fefb03fa4e052905ca371d1ffa/tracer/src/Datadog.Trace/Configuration/Schema/NamingSchema.cs#L64-L65 ## Test coverage ## Other details JIRA: AIT-10032 <!-- 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. -->
Summary of changes
Prioritize
peer.serviceas dddbs for SQL comments when available.Reason for change
Explanation here.
Test coverage
Unit Test