Observability: slog + Prometheus metrics (AI-focused) via middleware #15

Open
opened 2026-06-12 06:01:55 +00:00 by mathias · 0 comments
Owner

Problem

No timing/metrics for the activities that drive Tapir's performance + UX. We can't see latency of caption fetches, summarization (per model/fallback), Q&A, or session/usage — and these matter for the Stage-0 eval gate.

Decisions (agreed)

  • slog AND Prometheus, wired via HTTP middleware.
  • Cover session/usage metrics (requests, latency by route, logins) and AI metrics (priority): summarization latency by model/outcome/fallback, caption-fetch latency by outcome, chat latency, LLM token usage.
  • /metrics on a dedicated port (in-cluster scrape only, prometheus-operator PodMonitor — operator CRDs already on the cluster).

Process (do in order — not straight to code)

  1. Requirements + architecture implications → ADR (new dep client_golang; metrics port; middleware route-pattern cardinality; AI hook points; scrape wiring).
  2. BDD scenarios (.feature) + scenario-coverage map.
  3. TDD → implement.
  4. SemVer bump + docs + PodMonitor in mathias/infra.

Out of scope (separate issues)

SPA-like view (#2), visual refresh (#3).

## Problem No timing/metrics for the activities that drive Tapir's performance + UX. We can't see latency of caption fetches, summarization (per model/fallback), Q&A, or session/usage — and these matter for the Stage-0 eval gate. ## Decisions (agreed) - **slog AND Prometheus**, wired via **HTTP middleware**. - Cover **session/usage metrics** (requests, latency by route, logins) **and AI metrics** (priority): summarization latency by model/outcome/fallback, caption-fetch latency by outcome, chat latency, **LLM token usage**. - `/metrics` on a **dedicated port** (in-cluster scrape only, prometheus-operator PodMonitor — operator CRDs already on the cluster). ## Process (do in order — not straight to code) 1. Requirements + architecture implications → **ADR** (new dep `client_golang`; metrics port; middleware route-pattern cardinality; AI hook points; scrape wiring). 2. **BDD** scenarios (.feature) + scenario-coverage map. 3. **TDD** → implement. 4. SemVer bump + docs + PodMonitor in `mathias/infra`. ## Out of scope (separate issues) SPA-like view (#2), visual refresh (#3).
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mathias/tapir#15