Repository navigation
Deliveries: an overview of how deliveries went, from counters kept as they are recorded - #321
Merged
Merged
Conversation
… they are recorded Every delivery write now moves hour and day rollups by the difference from the record it replaced, so retries and redeliveries count each delivery's final state once. GET /api/deliveries/analytics reads at most 60 rollup items for 24h, 7d or 30d against the period before: volume, success rate, latency percentiles, retries, failures by reason, failing event types and each webhook endpoint's rate, latency, streak and state. Older records are counted once, lazily and resumably. Hybrid installs add the relay's counters from the hosted side. The list also filters by until, endpoint and reason so the overview can drill in.
nambok
force-pushed
the
feat/delivery-analytics
branch
from
October 27, 2026 00:04
2600ff4 to
782ceee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
An analytics view for deliveries (webhooks in and out, relay, alerts, Jira, Slack/Teams, email):
GET /api/deliveries/analyticsreturns hour or day buckets for 24h, 7d or 30d against the period before. It reads rollup counters written as each delivery is recorded, never the raw records, so it costs at most 60 item reads and covers 120 days while records are kept 14.Pairs with the dashboard's Overview tab: CoderHelm/coderhelm#233.
Changes
common::deliveries_rollup(new). Hour items (kept 72 h) and day items (kept 120 days) on the settings table.deliveries::recordnow asks for the replaced item back and moves the rollups by the difference between the new record and the old one, so retries, redeliveries and racing writers count each delivery's final state exactly once. A delivery counts once it finishes. Counters per source and direction, and per webhook endpoint: handled, ignored and failed; retried, extra attempts and retried-then-fine; a latency histogram split by fine and failed (p50, p95 and p99 interpolated from it); failures by reason code and by event type. An endpoint streak item keeps failures in a row and the last failure and success.rolledin a transaction that only succeeds where it isn't marked yet, so a record rewritten meanwhile is never counted twice. It runs for 5 seconds per request and resumes; the reply'sbackfill.completesays when it is done.GET /api/deliveries/analytics(routes/deliveries_analytics.rs):period,source,status,endpoint. Admins, under the existingdeliveriescapability. A public API-key route with OpenAPI docs and examples (new "Deliveries" tag);docs/api/openapi.jsonregenerated. Endpoint metadata (address, on or off, why) is read from theWEBHOOK_ENDPOINT#items, never their secrets.POST /hybrid/deliveries/rollups(signed) returns an install's relay and broker counters, and installs add them in. Self-hosted installs add the deliveries that reached no team.alerts.rsuses the replaced item, since an SNS redelivery rewrites the same record).GET /api/deliveriesalso takesuntil,endpointandreason.sinceanduntilare compared as instants.source = webhookand perendpoint_id; theirwebhook_*reasons read in plain words.HYBRID#<install>, ready for that page.docs/self-host/deliveries.md: an Overview section.Verification
cargo fmt --check --all,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace: common 1055, gateway 520 and worker 694 passed (after the rebase), 0 failed.until,endpointandreasonlist filters.git diff origin/mainprints nothing.