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

capture: subdivide process_events_error cause #48

Merged
merged 1 commit into from
Jun 6, 2024
Merged
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
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
Loading