Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to setup integrations filter #601

Open
enumag opened this issue Feb 17, 2022 · 8 comments
Open

Option to setup integrations filter #601

enumag opened this issue Feb 17, 2022 · 8 comments
Milestone

Comments

@enumag
Copy link

enumag commented Feb 17, 2022

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 (#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.

@stayallive
Copy link
Collaborator

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?

@enumag
Copy link
Author

enumag commented Feb 18, 2022

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.

@Jean85
Copy link
Collaborator

Jean85 commented Feb 18, 2022

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...

->arrayNode('integrations')
->scalarPrototype()->end()
->end()

@github-actions

This comment was marked as outdated.

@enumag
Copy link
Author

enumag commented Mar 12, 2022

Bump

@ste93cry
Copy link
Collaborator

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

@enumag
Copy link
Author

enumag commented Mar 12, 2022

Ah yeah I got confused... it was implemented in sentry-php but sentry-symfony was never adapted to support it.

@ste93cry ste93cry modified the milestones: 4.2, 4.3 Mar 12, 2022
@cleptric cleptric modified the milestones: 4.3, 4.4 Sep 5, 2022
@cleptric cleptric modified the milestones: 4.4, 4.5 Nov 21, 2022
@cleptric cleptric modified the milestones: 4.5.0, 4.6.0 Nov 28, 2022
@cleptric cleptric modified the milestones: 4.6.0, 4.7.0 Feb 20, 2023
@enumag
Copy link
Author

enumag commented Jul 3, 2023

Note: I wanted to disable ModulesIntegration since the package versions are useless traffic for us but once again I ran into this exact issue. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants