Skip to content

[tracing] Add MassTransit 8 integration#8539

Open
chojomok wants to merge 3 commits intomohammad/mass_transit7from
mohammad/mass_transit8
Open

[tracing] Add MassTransit 8 integration#8539
chojomok wants to merge 3 commits intomohammad/mass_transit7from
mohammad/mass_transit8

Conversation

@chojomok
Copy link
Copy Markdown
Collaborator

Summary of changes

Adds auto-instrumentation for MassTransit 8 on top of the MassTransit 7 integration in #8538. MassTransit 8 emits Activities natively via ActivitySource, so this PR is mostly a sample app, a set of version-specific snapshots, and the bookkeeping changes (sln, package versions, dependabot honeypot) needed to test it.

This PR is stacked on #8538 — review and merge that one first. The base branch here is mohammad/mass_transit7, so the diff shown is purely the MT8 delta.

Reason for change

Continue MassTransit support to v8. MT8 is the current major version and the version most customers are on; MT7 still ships in long-running services but has been EOL for new development since late 2022.

Implementation details

The shared integration code (observer, CallTarget hooks, duck types, MassTransitActivityHandler) is already in place from #8538. This PR adds:

  • Sample app tracer/test/test-applications/integrations/Samples.MassTransit8/ — exercises producer / consumer / saga / fault paths against MassTransit 8.5.8, sharing Samples.MassTransit.Shared/ with the MT7 sample.
  • Integration tests MassTransit8Tests.cs covering in-memory, RabbitMQ, and AWS SQS transports, plus a Windows-only in-memory variant.
  • Version-specific snapshots — MT8 changed Activity tag shapes a few times across the 8.0 → 8.3 line, so the in-memory / RabbitMQ / SQS suites each have variants for pre_8_0_5, pre_8_0_6, pre_8_0_7, pre_8_0_9, pre_8_0_14, pre_8_0_16, pre_8_1, pre_8_2, 8_2_1_to_8_3_1, and current (8.5.8).
  • Cross-package shared snapshots under tracer/test/Datadog.Trace.TestHelpers.SharedSource/MassTransit8/ — the canonical default-version snapshots reused by upstream test runners.
  • Build / packaging plumbing — re-adds Samples.MassTransit8 to both Datadog.Trace.sln and Datadog.Trace.Samples.g.sln, restores the MassTransit8 entry in PackageVersionsGeneratorDefinitions.json (and the regenerated PackageVersionsLatest{Majors,Minors,Specific}.g.{props,cs} files), and bumps the dependabot honeypot to MassTransit 8.5.8.

Minimum supported version: 8.0.4

MT 8.0.2 and 8.0.3 set a service.name Activity tag to the consumer type name, and OtlpHelpers.UpdateSpanFromActivity unconditionally overrides the span service with that value (ignoring DD_SERVICE). 8.0.4 fixes this. Background and other version-specific quirks are documented in MassTransit-Integration.md.

Test coverage

  • New MassTransit8Tests.cs integration tests, asserting span shapes against the version-specific verified snapshots above.
  • Samples.MassTransit8 sample app covering producer, consumer, saga, and fault flows.
  • CI matrix exercises 8.0.4 → 8.5.8 via MassTransit8 package-version generator entry.

Other details

@chojomok chojomok requested review from a team as code owners April 28, 2026 20:55
@chojomok chojomok force-pushed the mohammad/mass_transit7 branch from f4427a7 to 5027224 Compare April 28, 2026 21:14
@chojomok chojomok requested review from a team as code owners April 28, 2026 21:14
@chojomok chojomok requested review from link04 and removed request for a team April 28, 2026 21:14
@chojomok chojomok force-pushed the mohammad/mass_transit8 branch from 4c7e07b to 6c53a23 Compare April 28, 2026 21:14
@chojomok chojomok force-pushed the mohammad/mass_transit7 branch from 5027224 to 51efcf3 Compare April 28, 2026 21:45
@chojomok chojomok force-pushed the mohammad/mass_transit8 branch from 6c53a23 to ec949f3 Compare April 28, 2026 21:49
Adds MassTransit 8-specific sample app, integration tests, and
snapshots, plus the sln/build/package-version entries that extend
MassTransit support to v8. Stacked on mohammad/mass_transit7.
@chojomok chojomok force-pushed the mohammad/mass_transit8 branch from ec949f3 to c8fe761 Compare April 28, 2026 21:53
@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Apr 28, 2026

