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

Clear Sentry breadcrumbs at the end of every request #17

Merged
merged 1 commit into from
Sep 18, 2020
Merged

Clear Sentry breadcrumbs at the end of every request #17

merged 1 commit into from
Sep 18, 2020

Conversation

hugochinchilla
Copy link
Contributor

We are seeing breadcrumbs from previous requests on our traces in Sentry, this makes it less useful for debugging and also causes the memory usage to increase between requests.

@Baldinof
Copy link
Owner

Hi, thank you for using this bundle :)

The listener you modified is called only on worker stop (process exit) and not on every request.

A good place to fix this is in the middleware, where a configureScope() is already called: https://github.com/Baldinof/roadrunner-bundle/blob/master/src/Http/Middleware/SentryMiddleware.php#L65

@Baldinof
Copy link
Owner

Also, I see that Scope has a clear() method, maybe it's a good idea to call this to clear all contextual data on the new request?

@hugochinchilla
Copy link
Contributor Author

@Baldinof you are right, i have changed the code to use this method instead.

@Baldinof
Copy link
Owner

I don't see the new diff, did you pushed it?

@hugochinchilla
Copy link
Contributor Author

Sorry, it's pushed now

@Baldinof
Copy link
Owner

👍

Can you call clear() in the SentryMiddlware instead of on the WorkerStopEvent?

@hugochinchilla
Copy link
Contributor Author

I moved the code to the middleware and added a test case.

@Baldinof
Copy link
Owner

Perfect!

Can you run composer cs:fix to fix the failing CI job?

@hugochinchilla
Copy link
Contributor Author

Done!

@Baldinof Baldinof merged commit 7d77ef8 into Baldinof:master Sep 18, 2020
@Baldinof
Copy link
Owner

Thank you :)

@Baldinof
Copy link
Owner

I released 1.3.2 with your fix.

@hugochinchilla
Copy link
Contributor Author

Thank you very much!!

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

Successfully merging this pull request may close these issues.

None yet

2 participants