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

Provide a way for users to define a Transaction name (Avoid Unknown Route ) #1373

Closed
bruno-garcia opened this issue Dec 7, 2021 · 3 comments
Labels

Comments

@bruno-garcia
Copy link
Member

Currently, unless the route is known via endpoint routing or MVC, the SDK creates transactions named Unknown Route. This is suboptiomal as there are many cases where the route should just. be the path (i.e: Static files).

The problem with defaulting to that is that it's possible some middleware is handling things dynamically like /something/GUID and those would break the grouping of transactions (it should be /something/{id} as a transaction name instead of a new transaction for each GUID).

We need to provide an API for users to define what should be defined as a transaction and what should fallback to Unknown Route.

@lucas-zimerman
Copy link
Collaborator

My suggestion would be to alter the interface https://github.com/getsentry/sentry-dotnet/blob/main/src/Sentry.AspNetCore/ISentryRouteName.cs
to

namespace Sentry.AspNetCore;

public interface ISentryRouteName
{
    string? GetRouteName(HttpContext context);
}

Then add an extension to SentryAspNetCoreOptions where the user is able to register his class.
Lastly, we could check here

if the user registered the extension and invoke the following code:

    httpContext.Features.Set<ISentryRouteName>(UserSentryRouteName);

@bruno-garcia
Copy link
Member Author

@lucas-zimerman not sure I follow. How much effort would it be to have a PoC for this so we can have an idea?
This keeps coming up. And even on my experience with nugettrends.com it's rather annoying to have those when I'd like to see the static files it served, for example.

Additionally, how would we support other frameworks that themselves would have routes? Like servicestack

@mattjohnsonpint
Copy link
Contributor

Completed in #1421

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

5 participants