@@ -65,12 +65,18 @@ public static class RabbitMQActivitySource
65
65
new KeyValuePair < string , object ? > ( ProtocolVersion , "0.9.1" )
66
66
} ;
67
67
68
- internal static Activity ? OpenConnection ( IFrameHandler frameHandler )
68
+ internal static Activity ? OpenConnection ( bool isReconnection )
69
69
{
70
70
Activity ? connectionActivity =
71
71
s_connectionSource . StartRabbitMQActivity ( "connection attempt" , ActivityKind . Client ) ;
72
- connectionActivity ?
73
- . SetNetworkTags ( frameHandler ) ;
72
+ connectionActivity ? . SetTag ( "messaging.rabbitmq.connection.is_reconnection" , isReconnection ) ;
73
+ return connectionActivity ;
74
+ }
75
+
76
+ internal static Activity ? OpenTcpConnection ( )
77
+ {
78
+ Activity ? connectionActivity =
79
+ s_connectionSource . StartRabbitMQActivity ( "tcp connection attempt" , ActivityKind . Client ) ;
74
80
return connectionActivity ;
75
81
}
76
82
@@ -199,24 +205,7 @@ internal static void SetNetworkTags(this Activity? activity, IFrameHandler frame
199
205
{
200
206
if ( activity ? . IsAllDataRequested ?? false )
201
207
{
202
- switch ( frameHandler . RemoteEndPoint . AddressFamily )
203
- {
204
- case AddressFamily . InterNetworkV6 :
205
- activity . SetTag ( "network.type" , "ipv6" ) ;
206
- break ;
207
- case AddressFamily . InterNetwork :
208
- activity . SetTag ( "network.type" , "ipv4" ) ;
209
- break ;
210
- }
211
-
212
- if ( ! string . IsNullOrEmpty ( frameHandler . Endpoint . HostName ) )
213
- {
214
- activity
215
- . SetTag ( "server.address" , frameHandler . Endpoint . HostName ) ;
216
- }
217
-
218
- activity
219
- . SetTag ( "server.port" , frameHandler . Endpoint . Port ) ;
208
+ activity . SetServerTags ( frameHandler . Endpoint ) ;
220
209
221
210
if ( frameHandler . RemoteEndPoint is IPEndPoint ipEndpoint )
222
211
{
@@ -244,6 +233,28 @@ internal static void SetNetworkTags(this Activity? activity, IFrameHandler frame
244
233
}
245
234
}
246
235
236
+ internal static void SetServerTags ( this Activity activity , AmqpTcpEndpoint endpoint )
237
+ {
238
+ switch ( endpoint . AddressFamily )
239
+ {
240
+ case AddressFamily . InterNetworkV6 :
241
+ activity . SetTag ( "network.type" , "ipv6" ) ;
242
+ break ;
243
+ case AddressFamily . InterNetwork :
244
+ activity . SetTag ( "network.type" , "ipv4" ) ;
245
+ break ;
246
+ }
247
+
248
+ if ( ! string . IsNullOrEmpty ( endpoint . HostName ) )
249
+ {
250
+ activity
251
+ . SetTag ( "server.address" , endpoint . HostName ) ;
252
+ }
253
+
254
+ activity
255
+ . SetTag ( "server.port" , endpoint . Port ) ;
256
+ }
257
+
247
258
private static void DefaultContextInjector ( Activity sendActivity , IDictionary < string , object ? > props )
248
259
{
249
260
DistributedContextPropagator . Current . Inject ( sendActivity , props , DefaultContextSetter ) ;
0 commit comments