Skip to content

[Tracer] Tolerate clock skew when reparenting Activities to active Span#8674

Merged
NachoEchevarria merged 1 commit into
masterfrom
nacho/TimingTolerance
May 28, 2026
Merged

[Tracer] Tolerate clock skew when reparenting Activities to active Span#8674
NachoEchevarria merged 1 commit into
masterfrom
nacho/TimingTolerance

Conversation

@NachoEchevarria

@NachoEchevarria NachoEchevarria commented May 22, 2026

Copy link
Copy Markdown
Collaborator

Summary of changes

Add a 50 ms tolerance to the Activity → Span reparenting time check in ActivityHandlerCommon.

Reason for change

SimpleActivitiesAndSpansTest flaked on master (build 202056) because the reparenting heuristic compares two different clock sources:

  • Activity.StartTimeUtcDateTime.UtcNow (system clock)
  • Span.StartTimeTraceClock.UtcNow (Stopwatch-based, recalibrated against DateTime.UtcNow only every 5 min, with up to 16 ms calibration slack)

These can drift apart, so an Activity started a few µs before a Span can still end up with Parent.StartTimeUtc > activeSpan.StartTime, causing the <= guard to fail and reparenting to silently skip. In #5735 the same guard was relaxed from < to <= to handle low-resolution clocks on macOS — that fix doesn't cover the drift case where the parent time is strictly greater than the child.

The customer-visible impact of skipping reparenting is the same as the test symptom: an OTel child Activity created right after a DD Span keeps its original W3C parent instead of being linked to the DD span, breaking trace continuity.

Implementation details

Added ParentReorderingClockSkewTolerance = 50 ms and changed the guard from
activity.Parent.StartTimeUtc <= activeSpan.StartTime.UtcDateTime
to
activity.Parent.StartTimeUtc <= activeSpan.StartTime.UtcDateTime + ParentReorderingClockSkewTolerance.

50 ms comfortably covers TraceClock's 16 ms calibration slack plus typical NTP step adjustments, while still being well under any realistic causal gap between unrelated spans in a single async chain.

Test coverage

Existing ActivityTests.SimpleActivitiesAndSpansTest exercises this path; the change makes that test stable on Windows where the drift was observed.

Other details

@github-actions github-actions Bot added the area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) label May 22, 2026
@NachoEchevarria NachoEchevarria changed the title Add tolerance [Tracer] Tolerate clock skew when reparenting Activities to active Span May 22, 2026
@pr-commenter

pr-commenter Bot commented May 22, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-05-22 09:57:44

Comparing candidate commit 089b98f in PR branch nacho/TimingTolerance with baseline commit 9d14649 in branch master.

Found 0 performance improvements and 1 performance regressions! Performance is the same for 71 metrics, 0 unstable metrics, 62 known flaky benchmarks, 64 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 ----------------------------------'

