Show 50 recent events with size, processing time and status (closes #347)
check / check (push) Successful in 3m53s

The recent events list on a webhook's page now shows the 50 newest
events, each with its time relative to now (the full UTC timestamp on
hover), its body size, its processing time and, when the webhook has
exactly one HTTP target, that target's last HTTP status, colour-coded.
Resubmitted copies are marked, as in the event log.

Processing time is how long the event's slowest delivery took, from
being queued to its last recorded attempt. It is read from the existing
delivery and attempt timestamps, so nothing new is recorded. The body's
size is read in SQL, never the body.

Deliveries and attempts load in one batched query each, reusing the
event log's attempt loader.

Model: opus-5-5
This commit is contained in:
2026-09-29 10:24:27 +00:00
parent 8ad2a86e4b
commit 51186b347b
7 changed files with 579 additions and 13 deletions
+7 -1
View File
@@ -1,6 +1,8 @@
package handlers
import (
"time"
"sneak.berlin/go/webhooker/internal/delivery"
)
@@ -25,7 +27,7 @@ const maxRenderedResponseBytes = 4096
// cut, so an oversized stored response never becomes a Go
// string at all.
const deliveryResultColumns = "delivery_id, attempt_num, success, " +
"status_code, error, duration, " +
"status_code, error, duration, created_at, " +
"substr(cast(response_body as blob), 1, ?) AS response_body, " +
"length(cast(response_body as blob)) AS response_bytes"
@@ -106,6 +108,10 @@ type deliveryResultRow struct {
Duration int64
ResponseBody []byte
ResponseBytes int64
// CreatedAt is when the attempt's result was recorded, which
// is when the attempt finished.
CreatedAt time.Time
}
// view projects a loaded row for rendering, stripping the