sdk-typescript icon indicating copy to clipboard operation
sdk-typescript copied to clipboard

[Feature Request] Add actual span time to spans create by workflow otel interceptors

Open bergundy opened this issue 3 years ago • 1 comments

Spans created in the workflow isolate use workflow task time which different than the actual processing time. Getting the actual time is useful for getting a clear picture of how a system behaves.

After discussing with the SDK team, we've decided not to use the real time for spans because a span can start in one workflow task and end in another, running on different workers and going through replays.

  • This means there's no way to reliably get the real start time when the span is finally emitted
  • We can avoid this scenario for spans generated by the interceptors but it's unavoidable if we want to let users create their own spans in workflow
    • This will in fact make the TS SDK the only SDK that supports user spans in Workflow code
    • Spans that span multiple workflow tasks require full determinism of workflow code in order for their IDs to be deterministically generated when replaying, if a user deploys a non deterministic update to their workflow code, tracing might break

bergundy avatar Nov 12 '21 15:11 bergundy

Use workflowInfo().unsafe.now()

bergundy avatar Jan 10 '23 17:01 bergundy