I'm working to set up distributed tracing for my application. One of the connections in the application is a WebSocket connection using SignalR. Both ends of the SignalR connection are asp.net core applications. One is a Windows service (the client) and the other runs under a web server (the server).
Communication will be sourced from both directions so I'll have TraceIds originating with requests on both sides of the connection. Does SignalR have a facility for passing this Trace information back and forth? I have searched all over and there is almost no information about SignalR supporting W3C Trace Contexts or even a custom implemented tracing system like .net core pre 2.0.
I have tried creating a new Activity when making a request on the server side but I don't think any trace information is making it to the client. I may not be looking in the right place, but when I check System.Diagnostics.Activity.CurrentActivity
on the client I only get null
even though on the server I had the following Activity at the time I made the call.
System.Diagnostics.Activity.Current
{System.Diagnostics.Activity}
ActivityTraceFlags: None
Baggage: {System.Collections.Generic.KeyValuePair<string, string>[0]}
Context: {System.Diagnostics.ActivityContext}
DisplayName: "Microsoft.AspNetCore.Hosting.HttpRequestIn"
Duration: {00:00:00}
Events: {System.Diagnostics.ActivityEvent[0]}
Id: "00-eb7a4125a171a6438a44ddda5a637cd0-f7c16b0bb8512443-00"
IdFormat: W3C
IsAllDataRequested: true
Kind: Internal
Links: {System.Diagnostics.ActivityLink[0]}
OperationName: "Microsoft.AspNetCore.Hosting.HttpRequestIn"
Parent: null
ParentId: null
ParentSpanId: {0000000000000000}
Recorded: false
RootId: "eb7a4125a171a6438a44ddda5a637cd0"
Source: {System.Diagnostics.ActivitySource}
SpanId: {f7c16b0bb8512443}
StartTimeUtc: {7/13/2021 11:26:13 PM}
TagObjects: {System.Collections.Generic.KeyValuePair<string, object>[0]}
Tags: {System.Collections.Generic.KeyValuePair<string, string>[0]}
TraceId: {eb7a4125a171a6438a44ddda5a637cd0}
TraceStateString: null
I hope someone out there can shed some light on this.
Thanks!
-=-=-=-= Edit -=-=-=-=
It looks like at least some level of W3C context tracing is supported by SignalR when hosted in a Blazor app. Not sure what to make of that though. https://github.com/dotnet/aspnetcore/issues/29846