-
Notifications
You must be signed in to change notification settings - Fork 670
Fix client metrics recording on round trip error #7146
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 client metrics recording on round trip error #7146
Conversation
Duplicating code like isn't really maintainable long-term. We should be able to have the metrics recorded, with no code duplication. Possibly, by exporting the metric into its own method. Also, this needs to be tested. |
Thank you for the review @dmathieu What do you think of my latest commit? I’ve added a method to record metrics and removed most of the unnecessary code duplication. Thank you. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7146 +/- ##
=====================================
Coverage 81.5% 81.5%
=====================================
Files 198 198
Lines 17952 17961 +9
=====================================
+ Hits 14634 14643 +9
Misses 2918 2918
Partials 400 400
🚀 New features to boost your workflow:
|
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.
Could you add a test?
Thank you for the review @dmathieu Please check my latest commit. Thank you! |
This should close #6940 |
@alimikegami the CI has been failing since your last commit. Could you fix it? |
I'll fix it as soon as possible! |
![]() Hi @dmathieu, I've run the tests on my local machine, but I’m not seeing the Here's the test output from my local environment: Do you know what might be causing the difference in metric names between the CI environment and my local machine? |
This error would hint on the semconv migration. Is your commit based on a rather old commit in this repo? |
Thank you for the explanation, @dmathieu. It cleared up my confusion. Please kindly review my test and implementation! I have fixed the failing tests. Thank you! |
Co-authored-by: Damien Mathieu <[email protected]>
I've committed the CHANGELOG update and removed the |
Hi @dmathieu, I’ve moved the entry to the unreleased section. Would it be possible to get this merged, or is there anything I need to do on my end? Thank you! |
We need a second approval. |
Understood, thank you! |
….com/alimikegami/opentelemetry-go-contrib into fix/6940-otelhttp-client-metrics-error
I've refactored the code according to your suggestions, @pellared. Please have a look at my latest commit. Thank you! |
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.
@dmathieu, can you take another look please?
The latest changes appear to break the tests. |
I am not sure why but some tests are missing http.response.status_code
attribute.
This pull request fixes client metrics recording on round trip error
Related issues: #6940
Does this approach correctly address the issue with round trip errors?
Should I add specific tests to verify metric recording (
http.client.duration
) during round trip errors?