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

`ignore_transactions` option should support regular expressions

Open enumag opened this issue 2 years ago • 5 comments

Problem Statement

Currently ignore_transactions option is useless for anything but the most simplest cases such as GET /health. Any URLs with a variable somewhere in the path (typically an id or slug) can't be ignored using this option. The option was added to remove the need of fiddling with TracesSampler or BeforeSendProcessor but in these cases custom modifications of one of those are still necessary.

Solution Brainstorm

In my opinion the ignore_transactions option should support regular expressions for the provided URLs.

enumag avatar Jul 03 '23 06:07 enumag

A transaction name should not contain any variables and should instead be fully parameterized. Like /users/edit/1 should become /users/edit/{id} or similar. While we cannot enforce this in the PHP SDK, it's essential to do this manually, as the whole experience of the performance product is built around transactions being properly bucketed.

Hence I can't entirely agree with the sentiment that this option is useless, especially as our Laravel and Symfony SDKs set a parametrized transaction name by default.

cleptric avatar Jul 24 '23 11:07 cleptric

I see, I was unaware that the transaction name contains placeholders. I'm using sentry-symfony so presumably this is already the case there. In that case I think you can close this. Thank you for explaining!

enumag avatar Jul 24 '23 12:07 enumag

I'll leave this open, as I agree with you that having regex support for ignore_transactions and ignore_exceptions might benefit some folks.

I personally prefer these options to be explicit, but supporting both ways is definitely a nice-to-have feature.

cleptric avatar Jul 24 '23 13:07 cleptric

I'd recommend adding a note to the documentation of ignore_transactions about how the transaction names work. I thought it was simply the URL and was unaware that it contains (or is supposed to contain) placeholders.

enumag avatar Jul 24 '23 13:07 enumag

Yep, I can take a look and improve the docs around this. The way I envisioned it was that folks go to https://sentry.io/performance and copy the name of the transaction they want to ignore.

cleptric avatar Jul 24 '23 13:07 cleptric