Skip to content

Spans for recoverability actions - #7890

Merged
tmasternak merged 18 commits into
otelfrom
recoverability-actions-spans
Jul 31, 2026
Merged

Spans for recoverability actions#7890
tmasternak merged 18 commits into
otelfrom
recoverability-actions-spans

Conversation

@tmasternak

Copy link
Copy Markdown
Member

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.Recoverability ActivitySource.

…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.
@tmasternak
tmasternak changed the base branch from master to otel July 30, 2026 09:00
@tmasternak
tmasternak requested a review from irinascurtu July 30, 2026 11:01
@tmasternak
tmasternak merged commit 7e6873b into otel Jul 31, 2026
4 checks passed
@tmasternak
tmasternak deleted the recoverability-actions-spans branch July 31, 2026 06:44
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.

3 participants