Skip to content

Fix broken parenting when Ocelot API Gateway is used#8128

Open
bouwkast wants to merge 13 commits intomasterfrom
steven/ocelot-instrumentation
Open

Fix broken parenting when Ocelot API Gateway is used#8128
bouwkast wants to merge 13 commits intomasterfrom
steven/ocelot-instrumentation

Conversation

@bouwkast
Copy link
Copy Markdown
Collaborator

@bouwkast bouwkast commented Feb 2, 2026

Mostly generated by claude with a lot of handholding

Summary of changes

Add auto-instrumentation for Ocelot API gateway to fix broken distributed traces when Ocelot is used with DD_TRACE_OTEL_ENABLED and OpenTelemetry.Instrumentation.Http is used.

Reason for change

When customers use Ocelot v23.0.0+ alongside the OpenTelemetry.Instrumentation.Http NuGet package, distributed traces break. Ocelot creates a SocketsHttpHandler with a default ActivityHeadersPropagator (this is normal behavior), which causes DiagnosticsHandler to be added to the handler chain. When the OpenTelemetry HTTP instrumentation is registered, it subscribes to the DiagnosticSource events from DiagnosticsHandler and injects its own trace context headers into downstream requests which overwrites the x-datadog-* / W3C traceparent headers already set by our HttpClient instrumentation.

Without the OpenTelemetry HTTP instrumentation NuGet installed, the DiagnosticsHandler Activity events have no subscriber to inject competing headers, so the issue does not occur.

For customers this results in broken parenting for traces/spans.

Implementation details

  • OcelotMessageInvokerPoolIntegration: Instruments Ocelot.Requester.MessageInvokerPool.CreateHandler to set ActivityHeadersPropagator = null on the returned SocketsHttpHandler, preventing DiagnosticsHandler from being added to the handler chain.
    • Two [InstrumentMethod] attributes handle the return type change between versions:
      • v23.0.0–24.0.*: returns HttpMessageHandler
      • v24.1.0–24..: returns SocketsHttpHandler

Note: YARP needs to be updated as well from CreateNoOutputPropagator() to null I'll do this in a follow up

Test coverage

  • Added a sample application Samples.Ocelot.DistributedTracing that has Ocelot configured as a reverse proxy and OpenTelemetry.Instrumentation.Http installed and setup. Note that not having OpenTelemetry.Instrumentation.Http causes it to not re-produce.
  • Tests are added in OcelotDistributedTracingTests which follow the same pattern as the YARP tests
  • Added snapshot, note that there are a couple of commits here where I removed the fix, saved the snapshot (broken) and then re-ran the snapshots. This is just to showcase the before/after

Other details

Supported Ocelot versions: 23.0.0 to 24.*
Earlier versions do not have the same behavior as HttpMessageHandler was introduced first in 23 and then changed to SocketsHttpHandler in 24.

@bouwkast bouwkast added the AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos label Feb 2, 2026
@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Feb 2, 2026

Benchmarks

Benchmark execution time: 2026-04-27 13:32:01

Comparing candidate commit eff04e0 in PR branch steven/ocelot-instrumentation with baseline commit ccd344f in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 27 metrics, 0 unstable metrics, 61 known flaky benchmarks, 26 flaky benchmarks without significant changes.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Known flaky benchmarks

