Spans for recoverability actions - #7890
Merged
Merged
Conversation
…ng recoverability actions
…e` in tests and implementation to enforce singleton usage.
…s for better trace clarity in recoverability pipeline.
…s to improve trace clarity in the recoverability pipeline.
…ttempts. Span tags and display names update moved directly after recoverability aciton resolution
…icated recoverability span tests TestingActivityListener now accepts multiple source names so OpenTelemetryAcceptanceTest can subscribe to both "NServiceBus.Core" and "NServiceBus.Core.Recoverability" - previously only Main was subscribed, so recoverability spans were silently never created in any acceptance test. Adds When_recoverability_action_occurs.cs covering all four recoverability outcomes (immediate retry, delayed retry, move to error, discard): span creation, display name, and the nservicebus.recoverability_action tag, plus the UseMessageDestinationInSpanNames toggle for immediate retry.
Collapsed all five scenarios onto a single RecoverabilityEndpoint, moving the per-test differences (Recoverability policy, UseMessageDestinationInSpanNames) into each test's CustomConfig callback instead of separate endpoint classes. Replaced the ErrorSpy endpoint (used only to signal test completion for the move-to-error case) with a Done() predicate that waits directly on the recoverability span being captured - the actual signal the test cares about, rather than an indirect one requiring a second endpoint and message hop.
…ty test One endpoint config now drives a single message through the default policy's full immediate-retry -> delayed-retry -> move-to-error cascade, plus a second message routed straight to Discard via a CustomPolicy branch that otherwise delegates to DefaultRecoverabilityPolicy.Invoke for the first message. Asserts by matching on the nservicebus.recoverability_action tag rather than activity position/count, since the exact number of immediate-retry attempts before falling through isn't a contract worth pinning down. Kept the destination-naming test separate since it needs a different Tracing() configuration that can't share the same CustomConfig block.
irinascurtu
approved these changes
Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves:
Adds a dedicated OpenTelemetry span representing each recoverability outcome (immediate retry, delayed retry, move to error, discard). New spans are created under a new
NServiceBus.Core.RecoverabilityActivitySource.