@@ -16,6 +16,9 @@ public static class RabbitMQActivitySource
16
16
internal const string MessageId = "messaging.message.id" ;
17
17
internal const string MessageConversationId = "messaging.message.conversation_id" ;
18
18
internal const string MessagingOperationType = "messaging.operation.type" ;
19
+ internal const string MessagingOperationTypeSend = "send" ;
20
+ internal const string MessagingOperationTypeProcess = "process" ;
21
+ internal const string MessagingOperationTypeReceive = "receive" ;
19
22
internal const string MessagingSystem = "messaging.system" ;
20
23
internal const string MessagingDestination = "messaging.destination.name" ;
21
24
internal const string MessagingDestinationRoutingKey = "messaging.rabbitmq.destination.routing_key" ;
@@ -63,14 +66,14 @@ public static class RabbitMQActivitySource
63
66
64
67
Activity ? activity = linkedContext == default
65
68
? s_publisherSource . StartRabbitMQActivity (
66
- UseRoutingKeyAsOperationName ? $ "{ routingKey } send " : "send" ,
69
+ UseRoutingKeyAsOperationName ? $ "{ routingKey } { MessagingOperationTypeSend } " : MessagingOperationTypeSend ,
67
70
ActivityKind . Producer )
68
71
: s_publisherSource . StartLinkedRabbitMQActivity (
69
- UseRoutingKeyAsOperationName ? $ "{ routingKey } send " : "send" ,
72
+ UseRoutingKeyAsOperationName ? $ "{ routingKey } { MessagingOperationTypeSend } " : MessagingOperationTypeSend ,
70
73
ActivityKind . Producer , linkedContext ) ;
71
74
if ( activity != null && activity . IsAllDataRequested )
72
75
{
73
- PopulateMessagingTags ( "send" , routingKey , exchange , 0 , bodySize , activity ) ;
76
+ PopulateMessagingTags ( MessagingOperationTypeSend , routingKey , exchange , 0 , bodySize , activity ) ;
74
77
}
75
78
76
79
return activity ;
@@ -85,12 +88,12 @@ public static class RabbitMQActivitySource
85
88
}
86
89
87
90
Activity ? activity = s_subscriberSource . StartRabbitMQActivity (
88
- UseRoutingKeyAsOperationName ? $ "{ queue } receive " : "receive" ,
91
+ UseRoutingKeyAsOperationName ? $ "{ queue } { MessagingOperationTypeReceive } " : MessagingOperationTypeReceive ,
89
92
ActivityKind . Consumer ) ;
90
93
if ( activity != null && activity . IsAllDataRequested )
91
94
{
92
95
activity
93
- . SetTag ( MessagingOperationType , "receive" )
96
+ . SetTag ( MessagingOperationType , MessagingOperationTypeReceive )
94
97
. SetTag ( MessagingDestination , "amq.default" ) ;
95
98
}
96
99
@@ -107,11 +110,11 @@ public static class RabbitMQActivitySource
107
110
108
111
// Extract the PropagationContext of the upstream parent from the message headers.
109
112
Activity ? activity = s_subscriberSource . StartLinkedRabbitMQActivity (
110
- UseRoutingKeyAsOperationName ? $ "{ routingKey } receive " : "receive" , ActivityKind . Consumer ,
113
+ UseRoutingKeyAsOperationName ? $ "{ routingKey } { MessagingOperationTypeReceive } " : MessagingOperationTypeReceive , ActivityKind . Consumer ,
111
114
ContextExtractor ( readOnlyBasicProperties ) ) ;
112
115
if ( activity != null && activity . IsAllDataRequested )
113
116
{
114
- PopulateMessagingTags ( "receive" , routingKey , exchange , deliveryTag , readOnlyBasicProperties ,
117
+ PopulateMessagingTags ( MessagingOperationTypeReceive , routingKey , exchange , deliveryTag , readOnlyBasicProperties ,
115
118
bodySize , activity ) ;
116
119
}
117
120
@@ -128,11 +131,11 @@ public static class RabbitMQActivitySource
128
131
129
132
// Extract the PropagationContext of the upstream parent from the message headers.
130
133
Activity ? activity = s_subscriberSource . StartLinkedRabbitMQActivity (
131
- UseRoutingKeyAsOperationName ? $ "{ routingKey } process " : "process" ,
134
+ UseRoutingKeyAsOperationName ? $ "{ routingKey } { MessagingOperationTypeProcess } " : MessagingOperationTypeProcess ,
132
135
ActivityKind . Consumer , ContextExtractor ( basicProperties ) ) ;
133
136
if ( activity != null && activity . IsAllDataRequested )
134
137
{
135
- PopulateMessagingTags ( "process" , routingKey , exchange ,
138
+ PopulateMessagingTags ( MessagingOperationTypeProcess , routingKey , exchange ,
136
139
deliveryTag , basicProperties , bodySize , activity ) ;
137
140
}
138
141
0 commit comments