Skip to content

Commit f20bb75

Browse files
authored
feat(.NET): ASP.NET transaction namesource (#7866)
1 parent a5bd9ca commit f20bb75

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: Troubleshooting
3+
sidebar_order: 100
4+
description: "Learn more about how to troubleshoot performance issues with the ASP.NET SDK."
5+
---
6+
7+
## Transactions get grouped together as `GET /*/*.`
8+
9+
The SDK creates the transaction name as follows
10+
11+
```csharp
12+
var method = httpContext.Request.HttpMethod;
13+
var path = httpContext.Request.Path;
14+
15+
var transactionName = $"{method} {path}";
16+
17+
// Since the name is derived from the path and potentially contains identifiers it is marked as such
18+
transactionContext.NameSource = TransactionNameSource.Url;
19+
```
20+
21+
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 /*/*`.
22+
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:
23+
24+
```csharp
25+
if (SentrySdk.GetSpan()?.GetTransaction() is TransactionTracer transactionTracer)
26+
{
27+
transactionTracer.NameSource = TransactionNameSource.Custom;
28+
transactionTracer.Name = "GET /users/{id}";
29+
}
30+
31+
```

0 commit comments

Comments
 (0)