scenario:Benchmarks.Trace.HttpClientBenchmark.SendAsync net472

  • 🟥 throughput [-6015.270op/s; -5677.693op/s] or [-6.867%; -6.481%]

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 net472

  • 🟥 throughput [-5637.467op/s; -5173.222op/s] or [-6.684%; -6.134%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild netcoreapp3.1

  • 🟥 throughput [-9691.519op/s; -7852.755op/s] or [-9.854%; -7.985%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 execution_time [+305.991ms; +314.141ms] or [+151.844%; +155.888%]
  • 🟥 throughput [-44.720op/s; -41.099op/s] or [-8.046%; -7.395%]

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

  • 🟥 execution_time [+382.372ms; +384.276ms] or [+302.097%; +303.602%]
  • 🟩 throughput [+87.212op/s; +90.406op/s] or [+11.499%; +11.920%]

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

  • 🟥 execution_time [+390.495ms; +393.093ms] or [+345.573%; +347.873%]

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

  • 🟥 allocated_mem [+1.308KB; +1.308KB] or [+27.528%; +27.540%]

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

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+9.976%; +9.987%]
  • 🟩 execution_time [-16.220ms; -12.041ms] or [-7.575%; -5.623%]
  • 🟩 throughput [+6983.976op/s; +9821.580op/s] or [+5.098%; +7.169%]

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

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

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

  • 🟥 allocated_mem [+1.307KB; +1.307KB] or [+105.743%; +105.758%]
  • 🟥 throughput [-264398.447op/s; -260912.818op/s] or [-26.996%; -26.640%]

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

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+38.557%; +38.566%]
  • 🟩 execution_time [-26.150ms; -21.247ms] or [-11.662%; -9.475%]

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

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+105.288%; +105.304%]
  • 🟥 throughput [-159160.327op/s; -142908.214op/s] or [-22.868%; -20.533%]

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

  • 🟩 throughput [+8081.977op/s; +11013.608op/s] or [+5.142%; +7.008%]

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

  • 🟩 throughput [+8591.377op/s; +11276.447op/s] or [+6.844%; +8.983%]

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

  • 🟩 throughput [+467248.766op/s; +496437.909op/s] or [+15.580%; +16.553%]

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

  • 🟩 execution_time [-19.007ms; -14.675ms] or [-8.762%; -6.765%]
  • 🟩 throughput [+174029.741op/s; +228844.848op/s] or [+6.908%; +9.083%]

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

  • 🟥 execution_time [+299.227ms; +299.950ms] or [+149.514%; +149.875%]

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

  • 🟥 execution_time [+298.780ms; +301.917ms] or [+150.675%; +152.258%]
  • 🟩 throughput [+654.456op/s; +868.438op/s] or [+5.006%; +6.642%]

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

  • 🟥 execution_time [+300.860ms; +303.344ms] or [+151.550%; +152.801%]

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

  • 🟥 execution_time [+296.348ms; +297.553ms] or [+145.555%; +146.146%]

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

  • 🟥 execution_time [+297.585ms; +302.115ms] or [+145.478%; +147.693%]

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

  • 🟥 execution_time [+299.006ms; +300.030ms] or [+149.443%; +149.955%]

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

  • 🟥 execution_time [+22.668µs; +49.850µs] or [+5.199%; +11.433%]
  • 🟥 throughput [-242.740op/s; -120.590op/s] or [-10.553%; -5.243%]

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

  • 🟥 execution_time [+22.922µs; +46.576µs] or [+7.318%; +14.869%]
  • 🟥 throughput [-433.233op/s; -234.205op/s] or [-13.505%; -7.301%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+299.818ms; +300.683ms] or [+149.640%; +150.072%]

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

  • 🟥 execution_time [+408.972ms; +416.795ms] or [+444.364%; +452.865%]
  • 🟩 throughput [+787.964op/s; +1028.177op/s] or [+6.475%; +8.449%]

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

  • 🟥 execution_time [+366.347ms; +369.881ms] or [+278.164%; +280.847%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [+321.727ms; +375.953ms] or [+147.927%; +172.860%]
  • 🟥 throughput [-554.721op/s; -509.212op/s] or [-50.263%; -46.140%]

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

  • unstable execution_time [+199.407ms; +333.139ms] or [+84.979%; +141.970%]
  • 🟥 throughput [-684.615op/s; -599.266op/s] or [-45.664%; -39.971%]

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

  • 🟥 execution_time [+335.168ms; +346.831ms] or [+200.469%; +207.445%]
  • 🟥 throughput [-422.205op/s; -382.238op/s] or [-29.398%; -26.615%]

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

  • 🟩 execution_time [-155.937µs; -108.045µs] or [-7.899%; -5.473%]
  • 🟩 throughput [+30.550op/s; +44.316op/s] or [+6.031%; +8.748%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 execution_time [+304.837ms; +306.149ms] or [+153.510%; +154.171%]

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

  • 🟥 execution_time [+302.098ms; +303.716ms] or [+151.382%; +152.193%]

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

  • 🟥 execution_time [+301.290ms; +304.824ms] or [+151.356%; +153.131%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 execution_time [+302.609ms; +304.015ms] or [+151.960%; +152.666%]

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

  • 🟥 execution_time [+295.516ms; +297.414ms] or [+146.120%; +147.058%]

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

  • 🟥 execution_time [+304.275ms; +308.023ms] or [+154.220%; +156.120%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 execution_time [+304.963ms; +307.772ms] or [+153.064%; +154.474%]

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

  • 🟥 execution_time [+301.164ms; +304.201ms] or [+150.103%; +151.616%]
  • 🟩 throughput [+54965.105op/s; +59066.999op/s] or [+10.914%; +11.729%]

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

  • 🟥 execution_time [+300.544ms; +303.507ms] or [+149.518%; +150.992%]

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

  • 🟩 execution_time [-16.143ms; -12.506ms] or [-7.506%; -5.815%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net472

  • unstable execution_time [+13.551µs; +58.884µs] or [+3.347%; +14.545%]

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

  • 🟩 allocated_mem [-19.854KB; -19.832KB] or [-7.242%; -7.234%]
  • unstable execution_time [-38.901µs; +17.576µs] or [-7.689%; +3.474%]

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

  • unstable execution_time [-48.028µs; +13.711µs] or [-8.323%; +2.376%]

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

  • unstable execution_time [+7.360µs; +12.747µs] or [+17.397%; +30.129%]
  • 🟥 throughput [-5368.824op/s; -3338.920op/s] or [-22.601%; -14.056%]

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

  • unstable execution_time [-13.662µs; -5.452µs] or [-21.196%; -8.459%]
  • unstable throughput [+1389.073op/s; +3168.526op/s] or [+8.522%; +19.440%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+302.706ms; +304.296ms] or [+153.005%; +153.808%]

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

  • 🟥 execution_time [+302.043ms; +306.169ms] or [+153.739%; +155.839%]

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

  • 🟥 execution_time [+300.633ms; +303.262ms] or [+150.504%; +151.820%]

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

  • 🟩 throughput [+36508.726op/s; +40859.691op/s] or [+6.910%; +7.734%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+299.037ms; +301.211ms] or [+149.043%; +150.127%]

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

  • 🟥 execution_time [+302.416ms; +304.366ms] or [+151.859%; +152.838%]

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

  • 🟥 execution_time [+303.765ms; +306.417ms] or [+154.050%; +155.395%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+300.040ms; +301.195ms] or [+149.662%; +150.238%]
  • 🟩 throughput [+61188095.226op/s; +61555925.540op/s] or [+44.561%; +44.829%]

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

  • 🟥 execution_time [+415.621ms; +419.906ms] or [+516.899%; +522.227%]

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

  • 🟥 execution_time [+299.508ms; +300.643ms] or [+149.388%; +149.954%]

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

  • 🟩 throughput [+73996.037op/s; +84154.405op/s] or [+6.909%; +7.857%]

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

  • 🟩 throughput [+45180.496op/s; +64844.715op/s] or [+5.230%; +7.506%]

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

  • 🟩 throughput [+82082.577op/s; +114061.598op/s] or [+6.353%; +8.829%]

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

  • 🟩 throughput [+78993.700op/s; +87120.602op/s] or [+7.845%; +8.652%]

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

  • 🟩 throughput [+46494.503op/s; +53455.618op/s] or [+8.443%; +9.707%]

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

  • 🟩 throughput [+24105.537op/s; +33810.328op/s] or [+5.396%; +7.568%]

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

  • 🟩 throughput [+84638.045op/s; +102116.372op/s] or [+9.456%; +11.409%]

Known flaky benchmarks without significant changes:

  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net6.0
  • 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.OptimizedCharSlice netcoreapp3.1
  • 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.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

dd-trace-dotnet-ci-bot Bot commented May 22, 2026

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (8674) 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.37 ± (72.42 - 72.75) ms72.22 ± (72.18 - 72.54) ms-0.2%
.NET Framework 4.8 - Bailout
duration78.99 ± (78.86 - 79.39) ms78.64 ± (78.59 - 79.13) ms-0.4%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1103.39 ± (1107.38 - 1116.34) ms1102.61 ± (1102.03 - 1108.53) ms-0.1%
.NET Core 3.1 - Baseline
process.internal_duration_ms22.92 ± (22.85 - 22.98) ms22.65 ± (22.58 - 22.71) ms-1.2%
process.time_to_main_ms86.94 ± (86.66 - 87.21) ms85.75 ± (85.45 - 86.05) ms-1.4%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.93 ± (10.92 - 10.93) MB10.93 ± (10.93 - 10.93) MB+0.0%✅⬆️
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.37 ± (22.33 - 22.41) ms22.71 ± (22.67 - 22.76) ms+1.5%✅⬆️
process.time_to_main_ms86.50 ± (86.26 - 86.73) ms87.89 ± (87.64 - 88.15) ms+1.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.97 ± (10.96 - 10.97) MB10.96 ± (10.95 - 10.96) MB-0.1%
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms212.83 ± (211.94 - 213.71) ms213.88 ± (213.09 - 214.67) ms+0.5%✅⬆️
process.time_to_main_ms542.09 ± (540.69 - 543.49) ms543.50 ± (542.36 - 544.64) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.61 ± (48.58 - 48.64) MB48.63 ± (48.60 - 48.66) MB+0.0%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.3%
.NET 6 - Baseline
process.internal_duration_ms21.34 ± (21.29 - 21.38) ms21.38 ± (21.32 - 21.43) ms+0.2%✅⬆️
process.time_to_main_ms73.98 ± (73.80 - 74.17) ms74.41 ± (74.16 - 74.66) ms+0.6%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.65 ± (10.64 - 10.65) MB10.63 ± (10.63 - 10.64) MB-0.1%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.61 ± (21.55 - 21.68) ms21.22 ± (21.19 - 21.26) ms-1.8%
process.time_to_main_ms77.84 ± (77.55 - 78.12) ms74.36 ± (74.19 - 74.53) ms-4.5%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.76 ± (10.76 - 10.76) MB10.74 ± (10.74 - 10.75) MB-0.2%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms369.18 ± (367.11 - 371.25) ms368.16 ± (366.03 - 370.29) ms-0.3%
process.time_to_main_ms549.29 ± (548.01 - 550.56) ms550.28 ± (549.01 - 551.55) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed49.99 ± (49.97 - 50.02) MB50.02 ± (50.00 - 50.04) MB+0.0%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.1%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms19.22 ± (19.19 - 19.26) ms19.59 ± (19.53 - 19.65) ms+1.9%✅⬆️
process.time_to_main_ms72.11 ± (71.95 - 72.28) ms74.41 ± (74.15 - 74.67) ms+3.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.69 ± (7.68 - 7.69) MB7.67 ± (7.67 - 7.68) MB-0.1%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.18 ± (19.14 - 19.22) ms19.63 ± (19.58 - 19.69) ms+2.4%✅⬆️
process.time_to_main_ms73.24 ± (73.11 - 73.37) ms75.64 ± (75.40 - 75.87) ms+3.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.74 ± (7.73 - 7.75) MB7.72 ± (7.72 - 7.73) MB-0.2%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms297.98 ± (296.02 - 299.94) ms293.96 ± (291.70 - 296.22) ms-1.3%
process.time_to_main_ms498.60 ± (497.48 - 499.72) ms498.10 ± (496.89 - 499.32) ms-0.1%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed36.93 ± (36.91 - 36.96) MB36.93 ± (36.90 - 36.96) MB-0.0%
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)+0.6%✅⬆️

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration198.69 ± (198.62 - 199.60) ms198.72 ± (198.30 - 199.19) ms+0.0%✅⬆️
.NET Framework 4.8 - Bailout
duration201.49 ± (201.39 - 202.43) ms201.93 ± (201.16 - 202.10) ms+0.2%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1197.77 ± (1198.94 - 1206.45) ms1193.51 ± (1194.32 - 1200.89) ms-0.4%
.NET Core 3.1 - Baseline
process.internal_duration_ms192.39 ± (191.95 - 192.84) ms194.16 ± (193.65 - 194.68) ms+0.9%✅⬆️
process.time_to_main_ms83.31 ± (82.95 - 83.66) ms84.32 ± (83.97 - 84.66) ms+1.2%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.17 ± (16.14 - 16.19) MB16.06 ± (16.04 - 16.08) MB-0.7%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (19 - 20)-0.2%
.NET Core 3.1 - Bailout
process.internal_duration_ms192.26 ± (191.72 - 192.79) ms193.15 ± (192.67 - 193.63) ms+0.5%✅⬆️
process.time_to_main_ms84.81 ± (84.50 - 85.11) ms85.23 ± (84.98 - 85.48) ms+0.5%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.18 ± (16.16 - 16.21) MB16.11 ± (16.09 - 16.14) MB-0.5%
runtime.dotnet.threads.count21 ± (21 - 21)21 ± (21 - 21)+0.1%✅⬆️
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms385.00 ± (383.59 - 386.41) ms386.45 ± (385.06 - 387.84) ms+0.4%✅⬆️
process.time_to_main_ms535.92 ± (534.63 - 537.21) ms535.36 ± (533.85 - 536.88) ms-0.1%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed57.46 ± (57.31 - 57.61) MB57.53 ± (57.35 - 57.70) MB+0.1%✅⬆️
runtime.dotnet.threads.count30 ± (30 - 30)30 ± (30 - 30)-0.2%
.NET 6 - Baseline
process.internal_duration_ms197.05 ± (196.65 - 197.45) ms195.92 ± (195.46 - 196.38) ms-0.6%
process.time_to_main_ms72.43 ± (72.14 - 72.71) ms71.68 ± (71.43 - 71.93) ms-1.0%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.38 ± (16.35 - 16.41) MB16.39 ± (16.36 - 16.42) MB+0.1%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)-0.3%
.NET 6 - Bailout
process.internal_duration_ms197.31 ± (196.84 - 197.78) ms194.53 ± (194.04 - 195.02) ms-1.4%
process.time_to_main_ms73.12 ± (72.86 - 73.38) ms72.44 ± (72.21 - 72.68) ms-0.9%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.38 ± (16.35 - 16.41) MB16.40 ± (16.37 - 16.43) MB+0.1%✅⬆️
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (20 - 20)+0.2%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms583.02 ± (580.33 - 585.72) ms587.05 ± (584.70 - 589.41) ms+0.7%✅⬆️
process.time_to_main_ms543.89 ± (542.87 - 544.92) ms543.94 ± (542.77 - 545.11) ms+0.0%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed61.15 ± (61.07 - 61.23) MB61.18 ± (61.09 - 61.27) MB+0.0%✅⬆️
runtime.dotnet.threads.count31 ± (31 - 31)31 ± (31 - 31)-0.2%
.NET 8 - Baseline
process.internal_duration_ms194.26 ± (193.77 - 194.76) ms194.02 ± (193.54 - 194.49) ms-0.1%
process.time_to_main_ms70.92 ± (70.67 - 71.17) ms71.04 ± (70.78 - 71.30) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.74 ± (11.71 - 11.76) MB11.74 ± (11.72 - 11.76) MB+0.0%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)+0.5%✅⬆️
.NET 8 - Bailout
process.internal_duration_ms194.45 ± (193.99 - 194.90) ms193.14 ± (192.63 - 193.65) ms-0.7%
process.time_to_main_ms72.39 ± (72.14 - 72.64) ms72.23 ± (72.03 - 72.44) ms-0.2%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.76 ± (11.73 - 11.79) MB11.76 ± (11.74 - 11.78) MB+0.0%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)-0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms510.94 ± (508.46 - 513.41) ms512.56 ± (510.22 - 514.91) ms+0.3%✅⬆️
process.time_to_main_ms491.64 ± (490.85 - 492.44) ms489.82 ± (488.93 - 490.70) ms-0.4%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed50.71 ± (50.68 - 50.74) MB50.59 ± (50.55 - 50.63) MB-0.2%
runtime.dotnet.threads.count30 ± (29 - 30)29 ± (29 - 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 (8674) - mean (72ms)  : 70, 75
    master - mean (73ms)  : 70, 75

    section Bailout
    This PR (8674) - mean (79ms)  : 75, 83
    master - mean (79ms)  : 75, 83

    section CallTarget+Inlining+NGEN
    This PR (8674) - mean (1,105ms)  : 1059, 1152
    master - mean (1,112ms)  : 1046, 1178

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 (8674) - mean (116ms)  : 109, 122
    master - mean (117ms)  : 112, 122

    section Bailout
    This PR (8674) - mean (118ms)  : 113, 122
    master - mean (116ms)  : 111, 121

    section CallTarget+Inlining+NGEN
    This PR (8674) - mean (794ms)  : 770, 818
    master - mean (792ms)  : 767, 816

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8674) - mean (102ms)  : 97, 108
    master - mean (102ms)  : 98, 106

    section Bailout
    This PR (8674) - mean (102ms)  : 99, 104
    master - mean (106ms)  : 101, 111

    section CallTarget+Inlining+NGEN
    This PR (8674) - mean (947ms)  : 910, 983
    master - mean (946ms)  : 912, 980

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8674) - mean (102ms)  : 96, 108
    master - mean (99ms)  : 96, 102

    section Bailout
    This PR (8674) - mean (103ms)  : 98, 108
    master - mean (100ms)  : 98, 102

    section CallTarget+Inlining+NGEN
    This PR (8674) - mean (824ms)  : 784, 864
    master - mean (826ms)  : 786, 865

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 (8674) - mean (199ms)  : 194, 203
    master - mean (199ms)  : 193, 205

    section Bailout
    This PR (8674) - mean (202ms)  : 197, 206
    master - mean (202ms)  : 196, 208

    section CallTarget+Inlining+NGEN
    This PR (8674) - mean (1,198ms)  : 1151, 1244
    master - mean (1,203ms)  : 1149, 1256

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 (8674) - mean (288ms)  : 281, 294
    master - mean (285ms)  : 277, 293

    section Bailout
    This PR (8674) - mean (287ms)  : 281, 293
    master - mean (286ms)  : 277, 294

    section CallTarget+Inlining+NGEN
    This PR (8674) - mean (962ms)  : 940, 983
    master - mean (961ms)  : 939, 983

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8674) - mean (276ms)  : 268, 285
    master - mean (278ms)  : 271, 285

    section Bailout
    This PR (8674) - mean (276ms)  : 268, 284
    master - mean (279ms)  : 274, 284

    section CallTarget+Inlining+NGEN
    This PR (8674) - mean (1,161ms)  : 1125, 1198
    master - mean (1,155ms)  : 1122, 1188

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8674) - mean (275ms)  : 269, 282
    master - mean (276ms)  : 268, 283

    section Bailout
    This PR (8674) - mean (275ms)  : 267, 284
    master - mean (277ms)  : 271, 282

    section CallTarget+Inlining+NGEN
    This PR (8674) - mean (1,036ms)  : 999, 1073
    master - mean (1,036ms)  : 996, 1076

