-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add IdempotencyKey start span option #931
Add IdempotencyKey start span option #931
Conversation
return fmt.Sprintf("WorkflowInboundInterceptor:%s:%s:%s:%d", | ||
t.info.Namespace, | ||
t.info.WorkflowExecution.ID, | ||
t.info.WorkflowExecution.RunID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be noted that technically this value changes if a workflow is reset to a previous task. However, not only do we not appear to provide the "original run ID", but I think this is probably the correct behavior anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep I like to think of workflow reset as a fancy continue-as-new. No problem with having a new trace for a new workflow run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can end up with orphaned spans this way if a wrapping workflow span crosses a reset point
"go.temporal.io/sdk/workflow" | ||
) | ||
|
||
func TestIdempotencyKeyGeneration(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this key is not used currently, I support no integration test with it. May want one to confirm counter is workflow-specific and replay safe though in the impl that does use it.
Co-authored-by: Jacob LeGrone <jlegrone@users.noreply.github.com>
What was changed
This PR adds a new
IdempotencyKey
field toTracerStartSpanOptions
and sets this field on spans created from theWorkflowInboundInterceptor
tracing implementation.Why?
This option can be used to compute a deterministic span ID automatically for tracing implementations which support specifying an explicit span ID. This is being proposed as an alternative to the way we're computing the
RunWorkflow
span ID in #921.This approach might also be used to provide a safe interface for handling custom spans created by end users in workflow code.
Checklist
N/A
See new unit test for creating idempotency keys. There are no existing tracing implementations in tree which support explicit spans, but we may be able to add additional tests in #921 if this is merged.
No