Skip to content

Commit 8f535f8

Browse files
authored
core/services/workflows/v2: add cre context to workflow_execution traces (#21619)
1 parent e2d80dc commit 8f535f8

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

core/services/workflows/v2/engine.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,11 +592,15 @@ func (e *Engine) handleAllTriggerEvents(ctx context.Context) {
592592
e.logger().Debugw("Scheduling a trigger event for execution", "eventID", eventID)
593593
e.srvcEng.GoCtx(context.WithoutCancel(ctx), func(ctx context.Context) {
594594
defer free()
595+
creCtx := contexts.CREValue(ctx)
595596
// Tracer is no-op if DebugMode is false
596597
ctx, span := e.tracer.Start(ctx, "workflow_execution",
597598
trace.WithAttributes(
598599
attribute.String("workflow_name", e.cfg.WorkflowName.String()),
599600
attribute.String("version", "v2"),
601+
attribute.String("org_id", creCtx.Org),
602+
attribute.String("owner_id", creCtx.Owner),
603+
attribute.String("workflow_id", creCtx.Workflow),
600604
))
601605
defer span.End()
602606
e.startExecution(ctx, queueHead)
@@ -660,6 +664,7 @@ func (e *Engine) startExecution(ctx context.Context, wrappedTriggerEvent enqueue
660664
}
661665
e.metrics.IncrementExecutionIDLegacyCounter(ctx)
662666
}
667+
trace.SpanFromContext(ctx).SetAttributes(attribute.String("execution_id", executionID))
663668

664669
// disallow duplicate executions
665670
_, addErr := e.cfg.ExecutionsStore.Add(ctx, nil, executionID, e.cfg.WorkflowID, store.StatusStarted)

0 commit comments

Comments
 (0)