Make django middleware support 404 URL grouping based on sentry's fingerprint option#742
Make django middleware support 404 URL grouping based on sentry's fingerprint option#742fle wants to merge 1 commit intogetsentry:masterfrom
Conversation
|
I should add tests by the way |
|
Updated PR with some basic tests |
|
Just throwing in my two cents, I'm not a big fan of this implementation. I'd rather see this be done as a callback style thing. Maybe you want to use arguments from the url in the fingerprint, etc? I think that processing should be opened up with a hook. Also, as note, the Aside from that, I'm -0 on this feature as a whole. I feel like this would be better suited as just your own middleware that did whatever logic you want, rather than adding in an obscure hook like this imo. With that said, I'm not strongly against it and could be convinced otherwise. |
|
Got it @mattrobenolt. I tried to stay near the existing handling of ignorable urls in this middleware and the django implementation of IGNORABLE_404_URLS (re.compile). Go with my own middleware is OK for me too ;) |
|
@fle To be clear, I was mostly unhappy with this implementation. I think there's value in doing this as a hook on the So maybe something like: class Sentry404CatchMiddleware(object):
def get_fingerprint(self, request):
return None
def process_response(self, request, response):
# ...
fingerprint = self.get_fingerprint(request)
if fingerprint is not None:
# Add fingerprint into the kwargsThis would allow a subclass to just need to do: class MySentry404CatchMiddleware(Sentry404CatchMiddleware):
def get_fingerprint(self, request):
return ['lol']And do whatever logic someone wants there, instead of configuring through your Make sense? |
|
Also, I guess you are right about how This might even be useful to just have |
|
I totally agree. |
Hi,
Sentry provides a grouping feature through a fingerprint argument : Customize Grouping with Fingerprints.
Raven supports fingerprint since this commit : 0075d95.
This allows to group similar 404 URLs based on defined patterns in django settings.
A dummy example :
allows to group in sentry all URLs matching this regex.