Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Commit

Permalink
capture: subdivide process_events_error cause (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
xvello authored Jun 6, 2024
1 parent 63db2a6 commit cf30272
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion capture/src/v0_endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,14 @@ pub async fn event(
tracing::debug!(context=?context, events=?events, "decoded request");

if let Err(err) = process_events(state.sink.clone(), &events, &context).await {
report_dropped_events("process_events_error", events.len() as u64);
let cause = match err {
// TODO: automate this with a macro
CaptureError::EmptyDistinctId => "empty_distinct_id",
CaptureError::MissingDistinctId => "missing_distinct_id",
CaptureError::MissingEventName => "missing_event_name",
_ => "process_events_error",
};
report_dropped_events(cause, events.len() as u64);
tracing::log::warn!("rejected invalid payload: {}", err);
return Err(err);
}
Expand Down

0 comments on commit cf30272

Please sign in to comment.