Skip to content

Commit

Permalink
Show the error body when status code is unknown
Browse files Browse the repository at this point in the history
This can help to understand errors in the data better (for example
authentication, format errors).
  • Loading branch information
simonswine committed Oct 25, 2023
1 parent 3defe69 commit 3d645de
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion exporters/otlp/otlplogs/otlplogshttp/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@ func (d *httpClient) UploadLogs(ctx context.Context, protoLogs []*logspb.Resourc
}
return newResponseError(resp.Header)
default:
return fmt.Errorf("failed to send to %s: %s", request.URL, resp.Status)
body, _ := io.ReadAll(resp.Body)
return fmt.Errorf("failed to send to %s [%s]: %s", request.URL, body, resp.Status)
}
})
}
Expand Down

0 comments on commit 3d645de

Please sign in to comment.