Added the option to disconnect ContinueAsNew traces#1972
Added the option to disconnect ContinueAsNew traces#1972bincyber wants to merge 1 commit intotemporalio:masterfrom
Conversation
|
Hey @bincyber thanks for the contribution. Before I start reviewing the implementation we need to first design the API. Did you look at other SDKs open telemetry interceptor or our data dog interceptor for how they support this case? We need to be consistent across our SDKs and tracing interceptors. Generally we would discuss the design in a github issue before we dive into an implementation, but we can do the design on the github issue as well if you prefer |
Let's discuss the design in a GitHub issue. I've created on here: #1976 |
| // EnableSpanLinks can be set to enable span links for spans disconnected from their parent span. | ||
| EnableSpanLinks bool |
There was a problem hiding this comment.
Does this need to be an additional option? It seems like span links (an otel-specific feature?) could be added automatically if the disconnect continue as new workflows option is set.
There was a problem hiding this comment.
I preferred to make this the default, but decided not to for backwards compatibility. Adding links results in additional tracing data which may increase costs depending on your observability vendor
TIL DataDog's SDKs also support span links: https://docs.datadoghq.com/tracing/trace_collection/span_links/
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
EnableSpanLinksandDisconnectContinueAsNewWorkflows:I don't currently use DataDog, so I have not been able to test this change on the DataDog tracing interceptor.