aspnetcore/release-notes/aspnetcore-9/includes/signalrActivities.md
SignalR now has an ActivitySource for both the hub server and client.
The SignalR ActivitySource named Microsoft.AspNetCore.SignalR.Server emits events for hub method calls:
The following example uses the Aspire dashboard and the OpenTelemetry packages:
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
Add the following startup code to the Program.cs file:
The following is example output from the Aspire Dashboard:
:::image type="content" source="~/release-notes/aspnetcore-9/_static/signalr-activities-events.png" alt-text="Activity list for SignalR Hub method call events":::
The SignalR ActivitySource named Microsoft.AspNetCore.SignalR.Client emits events for a SignalR client:
ActivitySource named Microsoft.AspNetCore.SignalR.Client. Hub invocations now create a client span. Note that other SignalR clients, such as the JavaScript client, don't support tracing. This feature will be added to more clients in future releases.Here's how these new activities look in the Aspire dashboard: