@@ -35,19 +35,6 @@ internal static Activity StartPoll(string type)
35
35
36
36
return activity ;
37
37
}
38
-
39
- internal static void Enrich ( WorkflowInstance workflow , string action )
40
- {
41
- var activity = Activity . Current ;
42
- if ( activity != null )
43
- {
44
- activity . DisplayName = $ "workflow { action } { workflow . WorkflowDefinitionId } ";
45
- activity . SetTag ( "workflow.id" , workflow . Id ) ;
46
- activity . SetTag ( "workflow.definition" , workflow . WorkflowDefinitionId ) ;
47
- activity . SetTag ( "workflow.status" , workflow . Status ) ;
48
- }
49
- }
50
-
51
38
internal static void Enrich ( WorkflowStep workflowStep )
52
39
{
53
40
var activity = Activity . Current ;
@@ -57,10 +44,18 @@ internal static void Enrich(WorkflowStep workflowStep)
57
44
? "inline"
58
45
: workflowStep . Name ;
59
46
60
- activity . DisplayName += $ " step { stepName } ";
47
+ if ( string . IsNullOrEmpty ( activity . DisplayName ) )
48
+ {
49
+ activity . DisplayName = $ "step { stepName } ";
50
+ }
51
+ else
52
+ {
53
+ activity . DisplayName += $ " step { stepName } ";
54
+ }
55
+
61
56
activity . SetTag ( "workflow.step.id" , workflowStep . Id ) ;
62
57
activity . SetTag ( "workflow.step.name" , stepName ) ;
63
- activity . SetTag ( "workflow.step.type" , workflowStep . BodyType . Name ) ;
58
+ activity . SetTag ( "workflow.step.type" , workflowStep . BodyType ? . Name ) ;
64
59
}
65
60
}
66
61
@@ -69,10 +64,10 @@ internal static void Enrich(WorkflowExecutorResult result)
69
64
var activity = Activity . Current ;
70
65
if ( activity != null )
71
66
{
72
- activity . SetTag ( "workflow.subscriptions.count" , result . Subscriptions . Count ) ;
73
- activity . SetTag ( "workflow.errors.count" , result . Errors . Count ) ;
67
+ activity . SetTag ( "workflow.subscriptions.count" , result ? . Subscriptions ? . Count ) ;
68
+ activity . SetTag ( "workflow.errors.count" , result ? . Errors ? . Count ) ;
74
69
75
- if ( result . Errors . Count > 0 )
70
+ if ( result ? . Errors ? . Count > 0 )
76
71
{
77
72
activity . SetStatus ( Status . Error ) ;
78
73
activity . SetStatus ( ActivityStatusCode . Error ) ;
@@ -85,10 +80,10 @@ internal static void Enrich(Event evt)
85
80
var activity = Activity . Current ;
86
81
if ( activity != null )
87
82
{
88
- activity . DisplayName = $ "workflow process { evt . EventName } ";
89
- activity . SetTag ( "workflow.event.id" , evt . Id ) ;
90
- activity . SetTag ( "workflow.event.name" , evt . EventName ) ;
91
- activity . SetTag ( "workflow.event.processed" , evt . IsProcessed ) ;
83
+ activity . DisplayName = $ "workflow process { evt ? . EventName } ";
84
+ activity . SetTag ( "workflow.event.id" , evt ? . Id ) ;
85
+ activity . SetTag ( "workflow.event.name" , evt ? . EventName ) ;
86
+ activity . SetTag ( "workflow.event.processed" , evt ? . IsProcessed ) ;
92
87
}
93
88
}
94
89
0 commit comments