You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
In the otlphttpexporter exporter's otlp.go file, when the export HTTP response body is read using the function readResponseBody a value of nil, nil will be returned when resp.ContentLength is 0.
Later, that nil value is passed to one of the partial success handlers (e.g. tracesPartialSuccessHandler). No check is made for a nil value in the protoBytes argument, so an attempt to unmarshal the nil value is possible.
Edit: This is only the case when the content type is specified as "application/json". This does not apply when the content type is specified as "application/x-protobuf".
Steps to reproduce
Provide an empty in response to an export. Ensure that an expected Content-Type response header field is given, such as "application/json" or "application/x-protobuf".
What did you expect to see?
An empty response body should not result in an error. It is perfectly valid for the logic to continue without processing a response body.
What did you see instead?
An error is raised and the successful request is potentially retried after a backoff duration.
…response body is empty (#9667)
**Description:**
Fixing a bug - When exporting using the otlphttpexporter, after
receiving a successful HTTP response, when the response body's content
length is 0 and the content type is specified as either
"application/json" or "application/x-protobuf", an attempt will be made
to unmarshal a nil value within any of the partial success response
handler functions. This results in an error, and a potential resend of
the original export request.
To fix this scenario, a check was added to the
`tracesPartialSuccessHandler`, `metricsPartialSuccessHandler`, and
`logsPartialSuccessHandler` functions for a `nil` value in the
`protoBytes` argument. When `nil`, the function will return with a `nil`
value, indicating the absence of any error.
**Link to tracking Issue:** #9666
Describe the bug
In the otlphttpexporter exporter's otlp.go file, when the export HTTP response body is read using the function
readResponseBody
a value ofnil, nil
will be returned whenresp.ContentLength
is 0.Later, that
nil
value is passed to one of the partial success handlers (e.g.tracesPartialSuccessHandler
). No check is made for anil
value in theprotoBytes
argument, so an attempt to unmarshal thenil
value is possible.Edit: This is only the case when the content type is specified as "application/json". This does not apply when the content type is specified as "application/x-protobuf".
Steps to reproduce
Provide an empty in response to an export. Ensure that an expected Content-Type response header field is given, such as "application/json" or "application/x-protobuf".
What did you expect to see?
An empty response body should not result in an error. It is perfectly valid for the logic to continue without processing a response body.
What did you see instead?
An error is raised and the successful request is potentially retried after a backoff duration.
What version did you use?
fb912b9
What config did you use?
Any configuration using otlphttpexporter as an exporter.
Environment
Any environment
The text was updated successfully, but these errors were encountered: