DataDog / dd-trace-dotnet

.NET Client Library for Datadog APM
https://docs.datadoghq.com/tracing/
Apache License 2.0
456 stars 142 forks source link

Extract Upper64 bit trace ID from extension response #6041

Closed agocs closed 3 weeks ago

agocs commented 2 months ago

Summary of changes

I've updated the Lambda extension so it is capable of returning a 128 bit trace ID when a tracer calls the /lambda/start-invocation endpoint in this PR

As per the RFC, the

lower 64 bits in x-datadog-trace-id (decimal) and the higher 64 bits in x-datadog-tags header under _dd.p.tid (hex) tag.

This change modifies the function that calls /lambda/start-invocation, allowing it to pick out the upper 64 bits of the trace ID and set the resulting 128-bit trace ID in the extracted context.

Reason for change

The Lambda Extension may now return a 128 bit trace ID when a Step Function invokes a Lambda Function.

Implementation details

I rewrote LambdaCommon's CreatePlaceholderScope so it uses SpanContextPropagator.Instance.Extract rather than extracting trace context elements one by one.

Test coverage

Added a unit test for 128 bit trace IDs. Fixed existing unit tests so they pass a dictionary of headers to CreatePlaceholderScope. Removed a unit test that only passes SamplingPriority, since a distributed trace with only a sampling priority is hardly a distributed trace at all.

Other details

Backported to 2.x in #6181

andrewlock commented 2 months ago

Execution-Time Benchmarks Report :stopwatch:

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 (6041) - mean (69ms)  : 68, 71
     .   : milestone, 69,
    master - mean (70ms)  : 67, 73
     .   : milestone, 70,

    section CallTarget+Inlining+NGEN
    This PR (6041) - mean (1,108ms)  : 1084, 1133
     .   : milestone, 1108,
    master - mean (1,109ms)  : 1084, 1133
     .   : milestone, 1109,
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6041) - mean (109ms)  : 106, 112
     .   : milestone, 109,
    master - mean (109ms)  : 106, 111
     .   : milestone, 109,

    section CallTarget+Inlining+NGEN
    This PR (6041) - mean (770ms)  : 754, 786
     .   : milestone, 770,
    master - mean (769ms)  : 749, 790
     .   : milestone, 769,
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6041) - mean (92ms)  : 89, 95
     .   : milestone, 92,
    master - mean (92ms)  : 89, 94
     .   : milestone, 92,

    section CallTarget+Inlining+NGEN
    This PR (6041) - mean (721ms)  : 706, 736
     .   : milestone, 721,
    master - mean (727ms)  : 707, 746
     .   : milestone, 727,
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6041) - mean (191ms)  : 187, 195
     .   : milestone, 191,
    master - mean (192ms)  : 188, 196
     .   : milestone, 192,

    section CallTarget+Inlining+NGEN
    This PR (6041) - mean (1,205ms)  : 1178, 1231
     .   : milestone, 1205,
    master - mean (1,203ms)  : 1180, 1226
     .   : milestone, 1203,
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6041) - mean (276ms)  : 272, 280
     .   : milestone, 276,
    master - mean (276ms)  : 272, 280
     .   : milestone, 276,

    section CallTarget+Inlining+NGEN
    This PR (6041) - mean (946ms)  : 929, 962
     .   : milestone, 946,
    master - mean (946ms)  : 925, 968
     .   : milestone, 946,
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6041) - mean (265ms)  : 260, 270
     .   : milestone, 265,
    master - mean (265ms)  : 261, 269
     .   : milestone, 265,

    section CallTarget+Inlining+NGEN
    This PR (6041) - mean (927ms)  : 908, 945
     .   : milestone, 927,
    master - mean (930ms)  : 912, 948
     .   : milestone, 930,
datadog-ddstaging[bot] commented 2 months ago

Datadog Report

Branch report: chris.agocs/parse_128_bit_trace_id_from_lambda_extension Commit report: 83201d8 Test service: dd-trace-dotnet

:white_check_mark: 0 Failed, 363186 Passed, 2063 Skipped, 14h 59m 32.05s Total Time