Loading

@NachoEchevarria
NachoEchevarria marked this pull request as ready for review May 25, 2026 10:02
@NachoEchevarria
NachoEchevarria requested review from a team as code owners May 25, 2026 10:02
&& activityTraceId is not null
&& Tracer.Instance.ActiveScope?.Span is Span activeSpan
&& (activity.Parent is null || activity.Parent.StartTimeUtc <= activeSpan.StartTime.UtcDateTime))
&& (activity.Parent is null || activity.Parent.StartTimeUtc <= activeSpan.StartTime.UtcDateTime + ParentReorderingClockSkewTolerance))

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.

This kind of makes me question whether this start time heuristic is correct at all? 🤔 @zacharycmontoya @bouwkast any thoughts?

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.

Suspicious 🤔 So the goal of this block is to make sure that we "reparent" an Activity to the currently active one if it makes sense. There's two cases here:

  • Activity.Parent is null aka a root span
  • Activity.Parent is not null

For the root span case, the remote case is already handled, so this remaps the Activity so its parent points to an existing Datadog span. That's fine, though I'm thinking we may have a separate issue, but that's irrelevant for now... 😅

For the non-root span case, the timing check is supposed to ensure we're keeping the stack of .NET Activity / Datadog spans in the proper order. When there are no clock issues, this usually results in a .NET Activity, followed by a Datadog span representing that .NET Activity, followed by 0+ newer Datadog spans, followed by the next .NET Activity (presumably this invocation).

