Add tracing for trigger activities in workflow execution
Enhanced the OpenTelemetry tracing middleware to include detailed information about the triggered activity within the workflow execution. This change adds tags for the activity ID, name, and type to provide better observability and debugging insights.
This commit is contained in:
parent
078f34fd79
commit
02f1b56eb1
|
|
@ -40,6 +40,15 @@ public class OpenTelemetryTracingWorkflowExecutionMiddleware(WorkflowMiddlewareD
|
|||
span.SetTag("workflowDefinition.version", workflow.Identity.Version);
|
||||
span.SetTag("workflowDefinition.name", workflow.WorkflowMetadata.Name);
|
||||
span.SetTag("workflowExecution.startTimeUtc", span.StartTimeUtc);
|
||||
|
||||
if(context.TriggerActivityId != null)
|
||||
{
|
||||
var activity = context.FindActivityById(context.TriggerActivityId) ?? throw new Exception($"Trigger activity with ID {context.TriggerActivityId} not found. This should not happen.");
|
||||
span.SetTag("workflowExecution.trigger.activityId", activity.Id);
|
||||
span.SetTag("workflowExecution.trigger.activityName", activity.Name);
|
||||
span.SetTag("workflowExecution.trigger.activityType", activity.Type);
|
||||
}
|
||||
|
||||
span.AddEvent(new ActivityEvent("Executing", tags: CreateStatusTags(context)));
|
||||
await Next(context);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue