-
-
Notifications
You must be signed in to change notification settings - Fork 206
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
SentryHttpMessageHandler issue grouping is too eager #3582
Comments
Hey @ericsampson , Could you give an example of some URLs that are being grouped together and how these would ideally be grouped instead? |
We're always looking at ways to improve the out-of-the-box experience. So some examples would be hugely appreciated. As one way to unblock yourself, you could look into setting your own custom fingerprint for events. |
@bitsandfoxes re the custom fingerprint option;
|
@jamescrosswell unless I'm misreading something in the dashboard, it currently appears that all called URLs are grouped into one single Issue. Because the default grouping that Sentry is choosing for these events is just the stack trace, which is identical regardless of the called URLs. In my ideal world, each of these lines would be captured as a separate Issue:
|
@ericsampson the options.SetBeforeSend((evt, hint) =>
{
if (evt.SentryExceptions?.Any(x => x.Mechanism is { Type: "SentryHttpFailedRequestHandler" }) is true)
{
if (evt.Request.Url != null)
{
evt.Fingerprint = [ evt.Request.Url ];
}
}
}); You can get a bunch of other information via the Hint as well (see docs). |
I see... I guess depending on the HttpStatusCode it may or may not make sense to group by Uri. So it might be preferable to group all the 429 Too Many Requests responses together (same for 503 Service Unavailable) but something like 403 Forbidden you probably want to group by URI (since the specific location is relevant to the error). Various other things like the request content and headers could also be relevant. I wonder if there is some "default behaviour" Sentry could provide, out of the box, that would provide useful fingerprinting in at least the majority of situations (without being able to know anything specific about the various use cases)... 🤔 |
@jamescrosswell I don't think there should be any status-code-dependent grouping for the default behavior. It should group by There's no way to universally classify any HTTP code as "entire server" vs "this specific HTTP call" IMO. For example it's very possible for 429 to be per-endpoint rate limits, and e.g 503 only means that the server is not unavailable to respond to that specific request--it could totally be possible for it to respond successfully to a different URL depending on what's going on behind the scenes. |
Yeah, reading through this again I think I agree with you... how HTTP Status codes are used is going to be specific to the server application. I'm wondering how we could |
For sure it's not going to be 100% perfect, but I think that this is one of those cases where "good enough is good enough" and "don't let perfect be the enemy of good". Start with a proposal like the following and then can adjust as user feedback is gained. Here's what I would suggest:
This isn't perfect because it won't catch textual URL path params, but should cover 95% of cases* seen in the real world |
btw @ericsampson how is it that you end up with the same stack trace for calls to lots of different external URLs? Are you looking up the actual URL to be called dynamically (rather than specifying this in code) prior to making the Http request? I'm mainly asking because I'd like to create a simple way to reproduce this problem. |
@jamescrosswell in our monolith, we have created tons of different external HTTP clients that all derive from a single base class The For every http call made by the HttClientBase that results in the We have not added any sentry dashboard custom Issue Grouping rules, so what we are seeing is stock Sentry behavior. Does that help? Thanks!! |
OK thanks @ericsampson. I think we can put together some code that will ensure the same stack trace when calling multiple different URLs, to simulate your scenario... From there it should be fairly simple to extend the Sentry SDK so that it has some callbacks or something on the options that you could use to customise the fingerprint for those outgoing URLs (and some default implementation of this that we provide out of the box). |
That sounds awesome, thanks James! |
@ericsampson is there a link to an issue in Sentry you you share? I wonder if perhaps the frames If not, I wonder if the stack trace is losing frames somehow. |
Problem Statement
When using the SentryHttpMessageHandler, errors from all called URLs get lumped into one Issue. That's not great as the grouping is too eager; it's not very helpful to bundle HTTP errors from 25 different microservices and 15 external SaaS providers into a single Issue.
Solution Brainstorm
I'd love if the grouping could use an auto-parameterized version of the called URL as a grouping key.
The text was updated successfully, but these errors were encountered: