Skip to content

feat(.NET): ASP.NET transaction namesource #7866

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

Merged
merged 6 commits into from
Sep 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}";
}

```