-
Notifications
You must be signed in to change notification settings - Fork 184
Description
How do you use Sentry?
Sentry SaaS (sentry.io)
SDK version
- sentry/sentry: 4.17.1
- sentry/sentry-symfony: 5.6.0
Description
Similar to the breadcrumb leak issue fixed in #946, the new Sentry Logging feature (structured logs) exhibits the same behavior where logs are not properly isolated between Messenger messages. When an error occurs in a message handler, the associated logs include all logs from the entire worker lifecycle, including logs from other messages, Messenger startup/shutdown, and unrelated errors.
Steps to reproduce
-
Set up a Symfony application with:
- Sentry PHP SDK with Logging feature enabled (
enable_logs: true) - Sentry Symfony Bundle
- Monolog configured with
Sentry\Monolog\LogsHandler - Symfony Messenger with async messages
- Sentry PHP SDK with Logging feature enabled (
-
Configure the Messenger worker to process multiple messages
-
Create multiple message handlers that:
- Log information during processing
- One of them throws an exception
-
Run the Messenger worker and process several messages sequentially
-
Check the Sentry event for the failed message
Expected result
The Sentry error event should contain only logs related to the specific failed message, similar to how breadcrumbs are isolated when isolate_breadcrumbs_by_message: true is configured.
Actual result
The Sentry error event contains all logs from the entire worker session, including:
- Logs from other successfully processed messages
- Logs from other failed messages
- Messenger worker startup/shutdown logs
- All logs accumulated since the worker started
You can see that I receive the logs on the same trace when I close the Symfony Messenger worker 10 minutes later. You can also see the logs for the other messages, including the message with retry.
Thank you for your time. I am willing to investigate further if necessary 😉
Metadata
Metadata
Assignees
Labels
Projects
Status