Skip to content
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

fix(TraceableHttpClient): span finishes too early #105

Merged
merged 2 commits into from
Dec 22, 2024

Conversation

Kaspiman
Copy link
Contributor

The client works asynchronously. Due to the finally construction, the span is immediately closed, without reflecting the actual result of the request. TraceableResponse class already finished span correctly.

@Kaspiman Kaspiman requested a review from a team as a code owner December 22, 2024 13:33
@Kaspiman
Copy link
Contributor Author

@gaelreyrol Hello! New issue was resolved! I've made a number of improvements to release the package in a private repository at my company. I'm ready to quickly move them to your repository. Working together we can release a stable release.

Copy link

codecov bot commented Dec 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.51%. Comparing base (b50c27a) to head (98d0b84).
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #105      +/-   ##
============================================
+ Coverage     88.16%   88.51%   +0.34%     
+ Complexity      635      633       -2     
============================================
  Files           115      115              
  Lines          2620     2612       -8     
============================================
+ Hits           2310     2312       +2     
+ Misses          310      300      -10     
Flag Coverage Δ
phpunit 88.51% <100.00%> (+0.34%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gaelreyrol
Copy link
Contributor

gaelreyrol commented Dec 22, 2024

Hi @Kaspiman! Good catch, I remember that the assertions in the tests were a bit strange but I didn't have the time to dive into it.

I am not sure why the tests does not cover your changes, are you able to break in the catch to see if the code block is executed in the testException case ?

Thanks again for your work!

@gaelreyrol gaelreyrol assigned Kaspiman and unassigned gaelreyrol Dec 22, 2024
@Kaspiman
Copy link
Contributor Author

Kaspiman commented Dec 22, 2024

The exception catch code will never be executed. The response will always be returned successfully, so I removed that catch. The exception will be handled in the same way in TraceableResponse::endSpan. Look at similar http-client in similar repository https://github.com/worldia/instrumentation-bundle/blob/master/src/Http/TracingHttpClient.php#L72

@gaelreyrol
Copy link
Contributor

The exception catch code will never be executed. The response will always be returned successfully, so I removed that catch. The exception will be handled in the same way in TraceableResponse::endSpan. Look at similar http-client in similar repository https://github.com/worldia/instrumentation-bundle/blob/master/src/Http/TracingHttpClient.php#L72

Indeed, it's been a while since I worked on this project, I need catch up.

Signed-off-by: Plakhotnikov Vladimir <v.plahotnikov@yclients.tech>
Signed-off-by: Plakhotnikov Vladimir <v.plahotnikov@yclients.tech>
@gaelreyrol gaelreyrol merged commit ea237a0 into FriendsOfOpenTelemetry:main Dec 22, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants