Skip to content

Use agent telemetry proxy instead of the standalone telemetry#6324

Merged
andrewlock merged 1 commit into
masterfrom
andrew/ci/fix-http-tests
Nov 20, 2024
Merged

Use agent telemetry proxy instead of the standalone telemetry#6324
andrewlock merged 1 commit into
masterfrom
andrew/ci/fix-http-tests

Conversation

@andrewlock

Copy link
Copy Markdown
Member

Summary of changes

Use the agent proxy instead of the standalone telemetry in the HttpMessageHandlerTests

Reason for change

Currently (after updating the VM images) the non-socket handler tests fail due to a lack of telemetry. I really don't understand how or why - the logs show that we are successfully sending telemetry somewhere 😬 Will investigate that in parallel.

Note also, this only impacts alpine with .NET Core 2.1, 3.0, and 3.1. Debian or .NET 5+ are unaffected 🤷‍♂️

Implementation details

Switched to using the agent proxy for telemetry (and added some missing extension helpers to the helper)

Test coverage

The same really, there's no reason we need to use the external telemetry proxy for these tests.

Other details

Will follow up once we have more details. Hopefully this will finally unblock the builds

For some reason, this causes "issues" with the tests that use the Curl handler, in that no telemetry is received
@andrewlock andrewlock added the area:tests unit tests, integration tests label Nov 20, 2024
@andrewlock
andrewlock requested review from a team as code owners November 20, 2024 11:16
@datadog-ddstaging

datadog-ddstaging Bot commented Nov 20, 2024

Copy link
Copy Markdown

Datadog Report

Branch report: andrew/ci/fix-http-tests
Commit report: 200c76c
Test service: dd-trace-dotnet

❌ 1 Failed (1 Known Flaky), 451957 Passed, 2654 Skipped, 18h 50m 45.2s Total Time

❌ Failed Tests (1)

  • ManualAndAutomatic - Datadog.Trace.ClrProfiler.IntegrationTests.ManualInstrumentationTests - ❄️ Known flaky - Details

    Expand for error
     Results do not match.
     Differences:
     Received: ManualInstrumentationTests.ManualAndAutomatic.received.txt
     Verified: ManualInstrumentationTests.ManualAndAutomatic.verified.txt
     Received Content:
     [
       {
         TraceId: Id_1,
         SpanId: Id_2,
         Name: initial,
     ...
    

@dromanol dromanol left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great :)

@andrewlock

Copy link
Copy Markdown
Member Author

Execution-Time Benchmarks Report ⏱️

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:

  • 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).

gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6324) - mean (72ms)  : 63, 80
     .   : milestone, 72,
    master - mean (72ms)  : 64, 80
     .   : milestone, 72,

    section CallTarget+Inlining+NGEN
    This PR (6324) - mean (1,112ms)  : 1094, 1130
     .   : milestone, 1112,
    master - mean (1,107ms)  : 1085, 1128
     .   : milestone, 1107,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6324) - mean (109ms)  : 106, 111
     .   : milestone, 109,
    master - mean (108ms)  : 106, 110
     .   : milestone, 108,

    section CallTarget+Inlining+NGEN
    This PR (6324) - mean (768ms)  : 753, 783
     .   : milestone, 768,
    master - mean (771ms)  : 757, 785
     .   : milestone, 771,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6324) - mean (92ms)  : 90, 95
     .   : milestone, 92,
    master - mean (92ms)  : 90, 93
     .   : milestone, 92,

    section CallTarget+Inlining+NGEN
    This PR (6324) - mean (728ms)  : 714, 742
     .   : milestone, 728,
    master - mean (726ms)  : 707, 745
     .   : milestone, 726,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6324) - mean (192ms)  : 185, 199
     .   : milestone, 192,
    master - mean (191ms)  : 186, 195
     .   : milestone, 191,

    section CallTarget+Inlining+NGEN
    This PR (6324) - mean (1,214ms)  : 1194, 1234
     .   : milestone, 1214,
    master - mean (1,213ms)  : 1190, 1236
     .   : milestone, 1213,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6324) - mean (277ms)  : 273, 281
     .   : milestone, 277,
    master - mean (276ms)  : 271, 281
     .   : milestone, 276,

    section CallTarget+Inlining+NGEN
    This PR (6324) - mean (947ms)  : 930, 965
     .   : milestone, 947,
    master - mean (948ms)  : 929, 967
     .   : milestone, 948,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6324) - mean (265ms)  : 261, 270
     .   : milestone, 265,
    master - mean (265ms)  : 261, 270
     .   : milestone, 265,

    section CallTarget+Inlining+NGEN
    This PR (6324) - mean (932ms)  : 911, 952
     .   : milestone, 932,
    master - mean (931ms)  : 913, 950
     .   : milestone, 931,

