Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ pub enum ExtractCodeError {
Producer(#[from] ProducerError),
#[error(transparent)]
Schema(#[from] SchemaError),
#[error("Vector request failed")]
VectorError,
#[error("Vector request failed: {msg}")]
VectorError { msg: String },
}

pub trait ResultsProducer: Send + Sync {
Expand Down
14 changes: 9 additions & 5 deletions src/producer/vector_producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl VectorResultsProducer {
metrics::histogram!("vector_producer.send_batch.duration", "uptime_region" => region, "histogram" => "timer").record(start.elapsed().as_secs_f64());
result
} {
tracing::error!(error = ?e, "vector_batch.send_failed");
tracing::error!(error = %e, "vector_batch.send_failed");
}
}

Expand All @@ -112,7 +112,7 @@ impl VectorResultsProducer {
)
.await
{
tracing::error!(error = ?e, "final_batch.send_failed");
tracing::error!(error = %e, "final_batch.send_failed");
}
}

Expand All @@ -129,7 +129,9 @@ impl ResultsProducer for VectorResultsProducer {
// Send the serialized result to the worker task
if self.sender.send(json).is_err() {
tracing::error!("event.send_failed_channel_closed");
return Err(ExtractCodeError::VectorError);
return Err(ExtractCodeError::VectorError {
msg: "send failed channel closed".to_owned(),
});
}
self.pending_items
.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
Expand Down Expand Up @@ -165,7 +167,7 @@ async fn send_batch(
.header("Content-Type", "application/json")
.body(body.clone())
.build()
.map_err(|_e| ExtractCodeError::VectorError)?;
.map_err(|e| ExtractCodeError::VectorError { msg: e.to_string() })?;
let req_id = req.req_id().clone();
let response = client.execute(req).await;
let stats = hyper::stats::consume_request_stats(req_id);
Expand Down Expand Up @@ -221,7 +223,9 @@ async fn send_batch(
}
}
if !retry_vector_errors_forever {
return Err(ExtractCodeError::VectorError);
return Err(ExtractCodeError::VectorError {
msg: "retries exhausted".to_owned(),
});
}
sleep(delay).await;
}
Expand Down
Loading