andrewlock commented 2 months ago

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 (6041) (11.244M)   : 0, 11244059
    master (11.101M)   : 0, 11100941
    benchmarks/2.9.0 (11.081M)   : 0, 11080577

    section Automatic
    This PR (6041) (7.434M)   : 0, 7434070
    master (7.389M)   : 0, 7389242
    benchmarks/2.9.0 (7.732M)   : 0, 7732233

    section Trace stats
    master (7.528M)   : 0, 7528321

    section Manual
    master (10.986M)   : 0, 10986040

    section Manual + Automatic
    This PR (6041) (6.862M)   : 0, 6862422
    master (6.820M)   : 0, 6819504

    section DD_TRACE_ENABLED=0
    master (10.304M)   : 0, 10304285
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6041) (9.777M)   : 0, 9777037
    master (9.728M)   : 0, 9727588
    benchmarks/2.9.0 (9.798M)   : 0, 9798067

    section Automatic
    This PR (6041) (6.768M)   : 0, 6768161
    master (6.463M)   : 0, 6463228

    section Trace stats
    master (6.591M)   : 0, 6591023

    section Manual
    master (9.627M)   : 0, 9627166

    section Manual + Automatic
    This PR (6041) (6.092M)   : 0, 6092230
    master (6.028M)   : 0, 6027833

    section DD_TRACE_ENABLED=0
    master (8.762M)   : 0, 8761785
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6041) (10.002M)   : 0, 10001542
    master (9.966M)   : 0, 9965554
    benchmarks/2.9.0 (10.067M)   : 0, 10067315

    section Automatic
    This PR (6041) (6.758M)   : 0, 6757917
    master (6.494M)   : 0, 6493647
    benchmarks/2.9.0 (7.552M)   : 0, 7552193

    section Trace stats
    master (7.096M)   : 0, 7096492

    section Manual
    master (9.850M)   : 0, 9850046

    section Manual + Automatic
    This PR (6041) (6.245M)   : 0, 6244577
    master (5.952M)   : 0, 5952386

    section DD_TRACE_ENABLED=0
    master (9.119M)   : 0, 9118624
andrewlock commented 2 months ago

Benchmarks Report for tracer :snail:

Benchmarks for #6041 compared to master:

