Skip to content

Commit

Permalink
fix(http): handle and report partial failures with 207 status
Browse files Browse the repository at this point in the history
The Mezmo destination uses the HTTP sink under the hood, and since the
`ingestion-service` handles partial failures by sending a 207 response,
we need to report errors from those requests.

This adds an explicit check in the `UserLoggingResponse` implementation
for the HTTP sink's `Request` type, which handles/extracts errors from
"successful" requests that contain a 207 response.

Ref: LOG-19799
  • Loading branch information
mdeltito committed May 1, 2024
1 parent c5fffba commit 744386a
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/sinks/util/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -787,16 +787,26 @@ where

impl UserLoggingResponse for HttpResponse {
fn log_msg(&self) -> Option<Value> {
if !self.http_response.status().is_success() {
let status = self.http_response.status();
if status.is_success() {
match status {
StatusCode::MULTI_STATUS => Some(
format!(
"Partial error returned from destination with status code: {}",
status
)
.into(),
),
_ => None,
}
} else {
Some(
format!(
"Error returned from destination with status code: {}",
self.http_response.status()
status
)
.into(),
)
} else {
None
}
}

Expand Down

0 comments on commit 744386a

Please sign in to comment.