Add srv_src field to client stats payload#8339
Add srv_src field to client stats payload#8339NachoEchevarria wants to merge 29 commits intomasterfrom
Conversation
BenchmarksBenchmark execution time: 2026-03-20 11:48:24 Comparing candidate commit d6e12c2 in PR branch Found 3 performance improvements and 5 performance regressions! Performance is the same for 257 metrics, 23 unstable metrics.
|
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8339) and master. ✅ No regressions detected - check the details below Full Metrics ComparisonFakeDbCommand
HttpMessageHandler
Comparison explanationExecution-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 highlighted 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). Duration chartsFakeDbCommand (.NET Framework 4.8)gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8339) - mean (69ms) : 67, 71
master - mean (70ms) : 66, 73
section Bailout
This PR (8339) - mean (73ms) : 71, 74
master - mean (73ms) : 72, 74
section CallTarget+Inlining+NGEN
This PR (8339) - mean (1,048ms) : 1003, 1093
master - mean (1,051ms) : 995, 1106
FakeDbCommand (.NET Core 3.1)gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8339) - mean (107ms) : 104, 111
master - mean (107ms) : 104, 111
section Bailout
This PR (8339) - mean (108ms) : 106, 110
master - mean (109ms) : 107, 110
section CallTarget+Inlining+NGEN
This PR (8339) - mean (727ms) : 707, 748
master - mean (730ms) : 711, 750
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8339) - mean (95ms) : 93, 98
master - mean (96ms) : 93, 99
section Bailout
This PR (8339) - mean (97ms) : 95, 98
master - mean (96ms) : 94, 98
section CallTarget+Inlining+NGEN
This PR (8339) - mean (704ms) : 659, 749
master - mean (709ms) : 668, 751
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8339) - mean (94ms) : 92, 97
master - mean (94ms) : 92, 97
section Bailout
This PR (8339) - mean (95ms) : 93, 97
master - mean (95ms) : 93, 97
section CallTarget+Inlining+NGEN
This PR (8339) - mean (639ms) : 607, 671
master - mean (641ms) : 615, 667
HttpMessageHandler (.NET Framework 4.8)gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8339) - mean (193ms) : 188, 198
master - mean (196ms) : 191, 201
section Bailout
This PR (8339) - mean (199ms) : 195, 203
master - mean (198ms) : 194, 201
section CallTarget+Inlining+NGEN
This PR (8339) - mean (1,160ms) : 1095, 1225
master - mean (1,148ms) : 1097, 1199
HttpMessageHandler (.NET Core 3.1)gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8339) - mean (277ms) : 272, 282
master - mean (277ms) : 273, 282
section Bailout
This PR (8339) - mean (279ms) : 273, 286
master - mean (279ms) : 274, 284
section CallTarget+Inlining+NGEN
This PR (8339) - mean (900ms) : 868, 931
master - mean (903ms) : 876, 929
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8339) - mean (271ms) : 266, 277
master - mean (272ms) : 266, 277
section Bailout
This PR (8339) - mean (271ms) : 267, 274
master - mean (271ms) : 267, 275
section CallTarget+Inlining+NGEN
This PR (8339) - mean (939ms) : 913, 964
master - mean (936ms) : 909, 963
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8339) - mean (271ms) : 262, 280
master - mean (271ms) : 263, 278
section Bailout
This PR (8339) - mean (270ms) : 266, 273
master - mean (271ms) : 266, 275
section CallTarget+Inlining+NGEN
This PR (8339) - mean (836ms) : 813, 859
master - mean (835ms) : 814, 855
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
andrewlock
left a comment
There was a problem hiding this comment.
As discussed, we're missing a lot from the spec, but hey 🤷♂️
|
|
||
| if (hasServiceSource) | ||
| { | ||
| MessagePackBinary.WriteString(stream, "srv_src"); |
There was a problem hiding this comment.
Based on the stats computation spec, I think this should be service_source, but given that none of our keys match here, I don't know what's correct 😅
| MessagePackBinary.WriteString(stream, "srv_src"); | |
| MessagePackBinary.WriteString(stream, "service_source"); |
There was a problem hiding this comment.
We should wait for clarification. Thanks for finding that!
| [Key("TopLevelHits")] | ||
| public long TopLevelHits { get; set; } | ||
|
|
||
| [Key("srv_src")] |
There was a problem hiding this comment.
| [Key("srv_src")] | |
| [Key("service_source")] |
Summary of changes
Add
srv_srcfield to the client stats payload, propagating the service name source alongside trace stats.Reason for change
Per the service name source RFC, the source must be propagated in both trace and stats payloads. The trace payload (
_dd.svc_srcspan meta) was added in PR #8302. This completes the implementation by addingsrv_srcat the stats bucket level.Implementation details
StatsAggregationKey.cs: AddedServiceSourcefield. It participates in equality and hash code, so stats with different sources aggregate into distinct buckets.StatsAggregator.cs:BuildKey()now readsspan.Context.ServiceNameSourceand passes it to the aggregation key.StatsBuffer.cs:SerializeBucket()conditionally serializessrv_srcwhenServiceSourceis non-null (dynamic map size: 13 with source, 12 without).Test coverage
KeyEquality_WithServiceSource: Verifies that keys with different sources are not equal.Serialization_WithServiceSource: Verifiessrv_srcis serialized when present and absent when null.StatsBufferTestsandStatsAggregatorTestsupdated and passing.Other details
APMLP-1015
Related agent PR: DataDog/datadog-agent#45982
Reference Java implementation: DataDog/dd-trace-java#10653