NServiceBus
NServiceBus copied to clipboard
OpenTelemetry: make use of spanlinks for delayed messages
Describe the feature.
Is your feature related to a problem? Please describe.
Delayed messages are by definition expected to arrive at a later time. At this point, connecting them to the parent trace is an anti-pattern as it may cause broken traces.
Having large time gaps in the trace also makes the trace less coherent and skews the overall trace duration. In addition, when using a tail-based sampling strategy, in most cases, a time-based criterion is used to mark the trace as completed. Then a sampling decision is made. Therefore, delayed messages should never be connected to the parent trace as the parent trace will probably have been completed by then. This doesn't only affect sampling scenarios, but could also affect any scenario in which there is short data retention, causing the span to exist in a vacuum without the parent trace.
Describe the requested feature
Delayed messages should not be connected as a child span, but rather start a new trace and make use of span links for correlation.
Describe alternatives you've considered
Additional Context
No response
Should the same be done for retries? (both immediate and delayed)
I wouldn't for immediate retries, they're immediate, after all. Do you see a strong reason to do so @andreasohlund ?
Just to be consistent I guess since it is a brand new attempt, no strong opinion
Addressed in #7049. Will be released in 9.1.0 soonish