Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listen to SignalR server activities by default in ASP.NET Core #2429

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

BrennanConroy
Copy link

@BrennanConroy BrennanConroy commented Dec 18, 2024

Fixes #1998
Design discussion issue #1998

Changes

Adds activity source "Microsoft.AspNetCore.SignalR.Server" when calling AddAspNetCoreInstrumentation.
This activity source is new in .NET 9.0.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@github-actions github-actions bot added infra Infra work - CI/CD, code coverage, linters comp:instrumentation.aspnetcore Things related to OpenTelemetry.Instrumentation.AspNetCore labels Dec 18, 2024
@BrennanConroy BrennanConroy marked this pull request as ready for review December 18, 2024 00:30
@BrennanConroy BrennanConroy requested a review from a team as a code owner December 18, 2024 00:30
if (Environment.Version.Major >= 9)
{
// https://github.com/dotnet/aspnetcore/blob/6ae3ea387b20f6497b82897d613e9b8a6e31d69c/src/SignalR/server/Core/src/Internal/SignalRServerActivitySource.cs#L13C35-L13C70
builder.AddSource("Microsoft.AspNetCore.SignalR.Server");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these long (as in, really long) running server spans? I recall ApplicationInsights users complained about recording such long running spans, as that'd skew the latency calculations, and ended up ignoring those spans by default...

dotnet/aspnetcore#32084

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is the case, then we should not do this by default, as there is no API to "remove" a source once added to the provider....

Copy link
Author

@BrennanConroy BrennanConroy Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only long running span should be the http one that has the long running tag. All of the newly added SignalR spans are only for a specific operation.
{4852D1D1-3D32-4C73-8B65-823B1B13C9B6}

Most of the spans added by SignalR add the long running span as a link, but individually they are short lived operations.
{84468919-B48C-4E8C-9E4B-4793E39D5756}
The OnConnectedAsync and OnDisconnectedAsync spans are the only 2 that are parented under the long running span, but they are both very short lived spans themselves.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few years back, I collaborated with your team to introduce the http.long_running attribute in SignalR to help filter long-running HTTP requests in Application Insights .NET SDK. This effort was driven by significant customer feedback about long-running SignalR requests distorting request duration metrics.

With http.long_running part of the default ASP.NET Core instrumentation, customers might face similar issues if long-running spans are automatically included without a suppression mechanism. I recommend considering an option to filter these spans by default or providing a toggle to enable them explicitly before rolling this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:instrumentation.aspnetcore Things related to OpenTelemetry.Instrumentation.AspNetCore infra Infra work - CI/CD, code coverage, linters
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider 1st class support for SignalR tracing
3 participants