@@ -39,10 +39,11 @@ public HubInstrumentationFilter(ILoggerFactory loggerFactory, IOptions<HubInstru
3939
4040 var hubName = invocationContext . Hub . GetType ( ) . Name ;
4141 var methodName = invocationContext . HubMethodName ;
42+ var connectionId = invocationContext . Context . ConnectionId ;
4243 var address = invocationContext . Context . GetHttpContext ( ) ? . Request . Host . Value ;
4344
4445 using var scope = HubLogger . BeginHubMethodInvocationScope ( _logger , hubName , methodName ) ;
45- using var activity = HubActivitySource . StartInvocationActivity ( hubName , methodName , address ) ;
46+ using var activity = HubActivitySource . StartInvocationActivity ( hubName , methodName , connectionId , address ) ;
4647
4748 try
4849 {
@@ -79,10 +80,11 @@ public HubInstrumentationFilter(ILoggerFactory loggerFactory, IOptions<HubInstru
7980 public async Task OnConnectedAsync ( HubLifetimeContext context , Func < HubLifetimeContext , Task > next )
8081 {
8182 var hubName = context . Hub . GetType ( ) . Name ;
83+ var connectionId = context . Context . ConnectionId ;
8284 var address = context . Context . GetHttpContext ( ) ? . Request . Host . Value ;
8385
8486 using var scope = HubLogger . BeginHubMethodInvocationScope ( _logger , hubName , nameof ( OnConnectedAsync ) ) ;
85- using var activity = HubActivitySource . StartInvocationActivity ( hubName , nameof ( OnConnectedAsync ) , address ) ;
87+ using var activity = HubActivitySource . StartInvocationActivity ( hubName , nameof ( OnConnectedAsync ) , connectionId , address ) ;
8688
8789 try
8890 {
@@ -114,10 +116,11 @@ public async Task OnDisconnectedAsync(
114116 Func < HubLifetimeContext , Exception ? , Task > next )
115117 {
116118 var hubName = context . Hub . GetType ( ) . Name ;
119+ var connectionId = context . Context . ConnectionId ;
117120 var address = context . Context . GetHttpContext ( ) ? . Request . Host . Value ;
118121
119122 using var scope = HubLogger . BeginHubMethodInvocationScope ( _logger , hubName , nameof ( OnDisconnectedAsync ) ) ;
120- using var activity = HubActivitySource . StartInvocationActivity ( hubName , nameof ( OnDisconnectedAsync ) , address ) ;
123+ using var activity = HubActivitySource . StartInvocationActivity ( hubName , nameof ( OnDisconnectedAsync ) , connectionId , address ) ;
121124
122125 try
123126 {
0 commit comments