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

Properly handle error code translation #10574

Merged

Conversation

TylerHelmuth
Copy link
Member

Description

Fixes a bug where the otlpreceiver was not translating grpc error codes to http status codes the same way that the otlp exporter was translating http status codes to grpc error codes.

Link to tracking issue

Fixes #10538

Testing

Added unit tests

@TylerHelmuth TylerHelmuth requested review from a team and evan-bradley July 9, 2024 19:55
Copy link

codecov bot commented Jul 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.33%. Comparing base (d37fe6c) to head (ef08de0).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10574      +/-   ##
==========================================
- Coverage   92.34%   92.33%   -0.01%     
==========================================
  Files         395      395              
  Lines       18669    18681      +12     
==========================================
+ Hits        17240    17250      +10     
- Misses       1069     1070       +1     
- Partials      360      361       +1     

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

Copy link
Contributor

@evan-bradley evan-bradley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified with NewStatusFromMsgAndHTTPCode and the two conversions should match now.

@@ -40,6 +40,18 @@ func GetHTTPStatusCodeFromStatus(s *status.Status) int {
case codes.ResourceExhausted:
return http.StatusTooManyRequests
// Not Retryable
case codes.InvalidArgument:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TylerHelmuth maybe we should this function and its tests to the helper i made last time? https://github.com/open-telemetry/opentelemetry-collector/blob/af33ac5acc08dbeb43426f86b526d2cfd29318ab/internal/httphelper/helper.go#L15C6-L15C33

That way the conversions are in the same place

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaronoff97 it is all moving (and properly solved by remembering the actual http status code) via #9041, so we should stick with that PR so the permanent solution to this issue. This PR fixes the bug for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool! I have no problem with that :D

@codeboten codeboten merged commit 09a929e into open-telemetry:main Jul 11, 2024
50 checks passed
@github-actions github-actions bot added this to the next release milestone Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wrong status code set in tracing spans
4 participants