Loading

@andrewlock

Copy link
Copy Markdown
Member Author

Benchmarks Report for tracer 🐌

Benchmarks for #6324 compared to master:

  • 3 benchmarks are slower, with geometric mean 1.156
  • All benchmarks have the same 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 ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 7.96μs 45ns 318ns 0.0118 0.00393 0 5.61 KB
master StartStopWithChild netcoreapp3.1 10.1μs 55.7ns 315ns 0.0195 0.00973 0 5.8 KB
master StartStopWithChild net472 16.1μs 50ns 187ns 1.04 0.294 0.103 6.21 KB
#6324 StartStopWithChild net6.0 8.03μs 41.2ns 244ns 0.0165 0.00824 0 5.61 KB
#6324 StartStopWithChild netcoreapp3.1 10.2μs 51ns 222ns 0.0241 0.00482 0 5.81 KB
#6324 StartStopWithChild net472 16.3μs 57ns 221ns 1.06 0.315 0.097 6.21 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 479μs 354ns 1.37μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 672μs 664ns 2.48μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 863μs 545ns 1.97μs 0.431 0 0 3.3 KB
#6324 WriteAndFlushEnrichedTraces net6.0 481μs 241ns 902ns 0 0 0 2.7 KB
#6324 WriteAndFlushEnrichedTraces netcoreapp3.1 664μs 944ns 3.53μs 0 0 0 2.7 KB
#6324 WriteAndFlushEnrichedTraces net472 872μs 418ns 1.62μs 0.434 0 0 3.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 216μs 1.38μs 13.6μs 0.197 0 0 18.73 KB
master SendRequest netcoreapp3.1 237μs 1.69μs 16.8μs 0.227 0 0 20.89 KB
master SendRequest net472 0.00128ns 0.000428ns 0.00154ns 0 0 0 0 b
#6324 SendRequest net6.0 200μs 1.07μs 8.15μs 0.215 0 0 18.73 KB
#6324 SendRequest netcoreapp3.1 218μs 1.23μs 8.64μs 0.22 0 0 20.89 KB
#6324 SendRequest net472 0.00114ns 0.000613ns 0.00229ns 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 595μs 3.13μs 18.5μs 0.587 0 0 41.76 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 679μs 3.08μs 11.5μs 0.349 0 0 41.66 KB
master WriteAndFlushEnrichedTraces net472 858μs 3.57μs 13.8μs 8.33 2.5 0.417 53.34 KB
#6324 WriteAndFlushEnrichedTraces net6.0 576μs 3.07μs 16.5μs 0.587 0 0 41.66 KB
#6324 WriteAndFlushEnrichedTraces netcoreapp3.1 680μs 3.3μs 13.2μs 0.324 0 0 41.82 KB
#6324 WriteAndFlushEnrichedTraces net472 874μs 4.22μs 16.9μs 8.39 2.52 0.419 53.3 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.37μs 1.08ns 4.05ns 0.0141 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.7μs 1.17ns 4.55ns 0.0135 0 0 1.02 KB
master ExecuteNonQuery net472 2.06μs 1.65ns 6.39ns 0.156 0.00103 0 987 B
#6324 ExecuteNonQuery net6.0 1.25μs 1.15ns 4.47ns 0.0145 0 0 1.02 KB
#6324 ExecuteNonQuery netcoreapp3.1 1.79μs 0.979ns 3.79ns 0.0137 0 0 1.02 KB
#6324 ExecuteNonQuery net472 2.05μs 2.42ns 9.04ns 0.157 0.00102 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.13μs 0.736ns 2.75ns 0.0136 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.59μs 0.774ns 3ns 0.0128 0 0 976 B
master CallElasticsearch net472 2.51μs 2.8ns 10.8ns 0.158 0 0 995 B
master CallElasticsearchAsync net6.0 1.27μs 0.629ns 2.35ns 0.0134 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.64μs 0.86ns 3.33ns 0.0139 0 0 1.02 KB
master CallElasticsearchAsync net472 2.6μs 2.22ns 8.61ns 0.167 0 0 1.05 KB
#6324 CallElasticsearch net6.0 1.23μs 0.594ns 2.22ns 0.0135 0 0 976 B
#6324 CallElasticsearch netcoreapp3.1 1.52μs 1.7ns 6.58ns 0.0135 0 0 976 B
#6324 CallElasticsearch net472 2.65μs 2.78ns 10.8ns 0.158 0 0 995 B
#6324 CallElasticsearchAsync net6.0 1.25μs 0.665ns 2.58ns 0.0132 0 0 952 B
#6324 CallElasticsearchAsync netcoreapp3.1 1.69μs 1.03ns 3.84ns 0.0136 0 0 1.02 KB
#6324 CallElasticsearchAsync net472 2.66μs 1.91ns 7.4ns 0.166 0 0 1.05 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.23μs 0.961ns 3.72ns 0.0134 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.66μs 1.06ns 4.11ns 0.0133 0 0 952 B
master ExecuteAsync net472 1.82μs 1.88ns 7.27ns 0.145 0 0 915 B
#6324 ExecuteAsync net6.0 1.19μs 0.572ns 2.14ns 0.013 0 0 952 B
#6324 ExecuteAsync netcoreapp3.1 1.62μs 0.934ns 3.49ns 0.013 0 0 952 B
#6324 ExecuteAsync net472 1.86μs 0.362ns 1.35ns 0.145 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 4.47μs 2.75ns 10.3ns 0.0317 0 0 2.31 KB
master SendAsync netcoreapp3.1 5.32μs 2.88ns 11.1ns 0.0373 0 0 2.85 KB
master SendAsync net472 7.25μs 3.7ns 14.3ns 0.495 0 0 3.12 KB
#6324 SendAsync net6.0 4.32μs 1.38ns 5.33ns 0.0323 0 0 2.31 KB
#6324 SendAsync netcoreapp3.1 5.33μs 2.37ns 9.17ns 0.0374 0 0 2.85 KB
#6324 SendAsync net472 7.44μs 2.52ns 9.76ns 0.494 0 0 3.12 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 1.57μs 0.661ns 2.47ns 0.0227 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.17μs 1.4ns 5.04ns 0.0218 0 0 1.64 KB
master EnrichedLog net472 2.62μs 1.51ns 5.86ns 0.249 0 0 1.57 KB
#6324 EnrichedLog net6.0 1.45μs 1.05ns 3.92ns 0.0228 0 0 1.64 KB
#6324 EnrichedLog netcoreapp3.1 2.35μs 1.01ns 3.79ns 0.0222 0 0 1.64 KB
#6324 EnrichedLog net472 2.44μs 1.23ns 4.77ns 0.249 0 0 1.57 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 119μs 266ns 1.03μs 0 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 124μs 281ns 1.09μs 0 0 0 4.28 KB
master EnrichedLog net472 151μs 100ns 387ns 0.676 0.225 0 4.46 KB
#6324 EnrichedLog net6.0 121μs 138ns 534ns 0 0 0 4.28 KB
#6324 EnrichedLog netcoreapp3.1 124μs 131ns 490ns 0 0 0 4.28 KB
#6324 EnrichedLog net472 151μs 193ns 747ns 0.676 0.225 0 4.46 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 3.17μs 1.81ns 6.99ns 0.0297 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.35μs 1.45ns 5.62ns 0.0283 0 0 2.2 KB
master EnrichedLog net472 4.83μs 1.52ns 5.9ns 0.319 0 0 2.02 KB
#6324 EnrichedLog net6.0 2.92μs 0.563ns 2.11ns 0.0314 0 0 2.2 KB
#6324 EnrichedLog netcoreapp3.1 4.22μs 1.68ns 6.29ns 0.0294 0 0 2.2 KB
#6324 EnrichedLog net472 4.81μs 2.31ns 8.96ns 0.318 0 0 2.02 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 1.31μs 0.65ns 2.43ns 0.0157 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.79μs 0.661ns 2.47ns 0.0151 0 0 1.14 KB
master SendReceive net472 2.04μs 1.01ns 3.79ns 0.183 0 0 1.16 KB
#6324 SendReceive net6.0 1.36μs 0.84ns 3.25ns 0.0156 0 0 1.14 KB
#6324 SendReceive netcoreapp3.1 1.71μs 0.767ns 2.87ns 0.0154 0 0 1.14 KB
#6324 SendReceive net472 2.04μs 0.876ns 3.39ns 0.183 0 0 1.16 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 2.76μs 1.2ns 4.64ns 0.022 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.99μs 3.27ns 12.7ns 0.0218 0 0 1.65 KB
master EnrichedLog net472 4.37μs 2.59ns 10ns 0.322 0 0 2.04 KB
#6324 EnrichedLog net6.0 2.76μs 1.26ns 4.87ns 0.0221 0 0 1.6 KB
#6324 EnrichedLog netcoreapp3.1 3.9μs 3.16ns 12.2ns 0.0216 0 0 1.65 KB
#6324 EnrichedLog net472 4.35μs 3.38ns 12.6ns 0.322 0 0 2.04 KB
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #6324

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 1.193 492.96 588.14
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑netcoreapp3.1 1.149 653.83 751.34
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 1.126 566.57 637.94

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 405ns 0.665ns 2.57ns 0.00806 0 0 576 B
master StartFinishSpan netcoreapp3.1 566ns 0.73ns 2.83ns 0.00792 0 0 576 B
master StartFinishSpan net472 672ns 0.909ns 3.52ns 0.0916 0 0 578 B
master StartFinishScope net6.0 493ns 0.611ns 2.37ns 0.00982 0 0 696 B
master StartFinishScope netcoreapp3.1 654ns 1.08ns 4.2ns 0.00954 0 0 696 B
master StartFinishScope net472 913ns 0.51ns 1.98ns 0.104 0 0 658 B
#6324 StartFinishSpan net6.0 397ns 0.479ns 1.86ns 0.00814 0 0 576 B
#6324 StartFinishSpan netcoreapp3.1 637ns 1.24ns 4.8ns 0.0078 0 0 576 B
#6324 StartFinishSpan net472 700ns 0.466ns 1.8ns 0.0915 0 0 578 B
#6324 StartFinishScope net6.0 588ns 0.731ns 2.83ns 0.00982 0 0 696 B
#6324 StartFinishScope netcoreapp3.1 747ns 3.52ns 13.6ns 0.00929 0 0 696 B
#6324 StartFinishScope net472 861ns 0.702ns 2.72ns 0.105 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 591ns 0.63ns 2.44ns 0.0096 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 947ns 1.12ns 4.34ns 0.00945 0 0 696 B
master RunOnMethodBegin net472 1.16μs 2.46ns 9.54ns 0.104 0 0 658 B
#6324 RunOnMethodBegin net6.0 603ns 0.266ns 1.03ns 0.0097 0 0 696 B
#6324 RunOnMethodBegin netcoreapp3.1 927ns 0.972ns 3.76ns 0.0094 0 0 696 B
#6324 RunOnMethodBegin net472 1.17μs 0.873ns 3.38ns 0.104 0 0 658 B

