Files
buzz/crates
Helen Tian b303271ad3 [buzz] Classify HTTP event request metrics by event type (#9561)
## What

Add an `event_type` label to `/events` request-count and latency metrics
so operators can inspect and alert on individual operations.

## Why

The existing `/events` latency alert combines message sending, profile
updates, reactions, typing and identity archive/unarchive into one p95
signal. Slow archive work can trigger the same generic page as slow
message sending. The page does not identify which operation is slow or
show whether messaging is affected, so on-call has to inspect traces and
logs before deciding what needs attention.

This change supplies the event-type dimension needed to name the slow
operation and choose its notification urgency. Reusing the kind registry
also keeps newly registered operations visible automatically.

## How

Classify events from the kind already parsed by the HTTP bridge and pass
that classification to the outer request timer. Both
`http_requests_total` and `http_request_latency_ms` gain a bounded
label:

- `message`, `profile_update`, `reaction`, `typing`
- `identity_archive`, `identity_unarchive`
- `kind_<number>` for other kinds registered in the existing `ALL_KINDS`
registry, using `registered_kind_label`
- `other` for unregistered kinds, `invalid` for malformed event JSON,
and `unknown` for requests that fail before parsing

New entries in the shared registry automatically receive a distinct
metric label without updating a separate metrics list. Friendly names
remain for the common operation groups.

Latency continues to cover the full request, including admission and
processing. Existing metric names and labels remain available, and other
routes retain their current labels. Classification uses the existing
parse path without changing admission order. No database migration is
required.

Closest existing PR: none found.

---------

Signed-off-by: Helen Tian <htian@squareup.com>
2026-11-17 09:01:59 +11:00
..