Skip to content

Commit

Permalink
Add support to handle 404 and 405 http error code in OTLP exporter op…
Browse files Browse the repository at this point in the history
  • Loading branch information
rahuldimri authored Aug 5, 2022
1 parent ba6fe5a commit 72a0f1f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

- Bump to opentelemetry-proto v0.19.0. (#5823)
- Expose `Scope.Attributes` in pdata (#5826)
- Add support to handle 404, 405 http error code as permanent errors in OTLP exporter (#5827)

### 🧰 Bug fixes 🧰

Expand Down
4 changes: 4 additions & 0 deletions exporter/otlphttpexporter/otlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ func isPermanentClientFailure(code int) bool {
return true
case http.StatusRequestHeaderFieldsTooLarge:
return true
case http.StatusNotFound:
return true
case http.StatusMethodNotAllowed:
return true
default:
return false
}
Expand Down
9 changes: 8 additions & 1 deletion exporter/otlphttpexporter/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,14 @@ func TestErrorResponses(t *testing.T) {
{
name: "404",
responseStatus: http.StatusNotFound,
err: errors.New(errMsgPrefix + "404"),
err: status.New(codes.InvalidArgument, "Bad field"),
isPermErr: true,
},
{
name: "405",
responseStatus: http.StatusMethodNotAllowed,
err: status.New(codes.InvalidArgument, "Bad field"),
isPermErr: true,
},
{
name: "413",
Expand Down

0 comments on commit 72a0f1f

Please sign in to comment.