Conversation
This comment has been minimized.
This comment has been minimized.
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (7645) 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 (7645) - mean (76ms) : 68, 84
master - mean (80ms) : 71, 88
section Bailout
This PR (7645) - mean (82ms) : 70, 95
master - mean (93ms) : 82, 104
section CallTarget+Inlining+NGEN
This PR (7645) - mean (1,119ms) : 1015, 1222
master - mean (1,196ms) : 1078, 1313
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 (7645) - mean (111ms) : 107, 115
master - mean (126ms) : 114, 138
section Bailout
This PR (7645) - mean (112ms) : 109, 114
master - mean (130ms) : 119, 141
section CallTarget+Inlining+NGEN
This PR (7645) - mean (783ms) : 718, 848
master - mean (855ms) : 787, 923
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7645) - mean (103ms) : 91, 115
master - mean (107ms) : 100, 113
section Bailout
This PR (7645) - mean (99ms) : 97, 101
master - mean (109ms) : 99, 119
section CallTarget+Inlining+NGEN
This PR (7645) - mean (748ms) : 688, 808
master - mean (779ms) : 733, 825
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7645) - mean (102ms) : 91, 113
master - mean (107ms) : 98, 116
section Bailout
This PR (7645) - mean (103ms) : 94, 111
master - mean (110ms) : 98, 123
section CallTarget+Inlining+NGEN
This PR (7645) - mean (704ms) : 668, 739
master - mean (760ms) : 710, 810
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 (7645) - mean (196ms) : 188, 205
master - mean (194ms) : 189, 200
section Bailout
This PR (7645) - mean (202ms) : 191, 212
master - mean (196ms) : 193, 199
section CallTarget+Inlining+NGEN
This PR (7645) - mean (1,183ms) : 1118, 1249
master - mean (1,176ms) : 1099, 1252
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 (7645) - mean (283ms) : 272, 294
master - mean (276ms) : 271, 281
section Bailout
This PR (7645) - mean (284ms) : 274, 293
master - mean (277ms) : 272, 282
section CallTarget+Inlining+NGEN
This PR (7645) - mean (965ms) : 921, 1009
master - mean (948ms) : 908, 988
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7645) - mean (273ms) : 265, 282
master - mean (269ms) : 264, 275
section Bailout
This PR (7645) - mean (272ms) : 267, 277
master - mean (269ms) : 265, 272
section CallTarget+Inlining+NGEN
This PR (7645) - mean (929ms) : 877, 981
master - mean (927ms) : 882, 973
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7645) - mean (269ms) : 263, 275
master - mean (269ms) : 264, 273
section Bailout
This PR (7645) - mean (269ms) : 265, 273
master - mean (269ms) : 265, 273
section CallTarget+Inlining+NGEN
This PR (7645) - mean (854ms) : 833, 875
master - mean (860ms) : 842, 878
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var serializedData = SerializeTelemetry(data); | ||
| var bytes = Encoding.UTF8.GetBytes(serializedData); | ||
|
|
||
| var request = _requestFactory.Create(_endpoint); | ||
|
|
||
| if (_telemetryGzipCompressionEnabled) | ||
| { | ||
| bytes = CompressGzip(bytes); | ||
| } | ||
|
|
There was a problem hiding this comment.
It's unfortunate that we do so much allocation here 🤔 We serialize the data to a string, then convert it to a byte array and then gzip it again. I think we can avoid at least some of this allocation by moving the gzip compression into SerializeTelemetry() e.g. something like this:
internal static byte[] SerializeTelemetryWithGzip<T>(T data)
{
using var memStream = new MemoryStream();
using (var zipStream = new GZipStream(memStream, CompressionMode.Compress, true))
{
using var streamWriter = new StreamWriter(zipStream);
using var jsonWriter = new JsonTextWriter(streamWriter);
var serializer = new JsonSerializer { NullValueHandling = NullValueHandling.Ignore, ContractResolver = new DefaultContractResolver { NamingStrategy = new SnakeCaseNamingStrategy(), }, Formatting = Formatting.None };
serializer.Serialize(jsonWriter, data);
}
return memStream.ToArray();
}However, I think there's another option, in that we could potentially do "chunked" uploads, like we do for the tracer flare. That would mean we don't have to do any up-front allocation, which should reduce overhead even further 🤔
There was a problem hiding this comment.
I have implemented your solution. Thanks!
…ataDog/dd-trace-dotnet into nacho/compressTelemetryPayload
BenchmarksBenchmarks Report for benchmark platform 🐌Benchmarks for #7645 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 ✔️ More allocations
|
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472 | 6 KB | 6.03 KB | 35 B | 0.58% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StartStopWithChild |
net6.0 | 10.9μs | 55.8ns | 262ns | 0 | 0 | 0 | 5.52 KB |
| master | StartStopWithChild |
netcoreapp3.1 | 13.6μs | 70.2ns | 337ns | 0 | 0 | 0 | 5.73 KB |
| master | StartStopWithChild |
net472 | 21.8μs | 122ns | 819ns | 0.858 | 0.322 | 0 | 6 KB |
| #7645 | StartStopWithChild |
net6.0 | 10.4μs | 57.8ns | 356ns | 0 | 0 | 0 | 5.51 KB |
| #7645 | StartStopWithChild |
netcoreapp3.1 | 13.6μs | 64.5ns | 250ns | 0 | 0 | 0 | 5.72 KB |
| #7645 | StartStopWithChild |
net472 | 22.6μs | 126ns | 837ns | 1.02 | 0.306 | 0.102 | 6.03 KB |
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Fewer allocations 🎉
Fewer allocations 🎉 in #7645
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces‑net472
3.35 KB
3.31 KB
-46 B
-1.37%
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 | 3.35 KB | 3.31 KB | -46 B | -1.37% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | WriteAndFlushEnrichedTraces |
net6.0 | 935μs | 153ns | 574ns | 0 | 0 | 0 | 2.71 KB |
| master | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 1.01ms | 58.6ns | 203ns | 0 | 0 | 0 | 2.7 KB |
| master | WriteAndFlushEnrichedTraces |
net472 | 1.2ms | 54.1ns | 195ns | 0 | 0 | 0 | 3.35 KB |
| #7645 | WriteAndFlushEnrichedTraces |
net6.0 | 926μs | 109ns | 407ns | 0 | 0 | 0 | 2.71 KB |
| #7645 | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 1.02ms | 129ns | 482ns | 0 | 0 | 0 | 2.7 KB |
| #7645 | WriteAndFlushEnrichedTraces |
net472 | 1.21ms | 113ns | 424ns | 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 | 1.1μs | 6.12ns | 38.7ns | 0 | 0 | 0 | 1.22 KB |
| master | AllCycleSimpleBody |
netcoreapp3.1 | 1.41μs | 7.33ns | 35.1ns | 0 | 0 | 0 | 1.2 KB |
| master | AllCycleSimpleBody |
net472 | 1.03μs | 0.499ns | 1.87ns | 0.191 | 0 | 0 | 1.23 KB |
| master | AllCycleMoreComplexBody |
net6.0 | 7.11μs | 35.4ns | 162ns | 0 | 0 | 0 | 4.72 KB |
| master | AllCycleMoreComplexBody |
netcoreapp3.1 | 8.87μs | 41.3ns | 170ns | 0 | 0 | 0 | 4.62 KB |
| master | AllCycleMoreComplexBody |
net472 | 7.58μs | 4.19ns | 15.7ns | 0.72 | 0 | 0 | 4.74 KB |
| master | ObjectExtractorSimpleBody |
net6.0 | 317ns | 1.78ns | 11.3ns | 0 | 0 | 0 | 280 B |
| master | ObjectExtractorSimpleBody |
netcoreapp3.1 | 403ns | 2.07ns | 9.93ns | 0 | 0 | 0 | 272 B |
| master | ObjectExtractorSimpleBody |
net472 | 301ns | 0.0836ns | 0.324ns | 0.0433 | 0 | 0 | 281 B |
| master | ObjectExtractorMoreComplexBody |
net6.0 | 6.23μs | 31.6ns | 145ns | 0 | 0 | 0 | 3.78 KB |
| master | ObjectExtractorMoreComplexBody |
netcoreapp3.1 | 7.83μs | 39ns | 161ns | 0 | 0 | 0 | 3.69 KB |
| master | ObjectExtractorMoreComplexBody |
net472 | 6.67μs | 1.69ns | 6.53ns | 0.571 | 0 | 0 | 3.8 KB |
| #7645 | AllCycleSimpleBody |
net6.0 | 1.08μs | 5.86ns | 33.2ns | 0 | 0 | 0 | 1.22 KB |
| #7645 | AllCycleSimpleBody |
netcoreapp3.1 | 1.5μs | 7.25ns | 30.7ns | 0 | 0 | 0 | 1.2 KB |
| #7645 | AllCycleSimpleBody |
net472 | 1.07μs | 5.5ns | 25.8ns | 0.195 | 0 | 0 | 1.23 KB |
| #7645 | AllCycleMoreComplexBody |
net6.0 | 7.04μs | 33.6ns | 134ns | 0 | 0 | 0 | 4.72 KB |
| #7645 | AllCycleMoreComplexBody |
netcoreapp3.1 | 9.02μs | 38.8ns | 150ns | 0 | 0 | 0 | 4.62 KB |
| #7645 | AllCycleMoreComplexBody |
net472 | 7.57μs | 3.42ns | 13.2ns | 0.72 | 0 | 0 | 4.74 KB |
| #7645 | ObjectExtractorSimpleBody |
net6.0 | 325ns | 0.179ns | 0.695ns | 0 | 0 | 0 | 280 B |
| #7645 | ObjectExtractorSimpleBody |
netcoreapp3.1 | 403ns | 2.19ns | 11.8ns | 0 | 0 | 0 | 272 B |
| #7645 | ObjectExtractorSimpleBody |
net472 | 305ns | 0.0318ns | 0.123ns | 0.0445 | 0 | 0 | 281 B |
| #7645 | ObjectExtractorMoreComplexBody |
net6.0 | 6.26μs | 28.7ns | 131ns | 0 | 0 | 0 | 3.78 KB |
| #7645 | ObjectExtractorMoreComplexBody |
netcoreapp3.1 | 7.91μs | 36.5ns | 141ns | 0 | 0 | 0 | 3.69 KB |
| #7645 | ObjectExtractorMoreComplexBody |
net472 | 6.72μs | 10.3ns | 40ns | 0.572 | 0 | 0 | 3.8 KB |
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EncodeArgs |
net6.0 | 77.3μs | 229ns | 887ns | 0 | 0 | 0 | 32.4 KB |
| master | EncodeArgs |
netcoreapp3.1 | 96.5μs | 302ns | 1.13μs | 0 | 0 | 0 | 32.4 KB |
| master | EncodeArgs |
net472 | 110μs | 13.3ns | 51.4ns | 4.95 | 0 | 0 | 32.51 KB |
| master | EncodeLegacyArgs |
net6.0 | 145μs | 26.9ns | 101ns | 0 | 0 | 0 | 2.15 KB |
| master | EncodeLegacyArgs |
netcoreapp3.1 | 199μs | 140ns | 541ns | 0 | 0 | 0 | 2.14 KB |
| master | EncodeLegacyArgs |
net472 | 263μs | 276ns | 1.07μs | 0 | 0 | 0 | 2.16 KB |
| #7645 | EncodeArgs |
net6.0 | 77.5μs | 208ns | 807ns | 0 | 0 | 0 | 32.4 KB |
| #7645 | EncodeArgs |
netcoreapp3.1 | 96.7μs | 172ns | 668ns | 0 | 0 | 0 | 32.4 KB |
| #7645 | EncodeArgs |
net472 | 110μs | 19.6ns | 70.8ns | 4.99 | 0 | 0 | 32.51 KB |
| #7645 | EncodeLegacyArgs |
net6.0 | 144μs | 50.1ns | 187ns | 0 | 0 | 0 | 2.15 KB |
| #7645 | EncodeLegacyArgs |
netcoreapp3.1 | 202μs | 335ns | 1.3μs | 0 | 0 | 0 | 2.15 KB |
| #7645 | EncodeLegacyArgs |
net472 | 262μs | 119ns | 461ns | 0 | 0 | 0 | 2.16 KB |
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ More allocations ⚠️
More allocations ⚠️ in #7645
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑net472
2.29 KB
2.3 KB
19 B
0.83%
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑net472 | 2.29 KB | 2.3 KB | 19 B | 0.83% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | RunWafRealisticBenchmark |
net6.0 | 391μs | 153ns | 591ns | 0 | 0 | 0 | 4.55 KB |
| master | RunWafRealisticBenchmark |
netcoreapp3.1 | 822μs | 11.2μs | 112μs | 0 | 0 | 0 | 4.48 KB |
| master | RunWafRealisticBenchmark |
net472 | 430μs | 44.9ns | 168ns | 0 | 0 | 0 | 4.66 KB |
| master | RunWafRealisticBenchmarkWithAttack |
net6.0 | 285μs | 71.8ns | 278ns | 0 | 0 | 0 | 2.24 KB |
| master | RunWafRealisticBenchmarkWithAttack |
netcoreapp3.1 | 299μs | 58.6ns | 211ns | 0 | 0 | 0 | 2.22 KB |
| master | RunWafRealisticBenchmarkWithAttack |
net472 | 309μs | 26.2ns | 101ns | 0 | 0 | 0 | 2.29 KB |
| #7645 | RunWafRealisticBenchmark |
net6.0 | 402μs | 55.8ns | 201ns | 0 | 0 | 0 | 4.55 KB |
| #7645 | RunWafRealisticBenchmark |
netcoreapp3.1 | 818μs | 12.6μs | 126μs | 0 | 0 | 0 | 4.48 KB |
| #7645 | RunWafRealisticBenchmark |
net472 | 430μs | 50.2ns | 195ns | 0 | 0 | 0 | 4.66 KB |
| #7645 | RunWafRealisticBenchmarkWithAttack |
net6.0 | 286μs | 52.9ns | 191ns | 0 | 0 | 0 | 2.24 KB |
| #7645 | RunWafRealisticBenchmarkWithAttack |
netcoreapp3.1 | 296μs | 32.8ns | 123ns | 0 | 0 | 0 | 2.22 KB |
| #7645 | RunWafRealisticBenchmarkWithAttack |
net472 | 310μs | 22.4ns | 80.7ns | 0 | 0 | 0 | 2.3 KB |
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 | 62.1μs | 215ns | 804ns | 0 | 0 | 0 | 14.52 KB |
| master | SendRequest |
netcoreapp3.1 | 72.1μs | 126ns | 454ns | 0 | 0 | 0 | 17.42 KB |
| master | SendRequest |
net472 | 0.00351ns | 0.00142ns | 0.0055ns | 0 | 0 | 0 | 0 b |
| #7645 | SendRequest |
net6.0 | 62.4μs | 70.7ns | 274ns | 0 | 0 | 0 | 14.52 KB |
| #7645 | SendRequest |
netcoreapp3.1 | 70.6μs | 91.2ns | 329ns | 0 | 0 | 0 | 17.42 KB |
| #7645 | SendRequest |
net472 | 0.00593ns | 0.00182ns | 0.00705ns | 0 | 0 | 0 | 0 b |
Benchmarks.Trace.CharSliceBenchmark - Same speed ✔️ More allocations ⚠️
More allocations ⚠️ in #7645
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0
1 B
4 B
3 B
300.00%
Fewer allocations 🎉 in #7645
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net6.0
7 B
2 B
-5 B
-71.43%
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 | 1 B | 4 B | 3 B | 300.00% |
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net6.0 | 7 B | 2 B | -5 B | -71.43% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | OriginalCharSlice |
net6.0 | 1.92ms | 6.42μs | 24μs | 0 | 0 | 0 | 640.01 KB |
| master | OriginalCharSlice |
netcoreapp3.1 | 2.1ms | 3.29μs | 11.9μs | 0 | 0 | 0 | 640 KB |
| master | OriginalCharSlice |
net472 | 2.63ms | 110ns | 395ns | 100 | 0 | 0 | 641.95 KB |
| master | OptimizedCharSlice |
net6.0 | 1.39ms | 194ns | 752ns | 0 | 0 | 0 | 7 B |
| master | OptimizedCharSlice |
netcoreapp3.1 | 1.68ms | 544ns | 2.11μs | 0 | 0 | 0 | 1 B |
| master | OptimizedCharSlice |
net472 | 1.94ms | 169ns | 653ns | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSliceWithPool |
net6.0 | 795μs | 30.3ns | 117ns | 0 | 0 | 0 | 1 B |
| master | OptimizedCharSliceWithPool |
netcoreapp3.1 | 800μs | 130ns | 503ns | 0 | 0 | 0 | 0 b |
| master | OptimizedCharSliceWithPool |
net472 | 1.15ms | 62.2ns | 233ns | 0 | 0 | 0 | 0 b |
| #7645 | OriginalCharSlice |
net6.0 | 1.94ms | 422ns | 1.58μs | 0 | 0 | 0 | 640.01 KB |
| #7645 | OriginalCharSlice |
netcoreapp3.1 | 2.13ms | 5.49μs | 21.3μs | 0 | 0 | 0 | 640 KB |
| #7645 | OriginalCharSlice |
net472 | 2.76ms | 194ns | 672ns | 100 | 0 | 0 | 641.95 KB |
| #7645 | OptimizedCharSlice |
net6.0 | 1.4ms | 644ns | 2.49μs | 0 | 0 | 0 | 2 B |
| #7645 | OptimizedCharSlice |
netcoreapp3.1 | 1.7ms | 276ns | 1.07μs | 0 | 0 | 0 | 1 B |
| #7645 | OptimizedCharSlice |
net472 | 1.92ms | 197ns | 764ns | 0 | 0 | 0 | 0 b |
| #7645 | OptimizedCharSliceWithPool |
net6.0 | 795μs | 35.8ns | 139ns | 0 | 0 | 0 | 4 B |
| #7645 | OptimizedCharSliceWithPool |
netcoreapp3.1 | 827μs | 59.1ns | 229ns | 0 | 0 | 0 | 0 b |
| #7645 | OptimizedCharSliceWithPool |
net472 | 1.16ms | 175ns | 678ns | 0 | 0 | 0 | 0 b |
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | WriteAndFlushEnrichedTraces |
net6.0 | 702μs | 3.9μs | 24.3μs | 0 | 0 | 0 | 41.74 KB |
| master | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 717μs | 3.33μs | 13.7μs | 0 | 0 | 0 | 42.07 KB |
| master | WriteAndFlushEnrichedTraces |
net472 | 866μs | 2.7μs | 9.35μs | 4.46 | 0 | 0 | 55.83 KB |
| #7645 | WriteAndFlushEnrichedTraces |
net6.0 | 680μs | 769ns | 2.77μs | 0 | 0 | 0 | 41.65 KB |
| #7645 | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 663μs | 2.62μs | 13.1μs | 0 | 0 | 0 | 42.01 KB |
| #7645 | WriteAndFlushEnrichedTraces |
net472 | 938μs | 4.28μs | 16.6μs | 4.46 | 0 | 0 | 56.01 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.93μs | 9.02ns | 36.1ns | 0 | 0 | 0 | 1.02 KB |
| master | ExecuteNonQuery |
netcoreapp3.1 | 2.52μs | 11.2ns | 43.5ns | 0 | 0 | 0 | 1.02 KB |
| master | ExecuteNonQuery |
net472 | 2.91μs | 3.13ns | 12.1ns | 0.144 | 0.0144 | 0 | 987 B |
| #7645 | ExecuteNonQuery |
net6.0 | 1.91μs | 9.49ns | 43.5ns | 0 | 0 | 0 | 1.02 KB |
| #7645 | ExecuteNonQuery |
netcoreapp3.1 | 2.64μs | 9.27ns | 35.9ns | 0 | 0 | 0 | 1.02 KB |
| #7645 | ExecuteNonQuery |
net472 | 2.89μs | 2.83ns | 10.9ns | 0.144 | 0.0144 | 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.7μs | 8.55ns | 39.2ns | 0 | 0 | 0 | 1.03 KB |
| master | CallElasticsearch |
netcoreapp3.1 | 2.17μs | 10.8ns | 44.5ns | 0 | 0 | 0 | 1.03 KB |
| master | CallElasticsearch |
net472 | 3.63μs | 3.45ns | 12.4ns | 0.163 | 0 | 0 | 1.04 KB |
| master | CallElasticsearchAsync |
net6.0 | 1.86μs | 5.12ns | 19.8ns | 0 | 0 | 0 | 1.01 KB |
| master | CallElasticsearchAsync |
netcoreapp3.1 | 2.43μs | 6.67ns | 25.8ns | 0 | 0 | 0 | 1.08 KB |
| master | CallElasticsearchAsync |
net472 | 3.72μs | 2.09ns | 8.11ns | 0.167 | 0 | 0 | 1.1 KB |
| #7645 | CallElasticsearch |
net6.0 | 1.68μs | 5.52ns | 21.4ns | 0 | 0 | 0 | 1.03 KB |
| #7645 | CallElasticsearch |
netcoreapp3.1 | 2.19μs | 8.19ns | 31.7ns | 0 | 0 | 0 | 1.03 KB |
| #7645 | CallElasticsearch |
net472 | 3.56μs | 2.68ns | 9.68ns | 0.16 | 0 | 0 | 1.04 KB |
| #7645 | CallElasticsearchAsync |
net6.0 | 1.82μs | 6.73ns | 26.1ns | 0 | 0 | 0 | 1.01 KB |
| #7645 | CallElasticsearchAsync |
netcoreapp3.1 | 2.33μs | 8.35ns | 32.4ns | 0 | 0 | 0 | 1.08 KB |
| #7645 | CallElasticsearchAsync |
net472 | 3.82μs | 3.75ns | 14.5ns | 0.169 | 0 | 0 | 1.1 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.86μs | 8.11ns | 31.4ns | 0 | 0 | 0 | 952 B |
| master | ExecuteAsync |
netcoreapp3.1 | 2.52μs | 9.97ns | 37.3ns | 0 | 0 | 0 | 952 B |
| master | ExecuteAsync |
net472 | 2.53μs | 1.22ns | 4.74ns | 0.139 | 0 | 0 | 915 B |
| #7645 | ExecuteAsync |
net6.0 | 1.78μs | 8.96ns | 42ns | 0 | 0 | 0 | 952 B |
| #7645 | ExecuteAsync |
netcoreapp3.1 | 2.47μs | 9.21ns | 35.7ns | 0 | 0 | 0 | 952 B |
| #7645 | ExecuteAsync |
net472 | 2.68μs | 2.44ns | 9.11ns | 0.134 | 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 | 6.91μs | 18.2ns | 68ns | 0 | 0 | 0 | 2.36 KB |
| master | SendAsync |
netcoreapp3.1 | 8.87μs | 13.3ns | 51.7ns | 0 | 0 | 0 | 2.9 KB |
| master | SendAsync |
net472 | 12.4μs | 5.95ns | 22.3ns | 0.495 | 0 | 0 | 3.18 KB |
| #7645 | SendAsync |
net6.0 | 7.2μs | 18.3ns | 68.4ns | 0 | 0 | 0 | 2.36 KB |
| #7645 | SendAsync |
netcoreapp3.1 | 8.63μs | 18.8ns | 72.8ns | 0 | 0 | 0 | 2.9 KB |
| #7645 | SendAsync |
net472 | 12.4μs | 14.1ns | 54.7ns | 0.491 | 0 | 0 | 3.18 KB |
Benchmarks.Trace.Iast.StringAspectsBenchmark - Faster 🎉 More allocations ⚠️
Faster 🎉 in #7645
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0
1.159
48,850.00
42,150.00
More allocations ⚠️ in #7645
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472
57.34 KB
65.54 KB
8.19 KB
14.29%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0
44.41 KB
46.44 KB
2.03 KB
4.58%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472
286.72 KB
294.91 KB
8.19 KB
2.86%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1
42.8 KB
43.09 KB
288 B
0.67%
Fewer allocations 🎉 in #7645
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0
276.93 KB
249.98 KB
-26.94 KB
-9.73%
| Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 | 1.159 | 48,850.00 | 42,150.00 |
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 | 57.34 KB | 65.54 KB | 8.19 KB | 14.29% |
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 | 44.41 KB | 46.44 KB | 2.03 KB | 4.58% |
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472 | 286.72 KB | 294.91 KB | 8.19 KB | 2.86% |
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1 | 42.8 KB | 43.09 KB | 288 B | 0.67% |
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 | 276.93 KB | 249.98 KB | -26.94 KB | -9.73% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StringConcatBenchmark |
net6.0 | 50.6μs | 414ns | 3.88μs | 0 | 0 | 0 | 44.41 KB |
| master | StringConcatBenchmark |
netcoreapp3.1 | 49.8μs | 283ns | 2.02μs | 0 | 0 | 0 | 42.8 KB |
| master | StringConcatBenchmark |
net472 | 57.4μs | 253ns | 1.07μs | 0 | 0 | 0 | 57.34 KB |
| master | StringConcatAspectBenchmark |
net6.0 | 492μs | 2.04μs | 7.36μs | 0 | 0 | 0 | 276.93 KB |
| master | StringConcatAspectBenchmark |
netcoreapp3.1 | 482μs | 5.6μs | 55.4μs | 0 | 0 | 0 | 274.86 KB |
| master | StringConcatAspectBenchmark |
net472 | 409μs | 2.15μs | 10.5μs | 0 | 0 | 0 | 286.72 KB |
| #7645 | StringConcatBenchmark |
net6.0 | 45μs | 614ns | 6.08μs | 0 | 0 | 0 | 46.44 KB |
| #7645 | StringConcatBenchmark |
netcoreapp3.1 | 49.4μs | 288ns | 2.3μs | 0 | 0 | 0 | 43.09 KB |
| #7645 | StringConcatBenchmark |
net472 | 57μs | 238ns | 923ns | 0 | 0 | 0 | 65.54 KB |
| #7645 | StringConcatAspectBenchmark |
net6.0 | 467μs | 2.23μs | 10.2μs | 0 | 0 | 0 | 249.98 KB |
| #7645 | StringConcatAspectBenchmark |
netcoreapp3.1 | 534μs | 2.6μs | 10.4μs | 0 | 0 | 0 | 275.11 KB |
| #7645 | StringConcatAspectBenchmark |
net472 | 403μs | 1.95μs | 8.29μs | 0 | 0 | 0 | 294.91 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.66μs | 2.98ns | 11.5ns | 0 | 0 | 0 | 1.7 KB |
| master | EnrichedLog |
netcoreapp3.1 | 3.6μs | 15.7ns | 58.7ns | 0 | 0 | 0 | 1.7 KB |
| master | EnrichedLog |
net472 | 4.03μs | 5.09ns | 19.7ns | 0.241 | 0 | 0 | 1.64 KB |
| #7645 | EnrichedLog |
net6.0 | 2.66μs | 13.6ns | 66.8ns | 0 | 0 | 0 | 1.7 KB |
| #7645 | EnrichedLog |
netcoreapp3.1 | 3.63μs | 15.8ns | 61.1ns | 0 | 0 | 0 | 1.7 KB |
| #7645 | EnrichedLog |
net472 | 4.01μs | 3.93ns | 15.2ns | 0.242 | 0 | 0 | 1.64 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 | 137μs | 665ns | 2.66μs | 0 | 0 | 0 | 4.31 KB |
| master | EnrichedLog |
netcoreapp3.1 | 141μs | 666ns | 2.58μs | 0 | 0 | 0 | 4.31 KB |
| master | EnrichedLog |
net472 | 169μs | 35ns | 126ns | 0 | 0 | 0 | 4.52 KB |
| #7645 | EnrichedLog |
net6.0 | 123μs | 91.1ns | 353ns | 0 | 0 | 0 | 4.31 KB |
| #7645 | EnrichedLog |
netcoreapp3.1 | 128μs | 95.3ns | 344ns | 0 | 0 | 0 | 4.31 KB |
| #7645 | EnrichedLog |
net472 | 170μs | 184ns | 712ns | 0 | 0 | 0 | 4.52 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.13μs | 20ns | 77.4ns | 0 | 0 | 0 | 2.26 KB |
| master | EnrichedLog |
netcoreapp3.1 | 6.81μs | 8.17ns | 31.6ns | 0 | 0 | 0 | 2.26 KB |
| master | EnrichedLog |
net472 | 7.53μs | 6.93ns | 26.8ns | 0.302 | 0 | 0 | 2.08 KB |
| #7645 | EnrichedLog |
net6.0 | 5.11μs | 19.6ns | 75.8ns | 0 | 0 | 0 | 2.26 KB |
| #7645 | EnrichedLog |
netcoreapp3.1 | 7.03μs | 21.7ns | 84ns | 0 | 0 | 0 | 2.26 KB |
| #7645 | EnrichedLog |
net472 | 7.51μs | 8.11ns | 31.4ns | 0.299 | 0 | 0 | 2.08 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 | 2.02μs | 10.3ns | 44.8ns | 0 | 0 | 0 | 1.2 KB |
| master | SendReceive |
netcoreapp3.1 | 2.65μs | 13.3ns | 61ns | 0 | 0 | 0 | 1.2 KB |
| master | SendReceive |
net472 | 3.17μs | 3.01ns | 11.7ns | 0.19 | 0 | 0 | 1.2 KB |
| #7645 | SendReceive |
net6.0 | 2.01μs | 9.45ns | 36.6ns | 0 | 0 | 0 | 1.2 KB |
| #7645 | SendReceive |
netcoreapp3.1 | 2.67μs | 12.8ns | 49.6ns | 0 | 0 | 0 | 1.2 KB |
| #7645 | SendReceive |
net472 | 3.15μs | 4.37ns | 16.9ns | 0.19 | 0 | 0 | 1.2 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.29μs | 6.52ns | 25.2ns | 0 | 0 | 0 | 1.58 KB |
| master | EnrichedLog |
netcoreapp3.1 | 5.5μs | 14.2ns | 53.2ns | 0 | 0 | 0 | 1.63 KB |
| master | EnrichedLog |
net472 | 6.57μs | 5.17ns | 20ns | 0.295 | 0 | 0 | 2.03 KB |
| #7645 | EnrichedLog |
net6.0 | 4.27μs | 13.2ns | 51.1ns | 0 | 0 | 0 | 1.58 KB |
| #7645 | EnrichedLog |
netcoreapp3.1 | 5.8μs | 3.08ns | 11.5ns | 0 | 0 | 0 | 1.63 KB |
| #7645 | EnrichedLog |
net472 | 6.59μs | 11.5ns | 44.5ns | 0.293 | 0 | 0 | 2.03 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 | 783ns | 0.287ns | 1.11ns | 0 | 0 | 0 | 576 B |
| master | StartFinishSpan |
netcoreapp3.1 | 974ns | 5.05ns | 24.2ns | 0 | 0 | 0 | 576 B |
| master | StartFinishSpan |
net472 | 936ns | 0.628ns | 2.43ns | 0.0897 | 0 | 0 | 578 B |
| master | StartFinishScope |
net6.0 | 910ns | 4.47ns | 20ns | 0 | 0 | 0 | 696 B |
| master | StartFinishScope |
netcoreapp3.1 | 1.17μs | 6.23ns | 31.1ns | 0 | 0 | 0 | 696 B |
| master | StartFinishScope |
net472 | 1.14μs | 0.734ns | 2.84ns | 0.102 | 0 | 0 | 658 B |
| #7645 | StartFinishSpan |
net6.0 | 763ns | 3.24ns | 11.7ns | 0 | 0 | 0 | 576 B |
| #7645 | StartFinishSpan |
netcoreapp3.1 | 990ns | 4.79ns | 18.6ns | 0 | 0 | 0 | 576 B |
| #7645 | StartFinishSpan |
net472 | 937ns | 0.885ns | 3.43ns | 0.0894 | 0 | 0 | 578 B |
| #7645 | StartFinishScope |
net6.0 | 976ns | 5.14ns | 26.7ns | 0 | 0 | 0 | 696 B |
| #7645 | StartFinishScope |
netcoreapp3.1 | 1.16μs | 5.85ns | 24.8ns | 0 | 0 | 0 | 696 B |
| #7645 | StartFinishScope |
net472 | 1.12μs | 0.814ns | 3.15ns | 0.101 | 0 | 0 | 658 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.11μs | 1.58ns | 6.14ns | 0 | 0 | 0 | 696 B |
| master | RunOnMethodBegin |
netcoreapp3.1 | 1.4μs | 5.93ns | 23ns | 0 | 0 | 0 | 696 B |
| master | RunOnMethodBegin |
net472 | 1.48μs | 1.35ns | 5.23ns | 0.104 | 0 | 0 | 658 B |
| #7645 | RunOnMethodBegin |
net6.0 | 1.1μs | 0.604ns | 2.09ns | 0 | 0 | 0 | 696 B |
| #7645 | RunOnMethodBegin |
netcoreapp3.1 | 1.46μs | 7.32ns | 31.1ns | 0 | 0 | 0 | 696 B |
| #7645 | RunOnMethodBegin |
net472 | 1.45μs | 0.436ns | 1.63ns | 0.102 | 0 | 0 | 658 B |
tracer/src/Datadog.Trace/Telemetry/Transports/JsonTelemetryTransport.cs
Outdated
Show resolved
Hide resolved
tracer/test/Datadog.Trace.IntegrationTests/TelemetryTransportTests.cs
Outdated
Show resolved
Hide resolved
| using var sr = new StreamReader(inputStream); | ||
| var text = sr.ReadToEnd(); | ||
| var tr = new StringReader(text); |
There was a problem hiding this comment.
I wonder why we did this before, instead of what you did in this PR? 🤔 Seems odd that we would want to do that 😄 Maybe it was for easier debugging 🤷♂️
…nsport.cs Co-authored-by: Andrew Lock <andrew.lock@datadoghq.com>
…ests.cs Co-authored-by: Andrew Lock <andrew.lock@datadoghq.com>
bouwkast
left a comment
There was a problem hiding this comment.
LGTM I have a couple of questions on Agent version and if there is a chance we would get rejected based on it being compressed and would need to fallback?
| { | ||
| public AgentTelemetryTransport(IApiRequestFactory requestFactory, bool debugEnabled) | ||
| : base(requestFactory, debugEnabled) | ||
| public AgentTelemetryTransport(IApiRequestFactory requestFactory, bool debugEnabled, string telemetryCompressionMethod) |
There was a problem hiding this comment.
Is there a minimum agent version for this?
I think telemetry skips the agent though so maybe not a concern?
There was a problem hiding this comment.
According to the agent team, compressed telemetry is supported from version 7.34 (Dec 2021). Actually, the agent is like a proxy and does not do anything with the headers or data but sending it directly to the backend. Before this version, the endpoint did not exist in the agent, so I think that we are safe with the compression. We already checked before this PR for agents without the endpoint.
| TelemetryFactory.Metrics.RecordCountTelemetryApiRequests(endpointMetricTag); | ||
| using var response = await request.PostAsync(new ArraySegment<byte>(bytes), "application/json").ConfigureAwait(false); | ||
|
|
||
| using var response = await request.PostAsync(new ArraySegment<byte>(bytes), "application/json", _telemetryGzipCompressionEnabled ? "gzip" : null).ConfigureAwait(false); |
There was a problem hiding this comment.
Is there a possibility that we get rejected due to compressed payloads and would need to fallback to uncompressed?
|
Thanks for the feedback and reviews! |
Summary of changes
This PR enables by default the telemetry compression. This feature allows to compress the telemetry payloads in oder to send smaller messages.
The variable DD_INSTRUMENTATION_TELEMETRY_COMPRESSION_METHOD controls the compression method. Now, it only accepts "gzip" or "none". By default, this variable is set as "gzip".
A PR has been created in dd-go to add this new configration value: https://github.com/DataDog/dd-go/pull/204882
Reason for change
Implementation details
Test coverage
This feature has been tested by sending telemetry to the UI both with agent and in agentless mode.
Other details