newrelic / newrelic-php-agent

The New Relic PHP Agent
https://opensource.newrelic.com/projects/newrelic/newrelic-php-agent
Apache License 2.0
114 stars 60 forks source link

fix(agent): end guzzle's external segment for rejected request #883

Closed lavarou closed 1 month ago

lavarou commented 2 months ago

Modify the onRejected handler to end guzzle's external segment even when there's no response. This allows to mark the span as an external span and capture the uri and method of the request. Additionally when sync requests is rejected, onRejected callback is not called via PromiseInterface::then and needs to be called manually.

Fixes #320.

newrelic-php-agent-bot commented 2 months ago
Test Suite Status Result
Multiverse :white_check_mark: 9/9 passing
SOAK :white_check_mark: 56/56 passing
codecov-commenter commented 2 months ago

Codecov Report

Attention: Patch coverage is 84.61538% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 78.78%. Comparing base (85d74db) to head (0af9498). Report is 5 commits behind head on dev.

Files Patch % Lines
agent/lib_guzzle6.c 84.61% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #883 +/- ## ========================================== + Coverage 78.72% 78.78% +0.06% ========================================== Files 193 193 Lines 27214 27216 +2 ========================================== + Hits 21423 21443 +20 + Misses 5791 5773 -18 ``` | [Flag](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/883/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | Coverage Δ | | |---|---|---| | [agent-for-php-7.0](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/883/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `77.53% <84.61%> (+0.07%)` | :arrow_up: | | [agent-for-php-7.1](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/883/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `77.27% <80.00%> (+0.06%)` | :arrow_up: | | [agent-for-php-7.2](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/883/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `78.20% <80.00%> (+0.06%)` | :arrow_up: | | [agent-for-php-7.3](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/883/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `78.22% <80.00%> (+0.06%)` | :arrow_up: | | [agent-for-php-7.4](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/883/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `77.93% <80.00%> (+0.06%)` | :arrow_up: | | [agent-for-php-8.0](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/883/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `77.99% <81.81%> (+0.06%)` | :arrow_up: | | [agent-for-php-8.1](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/883/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `77.97% <81.81%> (+0.06%)` | :arrow_up: | | [agent-for-php-8.2](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/883/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `77.57% <81.81%> (+0.06%)` | :arrow_up: | | [agent-for-php-8.3](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/883/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `77.57% <81.81%> (+0.06%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

zsistla commented 1 month ago

Really nicely done! Thanks for addressing this issue.

Couple of tests comments, but otherwise, LGTM.