In that sense, the timing check kinda works to make sure that we always rewrite an Activity so its parent span ID becomes the span ID of the latest Datadog span. I think this still makes sense for our current shadow stack of Datadog spans. If we find ways to optimize this and no longer keep two separate stacks, that would be a good time to reconsider this timing check

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

FWIW (I think) this came up as a bug a while back and speaking with Tony it basically was that there wasn't a great way to reconcile this at the moment as we have two different time sources

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.

So I guess that we could either:

  • Merge the timing tolerance value workaround
    or
  • Mark underlying tests as flaky.
    The problem of marking the tests as flaky is that the issue is real.
    WDYT?

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.

I agree, this very much seems like a "real" issue to me, what's not entirely clear to me is whether this causes any other flake the other way 😅 I'll defer to the others, but I think this is probably fine based on the answers above

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.

I vote for merging the timing tolerance workaround

@zacharycmontoya zacharycmontoya 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.

LGTM

@andrewlock andrewlock left a comment

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.

Thanks!

@NachoEchevarria
NachoEchevarria merged commit ff3faeb into master May 28, 2026
139 checks passed
@NachoEchevarria
NachoEchevarria deleted the nacho/TimingTolerance branch May 28, 2026 13:57
@github-actions github-actions Bot added this to the vNext-v3 milestone May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants