open-telemetry / opentelemetry-go-contrib

Collection of extensions for OpenTelemetry-Go.
https://opentelemetry.io/
Apache License 2.0
1.08k stars 509 forks source link

xray client: return an error if the HTTP request failed #5718

Open jaedle opened 4 weeks ago

linux-foundation-easycla[bot] commented 4 weeks ago

CLA Signed

The committers listed above are authorized under a signed CLA.

jaedle commented 4 weeks ago

This needs a changelog entry

I added a changelog entry, I hope that fits the current style. If not, I would appreciate suggestions, thanks!

codecov[bot] commented 4 weeks ago

Codecov Report

Attention: Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.

Project coverage is 64.6%. Comparing base (b6a9271) to head (21a1bf7).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/open-telemetry/opentelemetry-go-contrib/pull/5718/graphs/tree.svg?width=650&height=150&src=pr&token=P6F3W9WA7Q&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry)](https://app.codecov.io/gh/open-telemetry/opentelemetry-go-contrib/pull/5718?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) ```diff @@ Coverage Diff @@ ## main #5718 +/- ## ===================================== Coverage 64.6% 64.6% ===================================== Files 202 202 Lines 12591 12595 +4 ===================================== + Hits 8134 8140 +6 + Misses 4221 4220 -1 + Partials 236 235 -1 ``` | [Files](https://app.codecov.io/gh/open-telemetry/opentelemetry-go-contrib/pull/5718?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | Coverage Δ | | |---|---|---| | [samplers/aws/xray/internal/client.go](https://app.codecov.io/gh/open-telemetry/opentelemetry-go-contrib/pull/5718?src=pr&el=tree&filepath=samplers%2Faws%2Fxray%2Finternal%2Fclient.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c2FtcGxlcnMvYXdzL3hyYXkvaW50ZXJuYWwvY2xpZW50Lmdv) | `86.9% <88.8%> (+6.0%)` | :arrow_up: |
dmathieu commented 3 weeks ago

cc @wangzlei as the soon to be owner of this instrumentation.

jaedle commented 6 days ago

I reworked the error messages and added test cases / assertions.

Some edge cases might be hard to test / not worth the effort like creating http requests.

I hope you can find some time to review the changes or to comment if there is a need for changes. :pray:

dmathieu commented 6 days ago

Your PR now does more than just checking for non-200 HTTP status code. Other fixes should be in new PRs, not in this one.

jaedle commented 6 days ago

Thanks for the feedback.

Following you gave a thumbs up on my comment above, I thought that would be appropriate.

If that’s fine for you, I would work on that within this PR.

Sorry for my confusion.

dmathieu commented 6 days ago

My comment was about assertion of errors in tests. You're also changing the errors content, and changing the way the response body is closed now.

jaedle commented 6 days ago

My comment was about assertion of errors in tests. You're also changing the errors content, and changing the way the response body is closed now.

Rolled back in a moment, thanks.

jaedle commented 6 days ago

Sorry for the change, the old way of dealing with response bodies was restored.