@andrewlock
andrewlock merged commit 0897e58 into master Nov 20, 2024
@andrewlock
andrewlock deleted the andrew/ci/fix-http-tests branch November 20, 2024 13:28
@github-actions github-actions Bot added this to the vNext-v3 milestone Nov 20, 2024
andrewlock added a commit that referenced this pull request Nov 25, 2024
## Summary of changes

Fix the telemetry issues we saw after updating the VMs recently

## Reason for change

We updated the VMs and suddenly .NET Core <=3.1 started failing on
alpine when we used the "standalone telemetry agent", only when using
the "curl" handler (not the socket handler).

We eventually traced it down to the fact we were setting the url to
`localhost`, not `127.0.0.1` as we do elsewhere. Presumably an update to
the underlying libcurl caused it to choose the IPv6 address, which the
listener is not bound to, causing telemetry to fail

## Implementation details

- Reverted the change in
#6324
- `localhost` -> `127.0.0.1` in the `TelemetryHelper`

## Test coverage

The same

## Other details

Reverting the change isn't necessary obviously, but it shows that we
fixed it.
veerbia pushed a commit that referenced this pull request Dec 16, 2024
## Summary of changes

Fix the telemetry issues we saw after updating the VMs recently

## Reason for change

We updated the VMs and suddenly .NET Core <=3.1 started failing on
alpine when we used the "standalone telemetry agent", only when using
the "curl" handler (not the socket handler).

We eventually traced it down to the fact we were setting the url to
`localhost`, not `127.0.0.1` as we do elsewhere. Presumably an update to
the underlying libcurl caused it to choose the IPv6 address, which the
listener is not bound to, causing telemetry to fail

## Implementation details

- Reverted the change in
#6324
- `localhost` -> `127.0.0.1` in the `TelemetryHelper`

## Test coverage

The same

## Other details

Reverting the change isn't necessary obviously, but it shows that we
fixed it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tests unit tests, integration tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants