Code Monkey home page Code Monkey logo

Comments (9)

odolbeau avatar odolbeau commented on June 9, 2024

Hi.
Could you please paste your whole configuration?
When you want to add extras config, it should be put under the right processor. In your case, I think you're adding extra configuration for your consumer (which doesn't know how to deal with those options).
You can take a at the configuration reference to have an example.

from swarrotbundle.

notFloran avatar notFloran commented on June 9, 2024

Hi !

My config :

swarrot:
    provider: pecl
    default_connection: rabbitmq
    default_command: swarrot.command.base
    connections:
        rabbitmq:
            host: "%rabbitmq_host%"
            port: "%rabbitmq_port%"
            login: "%rabbitmq_user%"
            password: "%rabbitmq_password%"
            vhost: "%rabbitmq_vhost%"
    consumers:
        voip_valorize_call:
            processor: voip.processor.valorize_call
            middleware_stack: # order matter
                - configurator: swarrot.processor.signal_handler
                - configurator: swarrot.processor.max_messages
                - configurator: swarrot.processor.max_execution_time
                - configurator: swarrot.processor.exception_catcher
                - configurator: app.processor_configurator.sentry_exception_catcher
                - configurator: swarrot.processor.ack
            extras:
                max_messages: 100
                max_execution_time: 300

The "extras" config works: when I execute the swarrot command without options 100 messages are handled.
But when I want to override this config with the --max-messages 1 option of the swarrot command, that doesn't works : 100 messages are handled, not 1

from swarrotbundle.

odolbeau avatar odolbeau commented on June 9, 2024

Your config should looks like this:

swarrot:
    provider: pecl
    default_connection: rabbitmq
    default_command: swarrot.command.base
    connections:
        rabbitmq:
            host: "%rabbitmq_host%"
            port: "%rabbitmq_port%"
            login: "%rabbitmq_user%"
            password: "%rabbitmq_password%"
            vhost: "%rabbitmq_vhost%"
    consumers:
        voip_valorize_call:
            processor: voip.processor.valorize_call
            middleware_stack: # order matter
                - configurator: swarrot.processor.signal_handler
                - configurator: swarrot.processor.max_messages
                  extras:
                      max_messages: 100
                - configurator: swarrot.processor.max_execution_time
                  extras:
                      max_execution_time: 300
                - configurator: swarrot.processor.exception_catcher
                - configurator: app.processor_configurator.sentry_exception_catcher
                - configurator: swarrot.processor.ack

Each extra config should be attached to the relevant configurator.
Can you confirm it works with this config?

I'll try to figure out why those options partly work when they are put under the customer instead of the right configurator.

BTW, I see that you're using a sentry_exception_catcher. Is it possible to share your code? Maybe in a gist if you think it's not something which can be merged in swarrot?

from swarrotbundle.

notFloran avatar notFloran commented on June 9, 2024

@odolbeau That works, thanks for your help !

For sentry, the code is here : https://gist.github.com/notFloran/c0e5f6290c498c5bc18ae188ecd389f8

Do you think the code is ok for a PR ?

from swarrotbundle.

odolbeau avatar odolbeau commented on June 9, 2024

Sorry, just found some time to take a look at your gist.

The code looks good to me.
I never used Sentry mysel. Is the $data a custom format you choose or is it documented somewhere?
Is there a limit a size for the data you sent?

Don't hesitate to open a PR for this Processor. :)

from swarrotbundle.

notFloran avatar notFloran commented on June 9, 2024

Sorry, just found some time to take a look at your gist.

no problem

The code looks good to me. I never used Sentry mysel. Is the $data a custom format you choose or is it documented somewhere?

$data is documented here -> https://docs.sentry.io/clients/php/usage/#optional-attributes

tags are used to find events in sentry and extra are additional data for the context.

Is there a limit a size for the data you sent?

In the doc I find this : Extra contextual data is limited to 4096 characters.

I will do some tests at work next week.

from swarrotbundle.

odolbeau avatar odolbeau commented on June 9, 2024

Thanks. :)

from swarrotbundle.

notFloran avatar notFloran commented on June 9, 2024

sentry-php cut $data when the lenght > 1024 -> https://github.com/getsentry/sentry-php/blob/master/lib/Raven/Serializer.php#L97

I will do a MR for the sentry processor.

from swarrotbundle.

odolbeau avatar odolbeau commented on June 9, 2024

Perfect. :)
Don't hesitate to add all those useful links into your MR. :)

from swarrotbundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.