Added the option to disconnect ContinueAsNew traces #1972
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.
What was changed
Added two new options to the Tracing interceptor and support in the OpenTelemetry implementation:
DisconnectContinueAsNewWorkflows
- setting this to true will create a new root span for any workflows that are ContinueAsNewEnableSpanLinks
- setting this to true will create a span link to connect the new root span to the parent spanThis change is backwards compatible with these two new options defaulting to false.
Why?
Slack context: https://temporalio.slack.com/archives/CTDTU3J4T/p1702921125553459
Currently, when tracing is enabled on a workflow that ends as ContinueAsNew, the new workflow is attached to the existing trace:
The total number of spans can become extremely large and overwhelm the tracing backend (eg, Grafana Tempo, Jaeger, etc.).
Instead, it would be nice if the new workflow was created as a new, disconnected trace and linked to the existing trace:
This idea can be extended to disconnecting Child Workflows as well.
Checklist
Create the Temporal worker with the tracing interceptor and enable
EnableSpanLinks
andDisconnectContinueAsNewWorkflows
:I don't currently use DataDog, so I have not been able to test this change on the DataDog tracing interceptor.