The following thresholds were used for comparing the benchmark speeds:

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.ActivityBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark: ### Raw results | Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | |---------|---------------------------- |-------------- |---------:|---------:|--------:|-------:|------:|------:|----------:| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`StartStopWithChild`|net6.0|7.73μs|39.1ns|183ns|0.0112| 0.00372|0|5.43 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`StartStopWithChild`|netcoreapp3.1|10μs|53.7ns|364ns|0.0206| 0.0103|0|5.62 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`StartStopWithChild`|net472|16.6μs|67.7ns|262ns|1.01| 0.295|0.0928|6.07 KB| |#6041|`StartStopWithChild`|net6.0|7.85μs|44ns|308ns|0.0169| 0.00847|0|5.43 KB| |#6041|`StartStopWithChild`|netcoreapp3.1|9.56μs|52.4ns|323ns|0.0187| 0.00933|0|5.62 KB| |#6041|`StartStopWithChild`|net472|16.4μs|52.3ns|202ns|1.02| 0.316|0.0973|6.06 KB|
Benchmarks.Trace.AgentWriterBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark: ### Raw results | Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | |---------|---------------------------- |-------------- |---------:|---------:|--------:|-------:|------:|------:|----------:| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`WriteAndFlushEnrichedTraces`|net6.0|475μs|187ns|726ns|0| 0|0|2.7 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`WriteAndFlushEnrichedTraces`|netcoreapp3.1|654μs|201ns|753ns|0| 0|0|2.7 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`WriteAndFlushEnrichedTraces`|net472|836μs|409ns|1.58μs|0.417| 0|0|3.3 KB| |#6041|`WriteAndFlushEnrichedTraces`|net6.0|482μs|189ns|732ns|0| 0|0|2.7 KB| |#6041|`WriteAndFlushEnrichedTraces`|netcoreapp3.1|643μs|366ns|1.32μs|0| 0|0|2.7 KB| |#6041|`WriteAndFlushEnrichedTraces`|net472|839μs|518ns|1.94μs|0.419| 0|0|3.3 KB|
Benchmarks.Trace.AspNetCoreBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark: ### Raw results | Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | |---------|---------------------------- |-------------- |---------:|---------:|--------:|-------:|------:|------:|----------:| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`SendRequest`|net6.0|193μs|1.04μs|6.35μs|0.195| 0|0|18.45 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`SendRequest`|netcoreapp3.1|233μs|1.27μs|7.6μs|0.227| 0|0|20.61 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`SendRequest`|net472|0.0013ns|0.000284ns|0.000982ns|0| 0|0|0 b| |#6041|`SendRequest`|net6.0|214μs|1.19μs|7.63μs|0.195| 0|0|18.45 KB| |#6041|`SendRequest`|netcoreapp3.1|222μs|1.28μs|9.82μs|0.224| 0|0|20.61 KB| |#6041|`SendRequest`|net472|0.000658ns|0.000309ns|0.00116ns|0| 0|0|0 b|
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark: ### Raw results | Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | |---------|---------------------------- |-------------- |---------:|---------:|--------:|-------:|------:|------:|----------:| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`WriteAndFlushEnrichedTraces`|net6.0|594μs|3.36μs|22.5μs|0.581| 0|0|41.62 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`WriteAndFlushEnrichedTraces`|netcoreapp3.1|705μs|3.69μs|21.2μs|0.363| 0|0|41.82 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`WriteAndFlushEnrichedTraces`|net472|861μs|3.37μs|12.6μs|8.13| 2.57|0.428|53.31 KB| |#6041|`WriteAndFlushEnrichedTraces`|net6.0|580μs|3.2μs|19.2μs|0.587| 0|0|41.63 KB| |#6041|`WriteAndFlushEnrichedTraces`|netcoreapp3.1|664μs|2.36μs|8.51μs|0.334| 0|0|41.87 KB| |#6041|`WriteAndFlushEnrichedTraces`|net472|860μs|4.46μs|21.4μs|8.45| 2.53|0.422|53.32 KB|
Benchmarks.Trace.DbCommandBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark: ### Raw results | Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | |---------|---------------------------- |-------------- |---------:|---------:|--------:|-------:|------:|------:|----------:| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`ExecuteNonQuery`|net6.0|1.23μs|1.2ns|4.66ns|0.0142| 0|0|1.02 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`ExecuteNonQuery`|netcoreapp3.1|1.73μs|1.66ns|6.44ns|0.0138| 0|0|1.02 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`ExecuteNonQuery`|net472|2.11μs|1.25ns|4.69ns|0.157| 0|0|987 B| |#6041|`ExecuteNonQuery`|net6.0|1.36μs|1.76ns|6.8ns|0.0142| 0|0|1.02 KB| |#6041|`ExecuteNonQuery`|netcoreapp3.1|1.74μs|1.84ns|7.12ns|0.014| 0|0|1.02 KB| |#6041|`ExecuteNonQuery`|net472|2.13μs|1.87ns|6.98ns|0.156| 0|0|987 B|
Benchmarks.Trace.ElasticsearchBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark: ### Raw results | Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | |---------|---------------------------- |-------------- |---------:|---------:|--------:|-------:|------:|------:|----------:| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`CallElasticsearch`|net6.0|1.23μs|0.363ns|1.36ns|0.0138| 0|0|976 B| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`CallElasticsearch`|netcoreapp3.1|1.52μs|1.38ns|5.36ns|0.0129| 0|0|976 B| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`CallElasticsearch`|net472|2.55μs|2.36ns|8.51ns|0.158| 0|0|995 B| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`CallElasticsearchAsync`|net6.0|1.2μs|0.922ns|3.57ns|0.0132| 0|0|952 B| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`CallElasticsearchAsync`|netcoreapp3.1|1.68μs|1.46ns|5.66ns|0.0135| 0|0|1.02 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`CallElasticsearchAsync`|net472|2.74μs|2.61ns|10.1ns|0.167| 0|0|1.05 KB| |#6041|`CallElasticsearch`|net6.0|1.23μs|0.483ns|1.81ns|0.0135| 0|0|976 B| |#6041|`CallElasticsearch`|netcoreapp3.1|1.63μs|0.6ns|2.32ns|0.0131| 0|0|976 B| |#6041|`CallElasticsearch`|net472|2.49μs|1.66ns|6.43ns|0.158| 0|0|995 B| |#6041|`CallElasticsearchAsync`|net6.0|1.25μs|0.541ns|2.02ns|0.013| 0|0|952 B| |#6041|`CallElasticsearchAsync`|netcoreapp3.1|1.67μs|1.18ns|4.4ns|0.0135| 0|0|1.02 KB| |#6041|`CallElasticsearchAsync`|net472|2.49μs|3.58ns|13.9ns|0.167| 0|0|1.05 KB|
Benchmarks.Trace.GraphQLBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark: ### Raw results | Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | |---------|---------------------------- |-------------- |---------:|---------:|--------:|-------:|------:|------:|----------:| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`ExecuteAsync`|net6.0|1.15μs|0.615ns|2.3ns|0.0132| 0|0|952 B| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`ExecuteAsync`|netcoreapp3.1|1.58μs|1.75ns|6.79ns|0.0126| 0|0|952 B| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`ExecuteAsync`|net472|1.89μs|2.39ns|9.24ns|0.145| 0|0|915 B| |#6041|`ExecuteAsync`|net6.0|1.25μs|1.54ns|5.77ns|0.0132| 0|0|952 B| |#6041|`ExecuteAsync`|netcoreapp3.1|1.65μs|0.478ns|1.79ns|0.0125| 0|0|952 B| |#6041|`ExecuteAsync`|net472|1.8μs|0.574ns|2.22ns|0.145| 0|0|915 B|
Benchmarks.Trace.HttpClientBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark: ### Raw results | Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | |---------|---------------------------- |-------------- |---------:|---------:|--------:|-------:|------:|------:|----------:| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`SendAsync`|net6.0|4.1μs|3.69ns|13.8ns|0.0307| 0|0|2.22 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`SendAsync`|netcoreapp3.1|5.1μs|2.99ns|11.2ns|0.0383| 0|0|2.76 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`SendAsync`|net472|7.77μs|4.9ns|19ns|0.497| 0|0|3.15 KB| |#6041|`SendAsync`|net6.0|4.09μs|1.3ns|5.05ns|0.0309| 0|0|2.22 KB| |#6041|`SendAsync`|netcoreapp3.1|5.07μs|3.32ns|12.9ns|0.0381| 0|0|2.76 KB| |#6041|`SendAsync`|net472|7.87μs|0.829ns|3.1ns|0.497| 0|0|3.15 KB|
Benchmarks.Trace.ILoggerBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark: ### Raw results | Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | |---------|---------------------------- |-------------- |---------:|---------:|--------:|-------:|------:|------:|----------:| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`EnrichedLog`|net6.0|1.46μs|1.48ns|5.75ns|0.0228| 0|0|1.64 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`EnrichedLog`|netcoreapp3.1|2.11μs|1.17ns|4.39ns|0.0222| 0|0|1.64 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`EnrichedLog`|net472|2.7μs|1.18ns|4.56ns|0.249| 0|0|1.57 KB| |#6041|`EnrichedLog`|net6.0|1.45μs|0.749ns|2.8ns|0.0232| 0|0|1.64 KB| |#6041|`EnrichedLog`|netcoreapp3.1|2.25μs|1.61ns|6.03ns|0.0224| 0|0|1.64 KB| |#6041|`EnrichedLog`|net472|2.73μs|0.626ns|2.34ns|0.25| 0|0|1.57 KB|
Benchmarks.Trace.Log4netBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark: ### Raw results | Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | |---------|---------------------------- |-------------- |---------:|---------:|--------:|-------:|------:|------:|----------:| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`EnrichedLog`|net6.0|118μs|206ns|797ns|0.0582| 0|0|4.28 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`EnrichedLog`|netcoreapp3.1|121μs|190ns|712ns|0| 0|0|4.28 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`EnrichedLog`|net472|152μs|170ns|660ns|0.677| 0.226|0|4.46 KB| |#6041|`EnrichedLog`|net6.0|118μs|155ns|559ns|0.0598| 0|0|4.28 KB| |#6041|`EnrichedLog`|netcoreapp3.1|123μs|129ns|498ns|0| 0|0|4.28 KB| |#6041|`EnrichedLog`|net472|152μs|237ns|917ns|0.679| 0.226|0|4.46 KB|
Benchmarks.Trace.NLogBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark: ### Raw results | Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | |---------|---------------------------- |-------------- |---------:|---------:|--------:|-------:|------:|------:|----------:| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`EnrichedLog`|net6.0|3.04μs|2.33ns|9.02ns|0.0304| 0|0|2.2 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`EnrichedLog`|netcoreapp3.1|4.32μs|2.58ns|9.98ns|0.0281| 0|0|2.2 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`EnrichedLog`|net472|4.93μs|8.04ns|31.1ns|0.318| 0|0|2.02 KB| |#6041|`EnrichedLog`|net6.0|3.08μs|0.761ns|2.95ns|0.0294| 0|0|2.2 KB| |#6041|`EnrichedLog`|netcoreapp3.1|4.26μs|1.67ns|6.48ns|0.0297| 0|0|2.2 KB| |#6041|`EnrichedLog`|net472|4.94μs|1.07ns|4.01ns|0.32| 0|0|2.02 KB|
Benchmarks.Trace.RedisBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark: ### Raw results | Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | |---------|---------------------------- |-------------- |---------:|---------:|--------:|-------:|------:|------:|----------:| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`SendReceive`|net6.0|1.45μs|0.623ns|2.41ns|0.0159| 0|0|1.14 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`SendReceive`|netcoreapp3.1|1.76μs|0.624ns|2.33ns|0.0151| 0|0|1.14 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`SendReceive`|net472|2.09μs|1.39ns|5.37ns|0.183| 0.00104|0|1.16 KB| |#6041|`SendReceive`|net6.0|1.39μs|0.525ns|1.96ns|0.016| 0|0|1.14 KB| |#6041|`SendReceive`|netcoreapp3.1|1.73μs|0.554ns|2.07ns|0.0155| 0|0|1.14 KB| |#6041|`SendReceive`|net472|2.14μs|1.84ns|6.89ns|0.183| 0.00107|0|1.16 KB|
Benchmarks.Trace.SerilogBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark: ### Raw results | Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | |---------|---------------------------- |-------------- |---------:|---------:|--------:|-------:|------:|------:|----------:| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`EnrichedLog`|net6.0|2.8μs|1.09ns|4.22ns|0.0224| 0|0|1.6 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`EnrichedLog`|netcoreapp3.1|3.86μs|1.62ns|6.29ns|0.0213| 0|0|1.65 KB| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`EnrichedLog`|net472|4.6μs|2.89ns|11.2ns|0.323| 0|0|2.04 KB| |#6041|`EnrichedLog`|net6.0|3.04μs|1.26ns|4.56ns|0.0212| 0|0|1.6 KB| |#6041|`EnrichedLog`|netcoreapp3.1|4.06μs|2.8ns|10.9ns|0.0223| 0|0|1.65 KB| |#6041|`EnrichedLog`|net472|4.42μs|3.13ns|11.7ns|0.322| 0|0|2.04 KB|
Benchmarks.Trace.SpanBenchmark - Slower :warning: Same allocations :heavy_check_mark: #### Slower :warning: in #6041 | Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality | |:----------|-----------:|-----------:|--------:|--------:| | Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 | 1.204 | 399.98 | 481.52 | #### Faster :tada: in #6041 | Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality | |:----------|-----------:|-----------:|--------:|--------:| | Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 | 1.135 | 557.61 | 491.38 | ### Raw results | Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | |---------|---------------------------- |-------------- |---------:|---------:|--------:|-------:|------:|------:|----------:| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`StartFinishSpan`|net6.0|400ns|0.175ns|0.655ns|0.00807| 0|0|576 B| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`StartFinishSpan`|netcoreapp3.1|595ns|0.31ns|1.16ns|0.00798| 0|0|576 B| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`StartFinishSpan`|net472|667ns|0.434ns|1.62ns|0.0916| 0|0|578 B| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`StartFinishScope`|net6.0|558ns|0.48ns|1.86ns|0.00976| 0|0|696 B| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`StartFinishScope`|netcoreapp3.1|737ns|0.788ns|3.05ns|0.0093| 0|0|696 B| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`StartFinishScope`|net472|851ns|0.757ns|2.83ns|0.104| 0|0|658 B| |#6041|`StartFinishSpan`|net6.0|482ns|0.16ns|0.598ns|0.008| 0|0|576 B| |#6041|`StartFinishSpan`|netcoreapp3.1|617ns|0.827ns|3.2ns|0.00792| 0|0|576 B| |#6041|`StartFinishSpan`|net472|704ns|0.303ns|1.17ns|0.0916| 0|0|578 B| |#6041|`StartFinishScope`|net6.0|492ns|0.216ns|0.838ns|0.00965| 0|0|696 B| |#6041|`StartFinishScope`|netcoreapp3.1|732ns|1.37ns|5.31ns|0.00951| 0|0|696 B| |#6041|`StartFinishScope`|net472|888ns|0.906ns|3.51ns|0.104| 0|0|658 B|
Benchmarks.Trace.TraceAnnotationsBenchmark - Slower :warning: Same allocations :heavy_check_mark: #### Slower :warning: in #6041 | Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality | |:----------|-----------:|-----------:|--------:|--------:| | Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 | 1.150 | 593.66 | 682.98 | ### Raw results | Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | |---------|---------------------------- |-------------- |---------:|---------:|--------:|-------:|------:|------:|----------:| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`RunOnMethodBegin`|net6.0|594ns|0.286ns|1.11ns|0.00978| 0|0|696 B| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`RunOnMethodBegin`|netcoreapp3.1|949ns|1.54ns|5.78ns|0.00934| 0|0|696 B| |[master](https://github.com/DataDog/dd-trace-dotnet/tree/09cb0f4889795973dcfd5f676e3ba3496e4bc9a5)|`RunOnMethodBegin`|net472|1.15μs|0.353ns|1.37ns|0.104| 0|0|658 B| |#6041|`RunOnMethodBegin`|net6.0|682ns|0.751ns|2.91ns|0.00984| 0|0|696 B| |#6041|`RunOnMethodBegin`|netcoreapp3.1|906ns|0.853ns|3.31ns|0.00939| 0|0|696 B| |#6041|`RunOnMethodBegin`|net472|1.15μs|0.492ns|1.77ns|0.104| 0|0|658 B|
bouwkast commented 1 month ago

