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
When using Monolog\Handler informations added by sentry listeners are missing #250
Comments
Basically creating listener like this, before Sentry's one fixes the issue: public function __construct(HubInterface $hub) {
$this->hub = $hub;
}
public function onKernelRequest(GetResponseEvent $event): void
{
SentryBundle::setCurrentHub($this->hub);
} |
Overall there is missing info about how to use sentry in Symfony applications - should i use I consider myself static global functions as antipattern as it is hidden dependency and much harder to mock in tests. |
That's exactly what we discussed when we had to implement the Unified APIs in I agree that there should be only one hub in the app if the user doesn't create one itself. We should treat this as a bug and try to not create a duplicated hub as a side effect. |
I think this bug was introduced by #244, in particular by this removal: 8d90388#diff-09af2b221d2475b568160a53310abe2aL20-L22 |
Perfect, thank you. |
Hi, there is something very weird going on.
Here is my config
But when i log, etc
$this->logger->critical()
, event in sentry does not contain extra informations added bySentry\SentryBundle\EventListener\RequestListener
.By debugging i found out there are 2 different instances of
HubInterface
. 1 lives in our DI container and second on is in staticSentrySdk::$currentHub
property.What
RequestListener
does, is only saving this to the static hub, meanwhile in monolog handler, the instance from DI is wired:On a screenshot you can see these are 2 different instances of hubs, one contains client (created and autowired by DI) the other does not.
I am thinking, if there is not missing
SentrySdk::setCurrentHub()
with the hub created by DI?Maybe i am just missing something, but this causes many confusions for me.
This might be related to #247
The text was updated successfully, but these errors were encountered: