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

Sentry does not send events to server in messenger context #259

Closed
bjalt opened this issue Oct 10, 2019 · 7 comments
Closed

Sentry does not send events to server in messenger context #259

bjalt opened this issue Oct 10, 2019 · 7 comments

Comments

@bjalt
Copy link

bjalt commented Oct 10, 2019

The sentry/sentry/src/Transport/HttpTransport.php:81 will not send events while running in a worker process. Switching the statement to $promise = $this->httpClient->sendRequest($request); will work.
One can also observer how the $this->pendingRequests[] is holding all the pending request. But non is getting send to the sentry server for display in the sentry frontend.

Can You please advice how to continue?

@bjalt
Copy link
Author

bjalt commented Oct 10, 2019

Found there is already an issue open about this: getsentry/sentry-php#811

@bjalt bjalt closed this as completed Oct 10, 2019
@dpinheiro
Copy link

Although the referenced issue has been closed still I can't get the messenger errors to show up on sentry. Any update to this?

@Jean85
Copy link
Collaborator

Jean85 commented Mar 9, 2020

getsentry/sentry-php#813 was released with the 2.1.2 client. You could try to call flush() when the messenger dispatches some event that marks the end of a single message?

If that fixes it, I could accept a PR implementing the same, like an additional listener.

Also: do you receive any message if the worker shuts down? Like, if you set it up to shut down every N messages?

@dpinheiro
Copy link

dpinheiro commented Mar 15, 2020

Sorry for the late reply. You mean the sentry flush() method? I can give it a try

I just tried to set messenger to shutdown after X seconds but no messages sent, I will try to debug the problem

@Jean85
Copy link
Collaborator

Jean85 commented Mar 16, 2020

Ok. If no message is being sent at all, it may be that you have something else broken. I would suggest you to use the sentry:test command to see if sending a simple event from CLI works at all.

Feel free to open a different issue if you need it.

@emarref
Copy link
Contributor

emarref commented Mar 18, 2020

I have found that subscribing to the WorkerMessageFailedEvent event is a good way to do it. E.g. https://gist.github.com/emarref/d8f7c2e071e334b39a5042b06927f881

Is it worth creating a pull request adding this subscriber if the application is using Messenger?

@Jean85
Copy link
Collaborator

Jean85 commented Mar 18, 2020

Yes it is!

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

No branches or pull requests

4 participants