Could you fill out the PR description?

agocs commented 1 month ago

@bouwkast Yep! My mistake

agocs commented 1 month ago

Figuring out the null references in the tests...

agocs commented 1 month ago

OK I worked it out. WebHeadersCollection.GetValues returns null if the header doesn't exist, and ParseUtil.ParseUInt64 can't handle that.

agocs commented 1 month ago

/merge

dd-devflow[bot] commented 1 month ago

:steam_locomotive: MergeQueue: waiting for PR to be ready

This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals. Note: if you pushed new commits since the last approval, you may need additional approval. You can remove it from the waiting list with /remove command.

Use /merge -c to cancel this operation!

agocs commented 1 month ago

/remove

dd-devflow[bot] commented 1 month ago

:steam_locomotive: Devflow: /remove

dd-devflow[bot] commented 1 month ago

:warning: MergeQueue: This merge request was unqueued

This merge request was unqueued

If you need support, contact us on Slack #devflow!

agocs commented 1 month ago

I cherry-picked from this branch back into this branch 🤦. I think no damage was done

github-actions[bot] commented 1 month ago

Snapshots difference summary

The following differences have been observed in committed snapshots. It is meant to help the reviewer. The diff is simplistic, so please check some files anyway while we improve it.

7 occurrences of :

-      process_id: 0,
-      _dd.top_level: 1.0,
-      _dd.tracer_kr: 1.0,
-      _sampling_priority_v1: 1.0
+      _dd.top_level: 1.0

