From f8a07fbfa3dead0b73cad250ffa4b2db0440ae1d Mon Sep 17 00:00:00 2001 From: Xavier Vello Date: Tue, 21 Nov 2023 16:36:02 +0100 Subject: [PATCH] account for process_events errors in capture_events_dropped_total and log them (#58) --- capture/src/capture.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/capture/src/capture.rs b/capture/src/capture.rs index 1d889d3..6935ee3 100644 --- a/capture/src/capture.rs +++ b/capture/src/capture.rs @@ -143,7 +143,11 @@ pub async fn event( tracing::debug!(context=?context, events=?events, "decoded request"); - process_events(state.sink.clone(), &events, &context).await?; + if let Err(err) = process_events(state.sink.clone(), &events, &context).await { + report_dropped_events("process_events_error", events.len() as u64); + tracing::log::warn!("rejected invalid payload: {}", err); + return Err(err); + } Ok(Json(CaptureResponse { status: CaptureResponseCode::Ok,