Skip to content

Compress telemetry payload#7645

Merged
NachoEchevarria merged 16 commits intomasterfrom
nacho/compressTelemetryPayload
Nov 4, 2025
Merged

Compress telemetry payload#7645
NachoEchevarria merged 16 commits intomasterfrom
nacho/compressTelemetryPayload

Conversation

@NachoEchevarria
Copy link
Collaborator

@NachoEchevarria NachoEchevarria commented Oct 13, 2025

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

@NachoEchevarria NachoEchevarria changed the title Nacho/compress telemetry payload Compress telemetry payload Oct 13, 2025
@datadog-official

This comment has been minimized.

@dd-trace-dotnet-ci-bot
Copy link

dd-trace-dotnet-ci-bot bot commented Oct 13, 2025

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (7645) and master.

✅ No regressions detected - check the details below

Full Metrics Comparison

FakeDbCommand

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration78.98 ± (78.92 - 80.12) ms75.31 ± (75.59 - 76.66) ms-4.7%
.NET Framework 4.8 - Bailout
duration92.99 ± (92.23 - 93.76) ms82.00 ± (81.58 - 83.18) ms-11.8%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1193.97 ± (1187.38 - 1203.63) ms1108.72 ± (1110.42 - 1127.08) ms-7.1%
.NET Core 3.1 - Baseline
process.internal_duration_ms23.67 ± (23.53 - 23.81) ms22.36 ± (22.33 - 22.39) ms-5.5%
process.time_to_main_ms93.44 ± (92.73 - 94.15) ms82.07 ± (81.88 - 82.27) ms-12.2%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.92 ± (10.91 - 10.92) MB10.87 ± (10.87 - 10.87) MB-0.4%
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms23.80 ± (23.66 - 23.94) ms22.28 ± (22.25 - 22.32) ms-6.4%
process.time_to_main_ms97.71 ± (97.04 - 98.38) ms83.11 ± (82.88 - 83.35) ms-14.9%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.93 ± (10.93 - 10.94) MB10.92 ± (10.91 - 10.92) MB-0.1%
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms231.42 ± (229.74 - 233.10) ms217.25 ± (215.56 - 218.93) ms-6.1%
process.time_to_main_ms580.63 ± (578.66 - 582.60) ms528.09 ± (526.37 - 529.82) ms-9.0%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed52.49 ± (52.47 - 52.51) MB52.45 ± (52.42 - 52.47) MB-0.1%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.5%
.NET 6 - Baseline
process.internal_duration_ms22.25 ± (22.15 - 22.34) ms21.55 ± (21.47 - 21.63) ms-3.1%
process.time_to_main_ms77.48 ± (77.10 - 77.85) ms74.63 ± (74.01 - 75.25) ms-3.7%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.61 ± (10.61 - 10.62) MB10.59 ± (10.58 - 10.59) MB-0.3%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms22.16 ± (22.06 - 22.26) ms21.07 ± (21.03 - 21.10) ms-4.9%
process.time_to_main_ms80.02 ± (79.53 - 80.51) ms72.10 ± (71.94 - 72.26) ms-9.9%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.64 ± (10.64 - 10.64) MB10.63 ± (10.63 - 10.64) MB-0.1%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms211.88 ± (210.38 - 213.38) ms206.87 ± (205.11 - 208.63) ms-2.4%
process.time_to_main_ms529.66 ± (528.08 - 531.24) ms503.43 ± (501.60 - 505.26) ms-5.0%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed51.61 ± (51.59 - 51.63) MB51.60 ± (51.56 - 51.64) MB-0.0%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.2%
.NET 8 - Baseline
process.internal_duration_ms20.27 ± (20.18 - 20.37) ms19.59 ± (19.52 - 19.66) ms-3.4%
process.time_to_main_ms77.49 ± (77.07 - 77.90) ms74.05 ± (73.56 - 74.54) ms-4.4%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.64 ± (7.63 - 7.65) MB7.60 ± (7.59 - 7.60) MB-0.6%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms20.38 ± (20.28 - 20.48) ms19.52 ± (19.47 - 19.57) ms-4.2%
process.time_to_main_ms80.77 ± (80.11 - 81.44) ms74.87 ± (74.46 - 75.29) ms-7.3%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.67 ± (7.66 - 7.67) MB7.66 ± (7.66 - 7.67) MB-0.1%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms200.91 ± (199.68 - 202.15) ms189.49 ± (188.51 - 190.46) ms-5.7%
process.time_to_main_ms517.07 ± (514.89 - 519.24) ms480.84 ± (479.38 - 482.30) ms-7.0%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed39.05 ± (39.02 - 39.09) MB38.71 ± (38.68 - 38.75) MB-0.9%
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)-0.3%

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration194.54 ± (193.84 - 194.72) ms196.08 ± (195.82 - 196.92) ms+0.8%✅⬆️
.NET Framework 4.8 - Bailout
duration196.17 ± (196.02 - 196.62) ms200.94 ± (200.96 - 202.35) ms+2.4%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1165.58 ± (1170.48 - 1180.89) ms1176.44 ± (1178.85 - 1187.93) ms+0.9%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms187.27 ± (186.87 - 187.66) ms192.05 ± (191.59 - 192.50) ms+2.6%✅⬆️
process.time_to_main_ms80.44 ± (80.22 - 80.67) ms82.09 ± (81.87 - 82.31) ms+2.1%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.11 ± (16.08 - 16.13) MB16.02 ± (16.00 - 16.04) MB-0.5%
runtime.dotnet.threads.count20 ± (19 - 20)20 ± (20 - 20)+0.4%✅⬆️
.NET Core 3.1 - Bailout
process.internal_duration_ms187.13 ± (186.72 - 187.54) ms191.64 ± (191.17 - 192.12) ms+2.4%✅⬆️
process.time_to_main_ms82.07 ± (81.89 - 82.24) ms83.44 ± (83.21 - 83.67) ms+1.7%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.14 ± (16.11 - 16.17) MB16.06 ± (16.04 - 16.08) MB-0.5%
runtime.dotnet.threads.count21 ± (21 - 21)21 ± (21 - 21)-0.1%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms393.90 ± (391.58 - 396.22) ms398.44 ± (396.03 - 400.85) ms+1.2%✅⬆️
process.time_to_main_ms518.31 ± (517.60 - 519.02) ms524.12 ± (523.05 - 525.19) ms+1.1%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed62.81 ± (62.66 - 62.97) MB63.01 ± (62.86 - 63.15) MB+0.3%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)+0.0%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms191.35 ± (190.94 - 191.77) ms194.53 ± (194.09 - 194.98) ms+1.7%✅⬆️
process.time_to_main_ms69.76 ± (69.58 - 69.95) ms70.69 ± (70.51 - 70.88) ms+1.3%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.16 ± (16.04 - 16.28) MB16.23 ± (16.17 - 16.29) MB+0.4%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 19)19 ± (19 - 19)+3.2%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms190.22 ± (189.93 - 190.51) ms192.66 ± (192.25 - 193.07) ms+1.3%✅⬆️
process.time_to_main_ms70.44 ± (70.34 - 70.53) ms71.13 ± (70.97 - 71.28) ms+1.0%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.02 ± (15.86 - 16.18) MB16.22 ± (16.10 - 16.34) MB+1.2%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)20 ± (19 - 20)+2.9%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms407.78 ± (405.03 - 410.54) ms412.73 ± (409.63 - 415.82) ms+1.2%✅⬆️
process.time_to_main_ms487.62 ± (487.00 - 488.24) ms483.15 ± (482.54 - 483.76) ms-0.9%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed62.11 ± (61.96 - 62.26) MB62.13 ± (61.99 - 62.27) MB+0.0%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 30)29 ± (29 - 29)-0.0%
.NET 8 - Baseline
process.internal_duration_ms189.82 ± (189.46 - 190.18) ms190.11 ± (189.73 - 190.49) ms+0.2%✅⬆️
process.time_to_main_ms69.02 ± (68.86 - 69.17) ms69.43 ± (69.24 - 69.63) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.74 ± (11.71 - 11.77) MB11.74 ± (11.72 - 11.77) MB+0.0%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)-0.4%
.NET 8 - Bailout
process.internal_duration_ms189.47 ± (189.16 - 189.78) ms189.28 ± (189.01 - 189.55) ms-0.1%
process.time_to_main_ms70.20 ± (70.08 - 70.31) ms70.43 ± (70.33 - 70.53) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.72 ± (11.65 - 11.79) MB11.82 ± (11.78 - 11.85) MB+0.8%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)-0.1%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms361.81 ± (360.50 - 363.12) ms362.63 ± (361.27 - 363.99) ms+0.2%✅⬆️
process.time_to_main_ms466.78 ± (465.93 - 467.62) ms459.92 ± (459.14 - 460.71) ms-1.5%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed50.30 ± (50.27 - 50.33) MB50.34 ± (50.30 - 50.37) MB+0.1%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)+0.3%✅⬆️
Comparison explanation

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 highlighted in **red**. The following thresholds were used for comparing the execution times:

  • Welch test with statistical test for significance of 5%
  • Only results indicating a difference greater than 5% and 5 ms are considered.

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 charts
FakeDbCommand (.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

Loading
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

Loading
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

Loading
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

Loading
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

Loading
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

Loading
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

Loading
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

Loading

Comment on lines 52 to +66
var serializedData = SerializeTelemetry(data);
var bytes = Encoding.UTF8.GetBytes(serializedData);

var request = _requestFactory.Create(_endpoint);

if (_telemetryGzipCompressionEnabled)
{
bytes = CompressGzip(bytes);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have implemented your solution. Thanks!

@pr-commenter
Copy link

pr-commenter bot commented Oct 23, 2025

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #7645 compared to master:

  • 1 benchmarks are faster, with geometric mean 1.159
  • 3 benchmarks have fewer allocations
  • 7 benchmarks have more allocations

The following thresholds were used for comparing the benchmark speeds:

  • Mann–Whitney U test with statistical test for significance of 5%
  • Only results indicating a difference greater than 10% and 0.3 ns are considered.

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.ActivityBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7645

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%

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%

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%

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%

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

@NachoEchevarria NachoEchevarria marked this pull request as ready for review October 23, 2025 13:06
@NachoEchevarria NachoEchevarria requested a review from a team as a code owner October 23, 2025 13:06
Copy link
Member

@andrewlock andrewlock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, thanks!

Comment on lines -147 to -149
using var sr = new StreamReader(inputStream);
var text = sr.ReadToEnd();
var tr = new StringReader(text);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 🤷‍♂️

NachoEchevarria and others added 2 commits October 23, 2025 15:24
…nsport.cs

Co-authored-by: Andrew Lock <andrew.lock@datadoghq.com>
…ests.cs

Co-authored-by: Andrew Lock <andrew.lock@datadoghq.com>
Copy link
Collaborator

@bouwkast bouwkast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a minimum agent version for this?
I think telemetry skips the agent though so maybe not a concern?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a possibility that we get rejected due to compressed payloads and would need to fallback to uncompressed?

@NachoEchevarria
Copy link
Collaborator Author

Thanks for the feedback and reviews!

@NachoEchevarria NachoEchevarria merged commit 3ded9ec into master Nov 4, 2025
152 checks passed
@NachoEchevarria NachoEchevarria deleted the nacho/compressTelemetryPayload branch November 4, 2025 12:23
@github-actions github-actions bot added this to the vNext-v3 milestone Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants