-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[receiver/otlp] Return proper http response code based on retryable errors #9357
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
Changes from 8 commits
795c9bf
f95ea63
fa77168
da98ce8
b56f2bf
57d4ad8
9634c18
e765bba
6e76aa2
d4d96ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Use this changelog template to create an entry for release notes. | ||
|
||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: bug_fix | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) | ||
component: receiver/otlp | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Fix bug where the otlp receiver did not properly respond with a retryable error code when possible for http | ||
|
||
# One or more tracking issues or pull requests related to the change | ||
issues: [9357] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: | ||
|
||
# Optional: The change log or logs in which this entry should be included. | ||
# e.g. '[user]' or '[user, api]' | ||
# Include 'user' if the change is relevant to end users. | ||
# Include 'api' if there is a change to a library API. | ||
# Default: '[user]' | ||
change_logs: [] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ import ( | |
"google.golang.org/grpc/codes" | ||
"google.golang.org/grpc/status" | ||
|
||
"go.opentelemetry.io/collector/receiver/otlpreceiver/internal/errors" | ||
"go.opentelemetry.io/collector/receiver/otlpreceiver/internal/logs" | ||
"go.opentelemetry.io/collector/receiver/otlpreceiver/internal/metrics" | ||
"go.opentelemetry.io/collector/receiver/otlpreceiver/internal/trace" | ||
|
@@ -42,7 +43,7 @@ func handleTraces(resp http.ResponseWriter, req *http.Request, tracesReceiver *t | |
|
||
otlpResp, err := tracesReceiver.Export(req.Context(), otlpReq) | ||
if err != nil { | ||
writeError(resp, enc, err, http.StatusInternalServerError) | ||
writeError(resp, enc, err, errors.GetHTTPStatusCodeFromStatus(err)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like that now we also have a similar but different logic in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. I took a look at consolidating before opening the PR. I believe it can be refactored, but it caused a lot of changes unrelated to the issue I was trying to solve. To keep the PRs smaller and targeted I'd like to use this PR as a solution to the issue and then a future PR that is only a refactor. I can open an issue to track that refactor if you'd like. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bogdandrutu are you ok with that approach? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created #9864 |
||
return | ||
} | ||
|
||
|
@@ -73,7 +74,7 @@ func handleMetrics(resp http.ResponseWriter, req *http.Request, metricsReceiver | |
|
||
otlpResp, err := metricsReceiver.Export(req.Context(), otlpReq) | ||
if err != nil { | ||
writeError(resp, enc, err, http.StatusInternalServerError) | ||
writeError(resp, enc, err, errors.GetHTTPStatusCodeFromStatus(err)) | ||
return | ||
} | ||
|
||
|
@@ -104,7 +105,7 @@ func handleLogs(resp http.ResponseWriter, req *http.Request, logsReceiver *logs. | |
|
||
otlpResp, err := logsReceiver.Export(req.Context(), otlpReq) | ||
if err != nil { | ||
writeError(resp, enc, err, http.StatusInternalServerError) | ||
writeError(resp, enc, err, errors.GetHTTPStatusCodeFromStatus(err)) | ||
return | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.