Show each entrypoint's last event and event count on the webhook page (closes #393)
check / check (push) Successful in 3m18s
check / check (push) Successful in 3m18s
Each entrypoint in the webhook page's entrypoint list shows when the last event arrived on its URL (relative, with the full UTC time on hover), or "never" if none ever has, and how many events arrived on it within the webhook's retention period. The last event is kept per entrypoint in a new EntrypointTotals row in the event database, written in the transaction that stores the event, so retention leaves it in place. The count is one query per page, grouped by entrypoint, over a new events index on entrypoint_id, deleted_at, resubmitted_from_id and created_at. Resubmitted copies did not arrive on the URL and count in neither. Pre-1.0: the table and index go into the schema in place. Model: opus-5-5
This commit is contained in:
@@ -485,6 +485,8 @@ func (h *Handlers) renderSourceDetail(
|
||||
"webhook_id = ?", webhook.ID,
|
||||
).Find(&targets)
|
||||
|
||||
entrypointViews := NewEntrypointViews(entrypoints)
|
||||
|
||||
var events []RecentEventView
|
||||
|
||||
if h.dbMgr.DBExists(webhook.ID) {
|
||||
@@ -503,6 +505,15 @@ func (h *Handlers) renderSourceDetail(
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
err = addEntrypointEvents(
|
||||
webhookDB, &webhook, entrypointViews, time.Now(),
|
||||
)
|
||||
if err != nil {
|
||||
h.serverError(w, r, "failed to count entrypoint events", err)
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
scheme := "http"
|
||||
@@ -523,7 +534,7 @@ func (h *Handlers) renderSourceDetail(
|
||||
// Targets are projected to a display-safe view: a
|
||||
// target's stored config blob holds a credential, and it
|
||||
// must never reach a template.
|
||||
"Entrypoints": NewEntrypointViews(entrypoints),
|
||||
"Entrypoints": entrypointViews,
|
||||
"Targets": h.targetRows(&webhook, targets),
|
||||
"Events": events,
|
||||
"BaseURL": baseURL,
|
||||
|
||||
Reference in New Issue
Block a user