These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net6.0

  • 🟩 throughput [+8753.137op/s; +11009.423op/s] or [+7.357%; +9.254%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 execution_time [+317.549ms; +321.765ms] or [+157.579%; +159.671%]
  • 🟥 throughput [-41.912op/s; -38.262op/s] or [-7.541%; -6.884%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • 🟥 execution_time [+381.346ms; +383.584ms] or [+301.287%; +303.055%]
  • 🟩 throughput [+88.420op/s; +92.195op/s] or [+11.658%; +12.156%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 execution_time [+395.067ms; +396.641ms] or [+349.619%; +351.012%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net472

  • 🟥 allocated_mem [+1.308KB; +1.308KB] or [+27.529%; +27.541%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net6.0

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+9.977%; +9.987%]
  • 🟩 execution_time [-15.691ms; -11.502ms] or [-7.328%; -5.372%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody netcoreapp3.1

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+27.502%; +27.510%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net472

  • 🟥 allocated_mem [+1.307KB; +1.307KB] or [+105.746%; +105.759%]
  • 🟥 throughput [-267021.817op/s; -263452.681op/s] or [-27.264%; -26.900%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net6.0

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+38.558%; +38.566%]
  • 🟩 execution_time [-26.013ms; -21.122ms] or [-11.601%; -9.419%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+105.292%; +105.304%]
  • 🟥 throughput [-138733.845op/s; -122725.048op/s] or [-19.933%; -17.633%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net6.0

  • 🟩 throughput [+9403.794op/s; +12369.657op/s] or [+5.983%; +7.871%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody netcoreapp3.1

  • 🟩 throughput [+7356.523op/s; +9992.640op/s] or [+5.860%; +7.960%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net6.0

  • 🟩 throughput [+331574.521op/s; +360789.228op/s] or [+11.056%; +12.030%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody netcoreapp3.1

  • 🟩 execution_time [-19.339ms; -14.970ms] or [-8.914%; -6.901%]
  • 🟩 throughput [+184351.114op/s; +238281.544op/s] or [+7.317%; +9.458%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net472

  • 🟥 execution_time [+299.944ms; +300.499ms] or [+149.872%; +150.149%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net6.0

  • 🟥 execution_time [+299.453ms; +302.568ms] or [+151.015%; +152.586%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs netcoreapp3.1

  • 🟥 execution_time [+300.548ms; +303.205ms] or [+151.393%; +152.731%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net472

  • 🟥 execution_time [+295.959ms; +296.752ms] or [+145.364%; +145.753%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net6.0

  • 🟥 execution_time [+295.829ms; +298.554ms] or [+144.620%; +145.952%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs netcoreapp3.1

  • 🟥 execution_time [+301.171ms; +302.396ms] or [+150.525%; +151.137%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net6.0

  • 🟥 execution_time [+23.139µs; +50.781µs] or [+5.307%; +11.647%]
  • 🟥 throughput [-244.204op/s; -121.565op/s] or [-10.617%; -5.285%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net6.0

  • 🟥 execution_time [+23.322µs; +46.979µs] or [+7.446%; +14.998%]
  • 🟥 throughput [-436.032op/s; -237.016op/s] or [-13.592%; -7.388%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+299.980ms; +300.631ms] or [+149.721%; +150.046%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net6.0

  • 🟥 execution_time [+411.209ms; +415.777ms] or [+446.796%; +451.759%]
  • 🟩 throughput [+1146.182op/s; +1282.167op/s] or [+9.418%; +10.536%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest netcoreapp3.1

  • unstable execution_time [+231.697ms; +278.104ms] or [+175.926%; +211.162%]
  • 🟩 throughput [+561.236op/s; +768.660op/s] or [+5.433%; +7.441%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [+327.083ms; +362.936ms] or [+150.390%; +166.875%]
  • 🟥 throughput [-520.400op/s; -483.187op/s] or [-47.153%; -43.781%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • unstable execution_time [+206.220ms; +339.435ms] or [+87.882%; +144.653%]
  • 🟥 throughput [-667.653op/s; -584.122op/s] or [-44.533%; -38.961%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 execution_time [+335.643ms; +343.601ms] or [+200.753%; +205.513%]
  • 🟥 throughput [-392.524op/s; -357.296op/s] or [-27.331%; -24.878%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1

  • 🟩 throughput [+17.474op/s; +44.155op/s] or [+5.023%; +12.692%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net6.0

  • 🟩 execution_time [-142.026µs; -102.730µs] or [-7.195%; -5.204%]
  • 🟩 throughput [+29.782op/s; +39.922op/s] or [+5.879%; +7.881%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 execution_time [+300.851ms; +302.573ms] or [+151.503%; +152.370%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net6.0

  • 🟥 execution_time [+301.823ms; +303.381ms] or [+151.244%; +152.025%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch netcoreapp3.1

  • 🟥 execution_time [+302.084ms; +305.120ms] or [+151.754%; +153.279%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 execution_time [+302.362ms; +303.890ms] or [+151.836%; +152.603%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net6.0

  • 🟥 execution_time [+298.341ms; +299.863ms] or [+147.516%; +148.269%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync netcoreapp3.1

  • 🟥 execution_time [+301.365ms; +305.224ms] or [+152.745%; +154.701%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 execution_time [+300.676ms; +301.789ms] or [+150.912%; +151.471%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net6.0

  • 🟥 execution_time [+301.150ms; +303.602ms] or [+150.096%; +151.318%]
  • 🟩 throughput [+41511.020op/s; +47970.535op/s] or [+8.243%; +9.525%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync netcoreapp3.1

  • 🟥 execution_time [+300.325ms; +303.103ms] or [+149.409%; +150.791%]

scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net6.0

  • 🟩 execution_time [-16.186ms; -12.467ms] or [-7.527%; -5.797%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net6.0

  • 🟩 allocated_mem [-19.508KB; -19.487KB] or [-7.116%; -7.108%]
  • unstable execution_time [-39.278µs; +13.453µs] or [-7.763%; +2.659%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1

  • 🟩 allocated_mem [-16.987KB; -16.971KB] or [-6.193%; -6.187%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net6.0

  • unstable execution_time [+9.734µs; +14.099µs] or [+23.008%; +33.325%]
  • 🟥 throughput [-5966.118op/s; -4171.868op/s] or [-25.115%; -17.562%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark netcoreapp3.1

  • unstable execution_time [-13.159µs; -6.015µs] or [-20.416%; -9.332%]
  • 🟩 throughput [+1456.811op/s; +2956.329op/s] or [+8.938%; +18.138%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+302.586ms; +304.308ms] or [+152.944%; +153.814%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net6.0

  • 🟥 execution_time [+300.174ms; +303.561ms] or [+152.788%; +154.512%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 execution_time [+300.415ms; +302.621ms] or [+150.395%; +151.499%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net6.0

  • 🟩 throughput [+28019.204op/s; +34027.736op/s] or [+5.303%; +6.441%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+300.314ms; +301.938ms] or [+149.679%; +150.489%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net6.0

  • 🟥 execution_time [+301.037ms; +302.272ms] or [+151.166%; +151.787%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 execution_time [+302.713ms; +304.780ms] or [+153.517%; +154.565%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+299.659ms; +300.237ms] or [+149.472%; +149.760%]
  • 🟩 throughput [+61141772.294op/s; +61390410.059op/s] or [+44.527%; +44.708%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net6.0

  • unstable execution_time [+326.988ms; +373.192ms] or [+406.668%; +464.130%]
  • 🟩 throughput [+1045.644op/s; +1220.072op/s] or [+8.083%; +9.432%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore netcoreapp3.1

  • 🟥 execution_time [+299.183ms; +300.142ms] or [+149.226%; +149.704%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net6.0

  • 🟩 throughput [+61618.608op/s; +82545.191op/s] or [+5.753%; +7.707%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope netcoreapp3.1

  • 🟩 throughput [+47075.491op/s; +66357.008op/s] or [+5.449%; +7.681%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0

  • 🟩 throughput [+74069.681op/s; +104267.470op/s] or [+5.733%; +8.070%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan netcoreapp3.1

  • 🟩 throughput [+85105.162op/s; +92874.006op/s] or [+8.452%; +9.224%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net6.0

  • 🟩 throughput [+43900.113op/s; +49544.800op/s] or [+7.971%; +8.996%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1

  • 🟩 throughput [+25359.029op/s; +35088.595op/s] or [+5.676%; +7.854%]

scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net6.0

  • 🟩 throughput [+74932.248op/s; +92901.880op/s] or [+8.372%; +10.379%]

Known flaky benchmarks without significant changes:

  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net472
  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net472
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog netcoreapp3.1
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net472
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

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

dd-trace-dotnet-ci-bot Bot commented Feb 2, 2026

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (8128) 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
duration72.88 ± (72.89 - 73.30) ms72.72 ± (72.76 - 73.29) ms-0.2%
.NET Framework 4.8 - Bailout
duration76.43 ± (76.26 - 76.64) ms79.85 ± (79.54 - 80.12) ms+4.5%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1077.21 ± (1076.30 - 1082.73) ms1090.06 ± (1094.01 - 1104.70) ms+1.2%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms22.76 ± (22.68 - 22.84) ms22.88 ± (22.80 - 22.95) ms+0.5%✅⬆️
process.time_to_main_ms86.51 ± (86.15 - 86.87) ms86.92 ± (86.57 - 87.27) ms+0.5%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.92 ± (10.91 - 10.92) MB10.91 ± (10.91 - 10.92) MB-0.0%
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.20 ± (22.17 - 22.23) ms22.47 ± (22.42 - 22.52) ms+1.2%✅⬆️
process.time_to_main_ms85.56 ± (85.36 - 85.76) ms86.54 ± (86.26 - 86.81) ms+1.1%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.90 ± (10.89 - 10.90) MB10.94 ± (10.94 - 10.95) MB+0.4%✅⬆️
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms213.38 ± (212.57 - 214.18) ms212.31 ± (211.33 - 213.29) ms-0.5%
process.time_to_main_ms527.00 ± (525.78 - 528.22) ms527.41 ± (526.20 - 528.62) ms+0.1%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.05 ± (48.02 - 48.08) MB48.00 ± (47.97 - 48.02) MB-0.1%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.9%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms21.56 ± (21.49 - 21.63) ms21.58 ± (21.52 - 21.65) ms+0.1%✅⬆️
process.time_to_main_ms76.58 ± (76.27 - 76.89) ms75.75 ± (75.47 - 76.04) ms-1.1%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.61 ± (10.61 - 10.62) MB10.62 ± (10.62 - 10.62) MB+0.0%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.09 ± (21.06 - 21.13) ms21.44 ± (21.39 - 21.49) ms+1.6%✅⬆️
process.time_to_main_ms74.80 ± (74.59 - 75.01) ms76.33 ± (76.07 - 76.60) ms+2.1%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.73 ± (10.73 - 10.73) MB10.73 ± (10.73 - 10.74) MB+0.0%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms380.20 ± (378.11 - 382.29) ms381.56 ± (379.26 - 383.85) ms+0.4%✅⬆️
process.time_to_main_ms531.27 ± (529.82 - 532.71) ms531.31 ± (530.03 - 532.60) ms+0.0%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed49.21 ± (49.19 - 49.24) MB49.39 ± (49.36 - 49.41) MB+0.3%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.3%
.NET 8 - Baseline
process.internal_duration_ms19.68 ± (19.63 - 19.73) ms19.44 ± (19.40 - 19.48) ms-1.2%
process.time_to_main_ms73.91 ± (73.69 - 74.12) ms72.73 ± (72.59 - 72.87) ms-1.6%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.66 ± (7.65 - 7.66) MB7.67 ± (7.66 - 7.67) MB+0.2%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms20.04 ± (19.99 - 20.10) ms19.78 ± (19.72 - 19.84) ms-1.3%
process.time_to_main_ms77.70 ± (77.41 - 77.98) ms76.70 ± (76.42 - 76.99) ms-1.3%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.70 ± (7.70 - 7.71) MB7.71 ± (7.71 - 7.72) MB+0.1%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms301.90 ± (299.86 - 303.93) ms303.46 ± (301.48 - 305.44) ms+0.5%✅⬆️
process.time_to_main_ms489.52 ± (488.38 - 490.66) ms491.40 ± (490.25 - 492.55) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed36.54 ± (36.52 - 36.56) MB36.49 ± (36.46 - 36.52) MB-0.1%
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)-0.1%

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration201.51 ± (201.83 - 203.08) ms203.98 ± (203.78 - 204.94) ms+1.2%✅⬆️
.NET Framework 4.8 - Bailout
duration206.59 ± (206.27 - 207.35) ms208.26 ± (207.62 - 208.76) ms+0.8%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1195.37 ± (1195.69 - 1202.76) ms1207.11 ± (1205.56 - 1213.25) ms+1.0%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms195.42 ± (194.99 - 195.86) ms198.81 ± (198.20 - 199.43) ms+1.7%✅⬆️
process.time_to_main_ms84.54 ± (84.29 - 84.79) ms86.31 ± (85.97 - 86.65) ms+2.1%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed15.96 ± (15.94 - 15.97) MB16.00 ± (15.99 - 16.02) MB+0.3%✅⬆️
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)+0.1%✅⬆️
.NET Core 3.1 - Bailout
process.internal_duration_ms193.56 ± (193.04 - 194.08) ms198.43 ± (197.82 - 199.03) ms+2.5%✅⬆️
process.time_to_main_ms85.28 ± (85.07 - 85.50) ms87.88 ± (87.54 - 88.22) ms+3.0%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.04 ± (16.03 - 16.06) MB16.03 ± (16.01 - 16.05) MB-0.1%
runtime.dotnet.threads.count21 ± (21 - 21)21 ± (21 - 21)+0.1%✅⬆️
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms385.72 ± (384.34 - 387.10) ms390.35 ± (389.02 - 391.69) ms+1.2%✅⬆️
process.time_to_main_ms525.73 ± (524.36 - 527.09) ms532.93 ± (531.30 - 534.56) ms+1.4%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed57.34 ± (57.13 - 57.56) MB57.83 ± (57.61 - 58.04) MB+0.8%✅⬆️
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)+0.4%✅⬆️
.NET 6 - Baseline
process.internal_duration_ms200.11 ± (199.53 - 200.70) ms204.49 ± (203.86 - 205.13) ms+2.2%✅⬆️
process.time_to_main_ms73.28 ± (73.04 - 73.52) ms75.43 ± (75.15 - 75.71) ms+2.9%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.29 ± (16.27 - 16.31) MB16.20 ± (16.18 - 16.22) MB-0.6%
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.5%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms198.58 ± (198.05 - 199.11) ms202.70 ± (202.13 - 203.27) ms+2.1%✅⬆️
process.time_to_main_ms74.11 ± (73.89 - 74.33) ms76.07 ± (75.80 - 76.35) ms+2.6%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.28 ± (16.27 - 16.30) MB16.27 ± (16.25 - 16.29) MB-0.1%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)+1.2%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms594.04 ± (591.28 - 596.80) ms597.85 ± (595.18 - 600.53) ms+0.6%✅⬆️
process.time_to_main_ms529.98 ± (528.73 - 531.24) ms536.33 ± (534.93 - 537.73) ms+1.2%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed60.72 ± (60.62 - 60.82) MB61.29 ± (61.20 - 61.38) MB+0.9%✅⬆️
runtime.dotnet.threads.count31 ± (31 - 31)31 ± (31 - 31)+0.0%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms198.00 ± (197.41 - 198.60) ms201.38 ± (200.80 - 201.96) ms+1.7%✅⬆️
process.time_to_main_ms72.58 ± (72.35 - 72.81) ms74.25 ± (73.96 - 74.54) ms+2.3%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.62 ± (11.61 - 11.63) MB11.64 ± (11.63 - 11.66) MB+0.2%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)19 ± (19 - 19)+1.2%✅⬆️
.NET 8 - Bailout
process.internal_duration_ms198.33 ± (197.73 - 198.93) ms200.99 ± (200.44 - 201.54) ms+1.3%✅⬆️
process.time_to_main_ms74.33 ± (74.07 - 74.59) ms75.61 ± (75.36 - 75.87) ms+1.7%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.65 ± (11.64 - 11.67) MB11.67 ± (11.66 - 11.69) MB+0.2%✅⬆️
runtime.dotnet.threads.count20 ± (19 - 20)20 ± (19 - 20)+0.2%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms519.54 ± (516.25 - 522.83) ms518.86 ± (515.47 - 522.26) ms-0.1%
process.time_to_main_ms490.90 ± (489.74 - 492.07) ms496.69 ± (495.66 - 497.72) ms+1.2%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed50.30 ± (50.26 - 50.34) MB50.24 ± (50.20 - 50.27) MB-0.1%
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)+0.4%✅⬆️
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 (8128) - mean (73ms)  : 69, 77
    master - mean (73ms)  : 70, 76

    section Bailout
    This PR (8128) - mean (80ms)  : 76, 84
    master - mean (76ms)  : 75, 78

    section CallTarget+Inlining+NGEN
    This PR (8128) - mean (1,099ms)  : 1023, 1176
    master - mean (1,080ms)  : 1033, 1126

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 (8128) - mean (117ms)  : 110, 124
    master - mean (116ms)  : 109, 124

    section Bailout
    This PR (8128) - mean (116ms)  : 110, 122
    master - mean (114ms)  : 112, 117

    section CallTarget+Inlining+NGEN
    This PR (8128) - mean (779ms)  : 748, 809
    master - mean (778ms)  : 748, 809

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8128) - mean (104ms)  : 99, 110
    master - mean (105ms)  : 98, 111

    section Bailout
    This PR (8128) - mean (104ms)  : 99, 110
    master - mean (102ms)  : 98, 107

    section CallTarget+Inlining+NGEN
    This PR (8128) - mean (941ms)  : 896, 985
    master - mean (940ms)  : 902, 978

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8128) - mean (100ms)  : 97, 103
    master - mean (102ms)  : 96, 107

    section Bailout
    This PR (8128) - mean (104ms)  : 99, 110
    master - mean (106ms)  : 100, 112

    section CallTarget+Inlining+NGEN
    This PR (8128) - mean (826ms)  : 789, 862
    master - mean (822ms)  : 788, 856

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 (8128) - mean (204ms)  : 196, 213
    master - mean (202ms)  : 194, 211

    section Bailout
    This PR (8128) - mean (208ms)  : 200, 216
    master - mean (207ms)  : 199, 215

    section CallTarget+Inlining+NGEN
    This PR (8128) - mean (1,209ms)  : 1153, 1266
    master - mean (1,199ms)  : 1148, 1250

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 (8128) - mean (294ms)  : 281, 308
    master - mean (289ms)  : 279, 299

    section Bailout
    This PR (8128) - mean (296ms)  : 282, 309
    master - mean (288ms)  : 279, 298

    section CallTarget+Inlining+NGEN
    This PR (8128) - mean (961ms)  : 932, 989
    master - mean (947ms)  : 923, 972

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8128) - mean (290ms)  : 277, 302
    master - mean (283ms)  : 272, 293

    section Bailout
    This PR (8128) - mean (288ms)  : 275, 302
    master - mean (281ms)  : 271, 291

    section CallTarget+Inlining+NGEN
    This PR (8128) - mean (1,164ms)  : 1133, 1196
    master - mean (1,152ms)  : 1108, 1196

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8128) - mean (287ms)  : 272, 302
    master - mean (282ms)  : 268, 297

    section Bailout
    This PR (8128) - mean (288ms)  : 274, 301
    master - mean (284ms)  : 270, 299

    section CallTarget+Inlining+NGEN
    This PR (8128) - mean (1,050ms)  : 991, 1108
    master - mean (1,046ms)  : 975, 1116

Loading

@bouwkast bouwkast force-pushed the steven/ocelot-instrumentation branch from ae314c0 to 88228c0 Compare February 4, 2026 22:28
@bouwkast bouwkast force-pushed the steven/ocelot-instrumentation branch from b9bec75 to 1547cf8 Compare March 9, 2026 18:25
@bouwkast bouwkast force-pushed the steven/ocelot-instrumentation branch from 1547cf8 to 7d03568 Compare March 16, 2026 19:46
@bouwkast bouwkast changed the title Add Ocelot auto-instrumentation Add Ocelot API gateway auto-instrumentation Mar 16, 2026
@bouwkast bouwkast force-pushed the steven/ocelot-instrumentation branch 2 times, most recently from 2340187 to 6aaa0a6 Compare March 17, 2026 15:31
@bouwkast bouwkast added type:bug area:automatic-instrumentation Automatic instrumentation managed C# code (Datadog.Trace.ClrProfiler.Managed) identified-by:customer labels Mar 17, 2026
@bouwkast bouwkast force-pushed the steven/ocelot-instrumentation branch from 6aaa0a6 to 1ab66fb Compare March 17, 2026 17:49
@bouwkast bouwkast force-pushed the steven/ocelot-instrumentation branch from 1ab66fb to 334375f Compare March 18, 2026 14:35
@bouwkast bouwkast marked this pull request as ready for review March 18, 2026 18:55
@bouwkast bouwkast requested review from a team as code owners March 18, 2026 18:55
@andrewlock
Copy link
Copy Markdown
Member

Earlier versions do not have the same behavior as HttpMessageHandler was introduced first in 23 and then changed to SocketsHttpHandler in 24

So just to confirm, the original issue doesn't repro on earlier versions?

Copy link
Copy Markdown
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.

LGTM, just a couple of minor things:

  • We generally try to cover the full range of supported TFMs, so we should probably support .NET 6+ as Ocelot does
  • Should this be the HttpMessageHandler or a new Ocelot integration?
  • Couple of nits (using the more compact aspnetcore setup, using combinatorial data attr etc for future)

Comment thread tracer/build/PackageVersionsGeneratorDefinitions.json Outdated
Comment thread tracer/build/supported_versions.json Outdated
[EditorBrowsable(EditorBrowsableState.Never)]
public sealed class OcelotMessageInvokerPoolIntegration
{
private const string IntegrationName = nameof(Configuration.IntegrationId.HttpMessageHandler);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this be a new integration, Ocelot, instead of HttpMessageHandler? 🤔 I'm undecided tbh, I get the reasoning.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, this initially was Ocelot but Yarp went with HttpMessageHandler so I just forced Claude to follow that

Honestly I'm not sure what is ideal

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I could probably go both ways, but we aren't really "instrumenting" YARP/Ocelot here (YARP uses HttpMessageHandler as well).

I think based on that and that we are essentially attempting to fix re-parenting issues here not calling it Ocelot is the better representation, but I would say that if for some reason someone needs to disable this re-parenting fix I guess they would ideally want the option to do that without having to disable all of the HttpMessageHandler instrumentation.

Maybe a second PR to update both YARP and this to be controlled by either HttpMessageHandler or their integration name itself?

@bouwkast bouwkast changed the title Add Ocelot API gateway auto-instrumentation Fix broken parenting when Ocelot API Gateway is used Mar 19, 2026
@bouwkast bouwkast force-pushed the steven/ocelot-instrumentation branch from 5cd33a5 to 566fef8 Compare March 20, 2026 13:10
@bouwkast
Copy link
Copy Markdown
Collaborator Author

So just to confirm, the original issue doesn't repro on earlier versions?

Correct I couldn't get it to reproduce in earlier versions

@bouwkast bouwkast force-pushed the steven/ocelot-instrumentation branch from ce38e3e to 780e797 Compare March 24, 2026 15:50
@lucaspimentel
Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@bouwkast bouwkast force-pushed the steven/ocelot-instrumentation branch from 3a108a5 to ae9d877 Compare April 2, 2026 14:54
@bouwkast bouwkast force-pushed the steven/ocelot-instrumentation branch from ae9d877 to a0df7a6 Compare April 10, 2026 17:04
@bouwkast bouwkast force-pushed the steven/ocelot-instrumentation branch from a0df7a6 to 31f994e Compare April 14, 2026 19:41
bouwkast added a commit that referenced this pull request Apr 22, 2026
## Summary of changes

This goes back through the recent changes (#8371 and #8340) to
`GeneratePackageVersions` and attempts to do some removals,
refactorings, and fixes that have come up. Notably this removes the
`nuget_cache`, fixes `IncludePackages` (again 😅), and rewrites the
cooldown logic to not use `supported_versions.json` and `nuget_cache`
and instead reads from the `.g.cs` files in addition to refactoring the
verbage used throughout.

## Reason for change

While working on (#8128) I started running into several issues with
`GeneratePackageVersions` namely that I couldn't get `IncludePackages`
to work and then I started fighting issues with the `nuget_cache` as
well when attempting to add a new integration.

This sets out to do a few things:

- Simplify the logic for NuGet cooldown (automated dependency updates
must adhere to our current cooldown policy for potential supply chain
attacks)
- Remove the `nuget_cache` - this was added so that we wouldn't go and
query NuGet info for packages not listed in the `IncludePackages`
- Change the "verbage" of the cooldown/baseline to be easier to read /
follow
- Do NOT read / rely upon `supported_versions` (this is what I
previously used to determine what the highest version was currently
allowed) - this file is planned to be changed/modified/removed by
another team in the near future hence why we shouldn't use it.
- I didn't account for different timezones in the publish state of the
`nuget_cache` before so if someone ran it depending on their locale it
would change.

## Implementation details

- New `CooldownMode` `enum`: `Normal`, `BypassCooldown`, `Freeze`
  - Normal drops recent versions that are above the previous max
- BypassCooldown accepts all in-range versions (no cooldown) (when
`IncludePackages` is used is an example)
  - Freeze re-emits the previous run's output verbatim
- `XUnitFileGenerator.LoadExistingVersions` reads the previous `.g.cs`
and returns `Dictionary<IntegrationName, List<(Framework, Versions)>>`.
`PackageGroup` loads this once and exposes `TryGetFrozenVersions`
- I think we should probably still try and do something different here
but this seems a bit more reasonable
- Deleted `nuget_version_cache.json` and `NuGetVersionCache.cs`
  - No longer used/needed
- Some readability improvements
  -  `IsWithinCooldown` → `WasPublishedTooRecently`
  - `baseline` → `previousMaxVersions`
- `ApplyCooldown` now uses two named local booleans
(`publishedTooRecently`, `atOrBelowPreviousMax`) so the drop condition
reads positively: "drop the version if it was published too recently
**and** we haven't already shipped against it."

## Test coverage

I ran it locally for a handful of cases I think it is better.

## Other details
<!-- Fixes #{issue} -->

I have ran through several instances with this and it _seems_ to be
good, basically default runs, runs with configurable cooldowns, runs
with `IncludePackages` and runs with `ExcludePackages`. All appeared as
expected to me.


<!--  ⚠️ Note:

Where possible, please obtain 2 approvals prior to merging. Unless
CODEOWNERS specifies otherwise, for external teams it is typically best
to have one review from a team member, and one review from apm-dotnet.
Trivial changes do not require 2 reviews.

MergeQueue is NOT enabled in this repository. If you have write access
to the repo, the PR has 1-2 approvals (see above), and all of the
required checks have passed, you can use the Squash and Merge button to
merge the PR. If you don't have write access, or you need help, reach
out in the #apm-dotnet channel in Slack.
-->

---------

Co-authored-by: Andrew Lock <andrew.lock@datadoghq.com>
bouwkast added 13 commits April 27, 2026 07:52
This resolves a reparenting issue when OpenTelemetry.Instrumentation.Http
is present and running.
This demonstrates the difference in parenting
when we have Ocelot and OpenTelemetry compared
to when we have the instrumenation that
gets rid of the parenting misconfiguration.

Note that in this snapshot there is an "ID_3"
referenced as the "ParentId", but that there is
no "ID_3" present in the snapshot.
Just doing to this help with reviewers to see
what changed / what it should be
Cover Ocelot 23.x which supports net6.0-net8.0, not just net8.0+.
@bouwkast bouwkast force-pushed the steven/ocelot-instrumentation branch from ea34469 to eff04e0 Compare April 27, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos area:automatic-instrumentation Automatic instrumentation managed C# code (Datadog.Trace.ClrProfiler.Managed) identified-by:customer type:bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants