sentry-symfony
sentry-symfony copied to clipboard
Option to setup integrations filter
sentry-php allows integrations option to be either a custom list of integrations or a callable what can filter the existing integrations:
https://github.com/getsentry/sentry-php/blob/ea704bbe145657a507d73cd8bf6cc017d269fffa/src/Options.php#L754
I'd like to use the latter but it seems the sentry-symfony package doesn't allow this. At least we were unable to find a working configuration:
sentry:
options:
integration: 'App\Library\Utils\SentryIntegrationFilter'
In OptionsResolver.php line 1057:
[Symfony\Component\OptionsResolver\Exception\InvalidOptionsException]
The option "integrations" with value array is expected to be of type "Sentry\Integration\IntegrationInterface[]" or "callable", but one of the elements is of type "App\Library\Utils\SentryIntegrationFilter".
It seems like this was implemented before (https://github.com/getsentry/sentry-symfony/issues/279) but got broken in 4.0? Unless my yaml is incorrect in which case please advise what's the correct way.
We want to disable the error handling integrations because they were causing weird issues for us. But we want to keep the other default integrations.
I am sure someone more in the Symfony know will be able to elaborate but shouldn't it look more like this: https://docs.sentry.io/platforms/php/guides/symfony/configuration/symfony-options/#callables?
That's not the issue. The class I used is implemented to have __invoke
method which makes the service itself a callable. In fact I'm using the very same approach for before_send and there it works:
sentry:
options:
before_send: App\Library\Logger\Processor\BeforeSendProcessor
services:
App\Library\Logger\Processor\BeforeSendProcessor: ~
The issue with integrations is that in the current version it always wants an array and passing a callback isn't allowed despite what the error message says.
The issue with integrations is that in the current version it always wants an array and passing a callback isn't allowed despite what the error message says.
This seems to be the case... https://github.com/getsentry/sentry-symfony/blob/3a16fdc381b289bfe7a9febd4eb88f7370ef90c2/src/DependencyInjection/Configuration.php#L54-L56
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog
or Status: In Progress
, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
Bump
This doesn't look like a bug, but rather a missing feature: looking at the code of version 3.5.x
I don't see anything pointing out to supporting passing a callable rather than an array of integrations
Ah yeah I got confused... it was implemented in sentry-php but sentry-symfony was never adapted to support it.
Note: I wanted to disable ModulesIntegration since the package versions are useless traffic for us but once again I ran into this exact issue. :(