Skip to content

Clear Sentry breadcrumbs at the end of every request - #17

Merged
Baldinof merged 1 commit into
Baldinof:masterfrom
hugochinchilla:clear-sentry-breadcrumbs
Sep 18, 2020
Merged

Clear Sentry breadcrumbs at the end of every request#17
Baldinof merged 1 commit into
Baldinof:masterfrom
hugochinchilla:clear-sentry-breadcrumbs

Conversation

@hugochinchilla

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

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

@Baldinof

Copy link
Copy Markdown
Owner

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

@hugochinchilla

Copy link
Copy Markdown
Contributor Author

Sorry, it's pushed now

@Baldinof

Copy link
Copy Markdown
Owner

👍

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

@hugochinchilla

Copy link
Copy Markdown
Contributor Author

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

@Baldinof

Copy link
Copy Markdown
Owner

Perfect!

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

@hugochinchilla

Copy link
Copy Markdown
Contributor Author

Done!

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

Copy link
Copy Markdown
Owner

Thank you :)

@Baldinof

Copy link
Copy Markdown
Owner

I released 1.3.2 with your fix.

@hugochinchilla

Copy link
Copy Markdown
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

2 participants