We're using RoadRunner to run our website. It bootstraps multiple instances of your application (called workers) that wait for incoming requests. RoadRunner will pass a request object to the worker and the worker will have to pass back a response object. Anyway, you can find out more about how it works on the website. The implication is that you cannot use the globals $_GET, $_SERVER, etc. as the workers are just CLI processes.
I saw that you can pass a $request object to RequestIntegration::applyToEvent but it isn't clear to me who calls this function and how, if at all, I can pass my own request object.
I would appreciate some help, maybe this could also be added to the documentation.
Thank you!
RequestIntegration implements IntegrationInterface, and it's a default one. The integrations are registered with the Handler here:
https://github.com/getsentry/sentry-php/blob/2.3.1/src/Integration/Handler.php#L28-L50
Thanks! I'll try your suggestions and report back soon 馃檪
I've tested this and it does indeed work, thank you! One annoyance is that I had to copy the entire RequestIntegration class because it is marked as final and the processEvent method is private. I could've used the applyToEvent method but I didn't since it's marked as deprecated.
There is no alternative that doesn't require copying the whole 200+ lines of code right now, correct?
There is no alternative that doesn't require copying the whole 200+ lines of code right now, correct?
As of now I don't see either any way you could avoid copying the whole file. However, we may accept a callable or a factory in the constructor that will take care of providing the PSR-7 server request so that how this is done is not hardcoded. WDYT?
That would be great! I'm converting the Symfony request to a PSR request anyway, I basically just need a way to pass it to Sentry.
This would need to be scheduled for version 2.4, so it's not something that will happen soon. Would you like to create a PR to address this? Branch to target is develop