Skip to content

fix: Support multi-transport queue name parsing for MassTransit#3523

Draft
tippmar-nr wants to merge 6 commits intomainfrom
fix/masstransit-multi-transport-queue-parsing
Draft

fix: Support multi-transport queue name parsing for MassTransit#3523
tippmar-nr wants to merge 6 commits intomainfrom
fix/masstransit-multi-transport-queue-parsing

Conversation

@tippmar-nr
Copy link
Copy Markdown
Member

Summary

Resolves #3519. MassTransit's Kafka transport (and other non-RabbitMQ transports) reported queue names as Unknown with destination type Queue instead of Topic.

Root causes:

  • GetQueueData() only understood RabbitMQ-style underscore-delimited URIs
  • NewRelicFilter used SourceAddress exclusively, which for Kafka Rider is the bus endpoint (no queue/topic info)
  • The consume path in both wrappers hardcoded MessageBrokerDestinationType.Queue

Fixes:

  • Rewrote GetQueueData() as a scheme-aware parser supporting all MassTransit transports (Kafka, RabbitMQ, Azure Service Bus, Amazon SQS, ActiveMQ, InMemory)
  • Added fallback to DestinationAddress when SourceAddress yields Unknown — handles Kafka Rider where SourceAddress is the bus endpoint
  • Detect MassTransit Rider path prefixes (/kafka/, /event-hub/) regardless of bus transport scheme
  • Fixed hardcoded MessageBrokerDestinationType.Queue in the consume path of both modern and legacy NewRelicFilter

Tests:

  • 49 unit tests covering all transport URI formats, fallback behavior, and Rider prefix detection
  • New multi-transport container integration test exercising Kafka, RabbitMQ, and InMemory transports simultaneously
  • Updated existing MassTransit integration test regex for compatibility with the new parser

Test plan

  • Unit tests pass (49 tests)
  • FullAgent.sln builds
  • Container integration test: MassTransitDotNet10Test
  • Container integration test: MassTransitDotNet8Test
  • Existing MassTransit integration tests (StartHost/StartBus variants)
  • CI pipeline

MassTransitHelpers.GetQueueData() only understood RabbitMQ-style URIs,
causing all other transports (Kafka, Azure Service Bus, SQS, ActiveMQ,
In-Memory) to report queue name as "Unknown" with incorrect destination
type. Rewrote the parser to be scheme-aware, handling each transport's
URI format. Also fixed hardcoded MessageBrokerDestinationType.Queue in
the consume path of both modern and legacy NewRelicFilter.
…uration

Add MassTransitTestApp project and MassTransit.Kafka/MassTransit.RabbitMQ
packages to Dotty tracking. Both packages are pinned to 8.x (9.x requires
a paid license) and net8.0 TFM is excluded from updates.
…3519)

GetQueueData now accepts an optional fallback URI (DestinationAddress) for
when SourceAddress yields Unknown — needed for Kafka Rider where the
consume context SourceAddress is the bus endpoint with no queue info.

Rider path prefixes (/kafka/, /event-hub/) are detected regardless of
the bus transport scheme, so Kafka topics are correctly identified as
Topic destination type whether the bus uses RabbitMQ, InMemory, or any
other transport.
)

New MassTransitTestApp exercises three transports in a single container test:
- Kafka Rider: validates Topic destination type and correct topic names
- RabbitMQ: validates Queue publish/send/consume through MassTransit filter
- InMemory MultiBus: validates loopback:// URI parsing via DI-registered bus

Also updates existing MassTransit integration test regex to accommodate
the parser change from underscore-split names to full path segments, and
adds unit tests for fallback address and Rider prefix detection (49 total).
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.70492% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.81%. Comparing base (0e78da3) to head (eea30d9).

Files with missing lines Patch % Lines
...s/NewRelic.Agent.Extensions/Helpers/MassTransit.cs 87.70% 11 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3523      +/-   ##
==========================================
+ Coverage   81.79%   81.81%   +0.02%     
==========================================
  Files         508      508              
  Lines       34228    34338     +110     
  Branches     4040     4060      +20     
==========================================
+ Hits        27996    28093      +97     
- Misses       5266     5276      +10     
- Partials      966      969       +3     
Flag Coverage Δ
Agent 82.80% <87.70%> (+0.01%) ⬆️
Profiler 71.75% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...s/NewRelic.Agent.Extensions/Helpers/MassTransit.cs 88.18% <87.70%> (-11.82%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MassTransit Kafka transport reports queue name as "Unknown" in transaction traces

2 participants