1 occurrences of :

+  },
+  {
+    TraceId: Id_19,
+    SpanId: Id_20,
+    Name: placeholder-operation,
+    Resource: placeholder-operation,
+    Service: placeholder-service,
+    Tags: {
+      language: dotnet,
+      runtime-id: Guid_10,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_21,
+    SpanId: Id_22,
+    Name: placeholder-operation,
+    Resource: placeholder-operation,
+    Service: placeholder-service,
+    Tags: {
+      language: dotnet,
+      runtime-id: Guid_11,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_23,
+    SpanId: Id_24,
+    Name: placeholder-operation,
+    Resource: placeholder-operation,
+    Service: placeholder-service,
+    Tags: {
+      language: dotnet,
+      runtime-id: Guid_12,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_29,
+    SpanId: Id_30,
+    Name: placeholder-operation,
+    Resource: placeholder-operation,
+    Service: placeholder-service,
+    Tags: {
+      language: dotnet,
+      runtime-id: Guid_15,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_53,
+    SpanId: Id_54,
+    Name: placeholder-operation,
+    Resource: placeholder-operation,
+    Service: placeholder-service,
+    Error: 1,
+    Tags: {
+      error.msg: Cannot assign requested address,
+      error.stack: Cannot assign requested address (SocketException),
+      error.type: System.Net.WebException,
+      language: dotnet,
+      runtime-id: Guid_27,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_55,
+    SpanId: Id_56,
+    Name: placeholder-operation,
+    Resource: placeholder-operation,
+    Service: placeholder-service,
+    Error: 1,
+    Tags: {
+      error.msg: Cannot assign requested address,
+      error.stack: Cannot assign requested address (SocketException),
+      error.type: System.Net.WebException,
+      language: dotnet,
+      runtime-id: Guid_28,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_57,
+    SpanId: Id_58,
+    Name: placeholder-operation,
+    Resource: placeholder-operation,
+    Service: placeholder-service,
+    Error: 1,
+    Tags: {
+      error.msg: Cannot assign requested address,
+      error.stack: Cannot assign requested address (SocketException),
+      error.type: System.Net.WebException,
+      language: dotnet,
+      runtime-id: Guid_29,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }