Show each entrypoint's last event and event count on the webhook page (closes #393)
check / check (push) Successful in 3m23s
check / check (push) Successful in 3m23s
Each entrypoint in the webhook page's entrypoint list now shows when its last event arrived (relative, with the full UTC time on hover), or "never", and how many events arrived through it within the webhook's retention period. Both come from one query per page, grouped by entrypoint, over a new events index on entrypoint_id, deleted_at and created_at, so the page reads only the index entries it counts. Pre-1.0: the index goes into the schema in place. A test checks the database's plan for the statement as the code builds it; another shows two entrypoints with different traffic each with their own figures, an event older than retention left out, and an unused entrypoint reading "never". Model: opus-5-5
This commit is contained in:
@@ -1639,6 +1639,10 @@ different event sources that all feed into the same processing pipeline
|
||||
(e.g., one entrypoint for GitHub, another for Stripe, both routing to
|
||||
the same targets).
|
||||
|
||||
The webhook page shows, for each entrypoint, how many events arrived
|
||||
through it within the webhook's retention period and when the newest of
|
||||
them arrived, or "never".
|
||||
|
||||
#### Target
|
||||
|
||||
A delivery destination for events. Each target defines where and how
|
||||
@@ -1903,6 +1907,7 @@ tags, so `AutoMigrate` creates them on a fresh database:
|
||||
| `delivery_results` | `delivery_id`, `deleted_at` | The event log, which loads the attempts of a page's deliveries, and retention, which deletes the attempts of expired events |
|
||||
| `events` | `deleted_at`, `created_at` | The webhook page's statistics, which count recent events |
|
||||
| `events` | `resubmitted_from_id`, `deleted_at` | The event log, which counts the events resubmitted from each event on a page |
|
||||
| `events` | `entrypoint_id`, `deleted_at`, `created_at` | The webhook page's entrypoint list, which counts each entrypoint's events within the retention period and reads when the newest arrived |
|
||||
| `events` | `created_at` | Retention, which selects expired events by age |
|
||||
|
||||
GORM's soft delete adds `deleted_at IS NULL` to these queries; retention
|
||||
@@ -1912,7 +1917,9 @@ a column matched against several values or compared with a range. So every
|
||||
index but the last also covers `deleted_at`. It comes second in the `event_id`
|
||||
and `delivery_id` indexes, so that retention can use them without it. The event
|
||||
log's count, the one query on the `resubmitted_from_id` index, always carries
|
||||
`deleted_at IS NULL` and uses both columns. In the statistics' `events` index
|
||||
`deleted_at IS NULL` and uses both columns. The entrypoint list's query, the one
|
||||
on the `entrypoint_id` index, uses all three, with `created_at` last because it
|
||||
compares it with a range (`>=`). In the statistics' `events` index
|
||||
`deleted_at` comes first, because they compare `created_at` with a range (`>=`)
|
||||
and SQLite narrows by a range only on the last column it uses.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user