getsentry / sentry-python

The official Python SDK for Sentry.io
https://sentry.io/for/python/
MIT License
1.93k stars 510 forks source link

Django Integration complex url regex pattern cleanup #1527

Open PeterW-LWL opened 2 years ago

PeterW-LWL commented 2 years ago

Problem Statement

When using pythons sentry_sdk with Django and DjangoCMS using the default configuration for the DjangoIntegration I get a transactions {slug},w/]+)/.
This comes from the complex regex '^(?P<slug>[$\\-_.+!*(),\\w//]+)/$' which comes from DjangoCMS urls.py constants.py.

I expect even a complex regex like the above to get cleaned to just /{slug}/

Solution Brainstorm

Improve the regex filter in https://github.com/getsentry/sentry-python/blob/9857bc97ff5f8c34cbc667f7bfde35323f0531a9/sentry_sdk/integrations/django/transactions.py#L48
Maybe even add a spezial case for this complex regex from DjangoCMS.

sentrivana commented 1 year ago

Reopening this since we'll be reverting the related PR. See https://github.com/getsentry/sentry-python/issues/2392#issuecomment-1755797139 for more info.