sentry-python icon indicating copy to clipboard operation
sentry-python copied to clipboard

Django Integration complex url regex pattern cleanup

Open PeterW-LWL opened this issue 3 years ago • 1 comments

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.

PeterW-LWL avatar Jul 29 '22 09:07 PeterW-LWL

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

sentrivana avatar Oct 10 '23 15:10 sentrivana

As this is about transaction names and we are in the middle of switching the performance instrumentation (the part in the SDK that creates transactions) to OpenTelemetry, this problem will be solved in the next major, because then the Sentry SDK will use OpenTelementry under the hood to create those transactions and OpenTelementry will set those transaction names.

antonpirker avatar Mar 20 '25 15:03 antonpirker