Skip to content

Commit

Permalink
feat(.NET): ASP.NET transaction namesource (#7866)
Browse files Browse the repository at this point in the history
  • Loading branch information
bitsandfoxes authored Sep 19, 2023
1 parent a5bd9ca commit f20bb75
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/platforms/dotnet/guides/aspnet/performance/troubleshooting.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: Troubleshooting
sidebar_order: 100
description: "Learn more about how to troubleshoot performance issues with the ASP.NET SDK."
---

## Transactions get grouped together as `GET /*/*.`

The SDK creates the transaction name as follows

```csharp
var method = httpContext.Request.HttpMethod;
var path = httpContext.Request.Path;

var transactionName = $"{method} {path}";

// Since the name is derived from the path and potentially contains identifiers it is marked as such
transactionContext.NameSource = TransactionNameSource.Url;
```

Since the `URL` might contain potential identifiers, such as `GET /users/123`, the backend tries to remove values with high variations. Leading it to `GET /users/*`. Sometimes, when there are many paths, it can result in `GET /*/*`.
It is possible to work around this and still rely on automatic performance instrumentation. You can access the currently active transaction and overwrite the `Name` and `NameSource`. Specifying the exact name of the transaction, without any variables. Using the example above, it would look like:

```csharp
if (SentrySdk.GetSpan()?.GetTransaction() is TransactionTracer transactionTracer)
{
transactionTracer.NameSource = TransactionNameSource.Custom;
transactionTracer.Name = "GET /users/{id}";
}

```

1 comment on commit f20bb75

@vercel
Copy link

@vercel vercel bot commented on f20bb75 Sep 19, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

sentry-docs – ./

sentry-docs-git-master.sentry.dev
sentry-docs.sentry.dev
docs.sentry.io

Please sign in to comment.