Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Litarnus
Copy link
Contributor

@Litarnus Litarnus commented Sep 8, 2025

This PR addresses the issue that breadcrumbs would "leak" into future messages.

We didn't create new scopes per message which meant that the breadcrumbs would just continue to grow and each message would contain breadcrumbs of all previous messages, which can be confusing when debugging.

We introduce a new option now to enable the breadcrumbs per message, which defaults to false as this was the previous behaviour and in some cases, breadcrumbs from previous messages might provide valuable insights.

closes #672

@Litarnus Litarnus marked this pull request as ready for review September 8, 2025 11:26
cursor[bot]

This comment was marked as outdated.

@Litarnus Litarnus merged commit 8728790 into master Sep 11, 2025
40 checks passed
@Litarnus Litarnus deleted the martinl/messenger-breadcrumb-reset branch September 11, 2025 13:20
@kkevindev
Copy link

Any idea when this might be released? @Litarnus @cleptric

@Litarnus
Copy link
Contributor Author

@kkevindev within the next hour

@@ -187,6 +187,7 @@ private function addMessengerSection(ArrayNodeDefinition $rootNode): void
->{interface_exists(MessageBusInterface::class) ? 'canBeDisabled' : 'canBeEnabled'}()
->children()
->booleanNode('capture_soft_fails')->defaultTrue()->end()
->booleanNode('isolate_breadcrumbs_by_message')->defaultFalse()->end()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd argue that having isolate_breadcrumbs_by_message set to false by default is correct for now as it otherwise would break bc, but should be deprecated right away as it should be true by default in the future. The main argument is that messages (like requests) are handled separately already, and many of the services in the framework do already get reset on kernel.terminate.

Maybe you can even rely on the Symfony\Contracts\Service\ResetInterface in favor of the WorkerMessageReceivedEvent that you are currently using?

Copy link
Contributor Author

@Litarnus Litarnus Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! I agree that it should be true by default and we should do this in the next major.

I will also explore Symfony\Contracts\Service\ResetInterface and see if we can use it here.

@Litarnus
Copy link
Contributor Author

@kkevindev sorry to disappoint but we will release it tomorrow. I'll ping you once it's released

@Litarnus
Copy link
Contributor Author

@kkevindev happy to let you know that we just released this changes in 5.5.0

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

Successfully merging this pull request may close these issues.

When using the new breadcrumbs handler with Messenger, the Messenger should either flush or clear *before* every new message
4 participants