Benchmarks

Benchmark execution time: 2026-04-28 23:07:09

Comparing candidate commit c97218e in PR branch mohammad/mass_transit8 with baseline commit 47d448a in branch master.

Found 0 performance improvements and 1 performance regressions! Performance is the same for 26 metrics, 0 unstable metrics, 56 known flaky benchmarks, 31 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 [-6180.410op/s; -4771.996op/s] or [-7.055%; -5.448%]

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 [+8121.995op/s; +10392.151op/s] or [+6.827%; +8.735%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 execution_time [+312.891ms; +318.548ms] or [+155.267%; +158.075%]
  • 🟥 throughput [-44.117op/s; -40.560op/s] or [-7.937%; -7.297%]

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

  • 🟥 execution_time [+381.813ms; +383.106ms] or [+301.656%; +302.677%]
  • 🟩 throughput [+91.742op/s; +94.976op/s] or [+12.096%; +12.522%]

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

  • 🟥 execution_time [+392.221ms; +394.619ms] or [+347.101%; +349.223%]

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%]

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 [-272530.172op/s; -268205.988op/s] or [-27.827%; -27.385%]

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

  • 🟥 allocated_mem [+471 bytes; +472 bytes] or [+38.558%; +38.566%]
  • 🟩 execution_time [-26.079ms; -21.151ms] or [-11.630%; -9.432%]

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

  • 🟥 allocated_mem [+1.272KB; +1.272KB] or [+105.292%; +105.304%]
  • 🟥 throughput [-143221.153op/s; -126802.646op/s] or [-20.578%; -18.219%]

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

  • 🟩 throughput [+275516.971op/s; +349410.524op/s] or [+9.187%; +11.651%]

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

  • 🟩 execution_time [-19.202ms; -14.833ms] or [-8.851%; -6.838%]

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

  • 🟥 execution_time [+299.975ms; +300.629ms] or [+149.887%; +150.214%]

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

  • 🟥 execution_time [+300.878ms; +304.458ms] or [+151.733%; +153.539%]

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

  • 🟥 execution_time [+299.287ms; +301.756ms] or [+150.758%; +152.001%]

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

  • 🟥 execution_time [+297.002ms; +297.643ms] or [+145.876%; +146.190%]

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

  • 🟥 execution_time [+291.487ms; +293.582ms] or [+142.497%; +143.521%]

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

  • 🟥 execution_time [+301.454ms; +302.432ms] or [+150.666%; +151.155%]

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

  • 🟥 execution_time [+24.726µs; +48.333µs] or [+7.894%; +15.430%]
  • 🟥 throughput [-447.509op/s; -248.865op/s] or [-13.950%; -7.758%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+299.618ms; +300.283ms] or [+149.540%; +149.872%]

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

  • 🟥 execution_time [+416.440ms; +421.555ms] or [+452.479%; +458.037%]
  • 🟩 throughput [+1106.917op/s; +1247.187op/s] or [+9.096%; +10.248%]

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

  • unstable execution_time [+304.534ms; +342.702ms] or [+231.229%; +260.210%]
  • 🟩 throughput [+651.280op/s; +850.833op/s] or [+6.305%; +8.237%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [+379.001ms; +427.126ms] or [+174.261%; +196.388%]
  • 🟥 throughput [-580.141op/s; -541.634op/s] or [-52.566%; -49.077%]

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

  • unstable execution_time [+207.861ms; +341.063ms] or [+88.582%; +145.347%]
  • 🟥 throughput [-664.153op/s; -580.743op/s] or [-44.299%; -38.736%]

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

  • 🟥 execution_time [+338.980ms; +349.441ms] or [+202.750%; +209.006%]
  • 🟥 throughput [-404.649op/s; -368.938op/s] or [-28.175%; -25.689%]

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

  • unstable throughput [+0.815op/s; +62.422op/s] or [+0.152%; +11.652%]

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

  • 🟩 execution_time [-164.061µs; -132.251µs] or [-8.311%; -6.699%]
  • 🟩 throughput [+37.824op/s; +46.252op/s] or [+7.467%; +9.130%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 execution_time [+302.917ms; +304.153ms] or [+152.543%; +153.166%]

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

  • 🟥 execution_time [+300.095ms; +301.718ms] or [+150.378%; +151.192%]

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

  • 🟥 execution_time [+302.594ms; +305.740ms] or [+152.010%; +153.591%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 execution_time [+300.839ms; +302.841ms] or [+151.071%; +152.076%]
  • 🟩 throughput [+17458.912op/s; +19359.058op/s] or [+5.849%; +6.486%]

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

  • 🟥 execution_time [+297.945ms; +299.896ms] or [+147.321%; +148.285%]

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

  • 🟥 execution_time [+301.592ms; +305.144ms] or [+152.860%; +154.660%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 execution_time [+301.257ms; +303.075ms] or [+151.204%; +152.116%]

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

  • 🟥 execution_time [+300.788ms; +303.016ms] or [+149.915%; +151.026%]
  • 🟩 throughput [+29765.713op/s; +35757.382op/s] or [+5.911%; +7.100%]

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

  • 🟥 execution_time [+299.477ms; +302.342ms] or [+148.987%; +150.413%]

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

  • 🟩 execution_time [-16.307ms; -12.623ms] or [-7.583%; -5.870%]

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

  • 🟩 allocated_mem [-18.892KB; -18.872KB] or [-6.891%; -6.884%]
  • unstable execution_time [-43.725µs; +8.008µs] or [-8.642%; +1.583%]

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

  • 🟥 execution_time [+4.917µs; +8.624µs] or [+11.622%; +20.384%]
  • 🟥 throughput [-4131.983op/s; -2431.315op/s] or [-17.394%; -10.235%]

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

  • unstable execution_time [-13.046µs; -5.580µs] or [-20.241%; -8.657%]
  • 🟩 throughput [+1437.801op/s; +2989.431op/s] or [+8.821%; +18.341%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+302.548ms; +303.517ms] or [+152.924%; +153.415%]

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

  • 🟥 execution_time [+302.634ms; +304.720ms] or [+154.040%; +155.102%]

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

  • 🟥 execution_time [+300.129ms; +302.971ms] or [+150.252%; +151.674%]

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

  • 🟩 throughput [+33439.194op/s; +36687.586op/s] or [+6.329%; +6.944%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+300.915ms; +302.723ms] or [+149.979%; +150.880%]

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

  • 🟥 execution_time [+302.778ms; +304.534ms] or [+152.041%; +152.922%]

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

  • 🟥 execution_time [+303.601ms; +306.059ms] or [+153.967%; +155.214%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+300.677ms; +301.681ms] or [+149.979%; +150.480%]
  • 🟩 throughput [+65915174.278op/s; +66195011.757op/s] or [+48.004%; +48.207%]

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

  • unstable execution_time [+377.746ms; +413.218ms] or [+469.794%; +513.910%]
  • 🟩 throughput [+1062.905op/s; +1233.781op/s] or [+8.217%; +9.538%]

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

  • 🟥 execution_time [+299.136ms; +300.093ms] or [+149.202%; +149.679%]
  • 🟩 throughput [+16276391.951op/s; +18279860.293op/s] or [+7.209%; +8.097%]

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

  • 🟩 throughput [+96538.764op/s; +105131.033op/s] or [+9.014%; +9.816%]

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

  • 🟩 throughput [+48311.449op/s; +68650.179op/s] or [+5.592%; +7.946%]

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

  • 🟩 throughput [+82205.947op/s; +122199.636op/s] or [+6.363%; +9.458%]

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

  • 🟩 throughput [+80975.657op/s; +90105.241op/s] or [+8.042%; +8.949%]

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

  • 🟩 throughput [+44103.177op/s; +59760.751op/s] or [+8.008%; +10.851%]

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

  • 🟩 throughput [+62059.717op/s; +88471.707op/s] or [+6.934%; +9.884%]

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.ObjectExtractorMoreComplexBody net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net6.0
  • 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.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.StringConcatAspectBenchmark 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.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant