-
-
Notifications
You must be signed in to change notification settings - Fork 452
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
bug: Set sentry-trace header when using tracing middleware #1331
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! Can you please update the CHANGELOG (remember to also reference the PR) and change the tests to ensure that no regression can happen in the future?
@ste93cry I updated the CHANGELOG and fixed up the tests (I had to rework the unit tests to properly test the request/response values from Guzzle.). Let me know what you think and thanks for the quick reply! |
I'm not sure I understand why the entire testing class had to be changed. The lambda that is returned from
What we want to assert is that the request contains the
|
I wanted to make sure the middleware was fully-working from the Guzzle client's configuration perspective (with the added benefit of removing PHPStan violations in the baseline since Guzzle would've been introduced as a dev dependency by using their MockHandler) but you're right -- this can be just the assertion on the header. I updated this in 72094da. If this test update is acceptable, I can either squash and force-push to my branch or you can do squash these commits on merge. 👍 |
According to PSR-7 (https://www.php-fig.org/psr/psr-7/), `withHeader` operates in the following manner: ``` Return an instance with the provided value replacing the specified header. [...] This method MUST be implemented in such a way as to retain the immutability of the message, and MUST return an instance that has the new and/or updated header and value. ``` Due to this, we must set `$request` to the modified request object (from the return value of withHeader) in order to actually send the sentry-trace header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Thanks for merging this @ste93cry - can't wait to use the distributed tracing capability! I noticed this was flagged for the |
Yes, since it's a bugfix it will be released with the next patch version. We usually wait a few days/weeks to see if more issues comes and then we make the release |
According to PSR-7,
withHeader
operates in the following manner:(see: https://www.php-fig.org/psr/psr-7/)
Due to this, we must set
$request
to the modified request object (from the return value ofwithHeader) in order to actually send the sentry-trace header.