[DSM] Generate MessagePack values at compile time#8220
[DSM] Generate MessagePack values at compile time#8220pierotibou wants to merge 2 commits intopierre/mpackfrom
Conversation
- Includes a new extension method to handle streams - DSM constants are pascalcalse, so mostly duplicated. The partial class is in the DSM folder as I thought it was better. But I can move it alongside the other one and add a line in codeowner. - TracerConstants is still left aside for now.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fbde32c25c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| public const string ProductMask = "ProductMask"; | ||
|
|
||
| [MessagePackField] | ||
| public const string ProcessTags = "ProcessTags"; |
There was a problem hiding this comment.
Disambiguate DSM ProcessTags field name
Defining a new [MessagePackField] constant named ProcessTags here collides with the existing Tags.ProcessTags field ("_dd.tags.process") used for span metadata. In the regenerated MessagePackConstants.g.cs, MessagePackConstants.ProcessTagsBytes is now bound to "ProcessTags", and SpanMessagePackFormatter still uses that constant when writing per-payload process tags, so spans that include process tags will be serialized with the wrong key and the agent/backend will not recognize them.
Useful? React with 👍 / 👎.
| public const string Current = "current"; | ||
|
|
||
| [MessagePackField] | ||
| public const string Origin = "origin"; |
There was a problem hiding this comment.
Disambiguate DSM Origin field name
Adding a DSM field named Origin conflicts with the existing Tags.Origin field ("_dd.origin") that span serialization relies on. The regenerated constants now map MessagePackConstants.OriginBytes to "origin" (DSM timestamp value) instead of "_dd.origin", but SpanMessagePackFormatter still writes span origin using MessagePackConstants.OriginBytes, so trace origin metadata is emitted under the wrong key whenever origin is set.
Useful? React with 👍 / 👎.
…to avoid overrides. Also fixes the 2 use cases that were existing with DSM
f2b3d7a to
663a7d2
Compare
BenchmarksBenchmark execution time: 2026-02-19 01:14:17 Comparing candidate commit 663a7d2 in PR branch Found 10 performance improvements and 23 performance regressions! Performance is the same for 149 metrics, 10 unstable metrics. scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472
scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net6.0
scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1
scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net6.0
scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net6.0
scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody netcoreapp3.1
scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs netcoreapp3.1
scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472
scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1
scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472
scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net6.0
scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472
scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch netcoreapp3.1
scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472
scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net6.0
scenario:Benchmarks.Trace.HttpClientBenchmark.SendAsync net472
scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net6.0
scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net6.0
scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark netcoreapp3.1
scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net6.0
scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1
scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog netcoreapp3.1
scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net6.0
scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore netcoreapp3.1
scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net472
scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net6.0
scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0
scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net6.0
|
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8220) 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 (8220) - mean (75ms) : 72, 77
master - mean (77ms) : 75, 79
section Bailout
This PR (8220) - mean (80ms) : 77, 83
master - mean (81ms) : 79, 83
section CallTarget+Inlining+NGEN
This PR (8220) - mean (1,089ms) : 1024, 1153
master - mean (1,098ms) : 1052, 1145
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 (8220) - mean (116ms) : 113, 119
master - mean (119ms) : 116, 122
section Bailout
This PR (8220) - mean (117ms) : 114, 120
master - mean (121ms) : 118, 123
section CallTarget+Inlining+NGEN
This PR (8220) - mean (769ms) : 701, 838
master - mean (772ms) : 716, 828
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8220) - mean (103ms) : 100, 106
master - mean (105ms) : 101, 110
section Bailout
This PR (8220) - mean (104ms) : 102, 106
master - mean (109ms) : 107, 112
section CallTarget+Inlining+NGEN
This PR (8220) - mean (768ms) : 732, 804
master - mean (764ms) : 689, 840
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8220) - mean (102ms) : 98, 105
master - mean (105ms) : 101, 109
section Bailout
This PR (8220) - mean (103ms) : 100, 105
master - mean (107ms) : 105, 109
section CallTarget+Inlining+NGEN
This PR (8220) - mean (665ms) : 631, 700
master - mean (686ms) : 661, 711
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 (8220) - mean (194ms) : 190, 198
master - mean (211ms) : 194, 228
section Bailout
This PR (8220) - mean (198ms) : 193, 203
master - mean (215ms) : 198, 233
section CallTarget+Inlining+NGEN
This PR (8220) - mean (1,234ms) : 1172, 1295
master - mean (1,224ms) : 1126, 1322
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 (8220) - mean (279ms) : 272, 285
master - mean (306ms) : 282, 329
section Bailout
This PR (8220) - mean (279ms) : 275, 282
master - mean (310ms) : 281, 340
section CallTarget+Inlining+NGEN
This PR (8220) - mean (928ms) : 868, 988
master - mean (987ms) : 919, 1055
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8220) - mean (271ms) : 266, 275
master - mean (304ms) : 271, 336
section Bailout
This PR (8220) - mean (270ms) : 268, 273
master - mean (310ms) : 268, 351
section CallTarget+Inlining+NGEN
This PR (8220) - mean (930ms) : 903, 958
master - mean (991ms) : 893, 1090
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8220) - mean (270ms) : 264, 276
master - mean (309ms) : 271, 347
section Bailout
This PR (8220) - mean (269ms) : 266, 272
master - mean (315ms) : 280, 350
section CallTarget+Inlining+NGEN
This PR (8220) - mean (927ms) : 883, 972
master - mean (971ms) : 863, 1080
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Summary of changes
Generate MessagePack values at compile time in
DataStreamsMessagePackFormatterReason for change
Consistency with
SpanMessagePackFormatterand micro optimization of startup time.Implementation details
Based on top of #8175
MessagePackFieldNamespartial, added the DSM values and located the file in the DSM folder. I thought it was better there for centralizing DSM calsses. But I can move it alongside the other one and add a line in codeowners.MessagePackBinaryto handle streamsTest coverage
Covered by current DSM tests and added one utest for the new extension method