Send Streamwake telemetry
to your stack.
Two endpoints on the same admin-gated route — a Prometheus 0.0.4 scrape and an OTLP/HTTP push — so your observability team can wire Streamwake reliability signals into Prometheus, OpenTelemetry collectors, and Grafana without a custom agent on your side. Endpoint contracts and metric families below stay in lock-step with src/app/api/v1/metrics/route.ts.
better-auth.session_token cookie of a platform admin.Scrape in three lines.
Drop the snippet below into your Prometheus config, point the target at your Streamwake host, and the scraper picks up the families on the next collection interval.
The route replies with content-type: text/plain; version=0.0.4 so a stock Prometheus job ships it without a relabel_config. The authorization block carries the platform admin session; production enterprise will replace that with a dedicated observability bearer key.
metrics_path defaults to /metrics — override it to /api/v1/metrics/prometheus as shown.
scrape_configs:
- job_name: streamwake
metrics_path: /api/v1/metrics/prometheus
scheme: https
static_configs:
- targets:
- ${STREAMWAKE_HOST}
authorization:
type: Bearer
credentials: ${STREAMWAKE_ADMIN_BEARER}
curl https://streamwake.polsia.io/api/v1/metrics/prometheus \
-H "authorization: Bearer ${STREAMWAKE_ADMIN_BEARER}" \
-H "accept: text/plain; version=0.0.4"# HELP streamwake_stream_total Number of Streamwake streams segmented by their agent_state-derived status.
# TYPE streamwake_stream_total gauge
streamwake_stream_total{state="watching"} 12
streamwake_stream_total{state="down"} 1
streamwake_stream_total{state="degraded"} 0
# HELP streamwake_probe_total Streamwake probe attempts in the last 24 hours.
# TYPE streamwake_probe_total counter
streamwake_probe_total{stream_id="ckq3xstreamabc123",status="healthy"} 287
streamwake_probe_total{stream_id="ckq3xstreamabc123",status="degraded"} 1
streamwake_probe_total{stream_id="ckq3xstreamdef456",status="failing"} 14
# HELP streamwake_scrape_build_info Static build-info marker.
# TYPE streamwake_scrape_build_info info
streamwake_scrape_build_info{service="streamwake",format="prometheus"} 1Or push via OTLP/HTTP.
The same admin gate accepts an OTLP-shaped JSON envelope. The push endpoint is a stub sink today: it validates that resourceMetrics is a non-empty array and echoes the accepted count. v2 will persist the batch for replay; the contract is fixed so existing collectors keep working.
Wire the OTLP receiver in your OTel Collector with exporters.otlphttp pointing at this URL. The receiver validates the envelope shape — anything matching the OTLP ExportMetricsServiceRequest surface (lowercased to a single resourceMetrics array per the HTTP/JSON profile) is accepted.
Emitting 202 Accepted with acceptedCount matches OTLP's "received the batch" semantic — the receiver returns synchronously so a retrying exporter knows not to redeliver.
curl -X POST https://streamwake.polsia.io/api/v1/metrics/otlp \
-H "content-type: application/json" \
-H "authorization: Bearer ${STREAMWAKE_ADMIN_BEARER}" \
-d '{
"resourceMetrics": [
{ "resource": { "attributes": [] }, "scopeMetrics": [] }
]
}'{
"resourceMetrics": [
{
"resource": {
"attributes": [
{
"key": "service.name",
"value": {
"stringValue": "streamwake-sidecar"
}
}
]
},
"scopeMetrics": []
}
]
}{
"accepted": true,
"acceptedCount": 1,
"rejectedCount": 0
}What lands in your scraper
Six families ship today, three gauges / two counters / one info marker. Names stay stable; label cardinality stays bounded by the underlying tables.
Confidence families ship when the persisted Incidents model lands; today we expose incident event counts but no numeric confidence. Today, IncidentEvent carries the timeline; ranked hypotheses live in a deterministic runtime seed. A numeric confidence series across scrapes is a v2 surface driven by the upcoming persisted Incident model.
Hand it to the observability team.
Four steps to wire the cluster. Today the admin session doubles as the scraper credential — drop in a dedicated observability bearer key as part of an enterprise rollout and nothing here changes.
- 01Mint the scraper credential
One platform admin signs in at /sign-in. The session cookie is the v1 credential; for production enterprise scrapes switch to a dedicated observability API key (see 'Known limits' below).
No reverse proxy rewrites required. - 02Point Prometheus at the route
Add the snippet in the section above to
prometheus.ymlwithmetrics_path=/api/v1/metrics/prometheus.No reverse proxy rewrites required. - 03Build dashboards from the families
Per-stream uptime feeds a service-tier SLO. Probe-status counters feed an alert on a sustained failing streak. Incident event counts feed a secondary panel alongside PagerDuty / Slack acknowledgements.
No reverse proxy rewrites required. - 04Validate with the manual curl
Hit
curl https://streamwake.polsia.io/api/v1/metrics/prometheusfrom one operator laptop and confirm the body comes back astext/plain; version=0.0.4.No reverse proxy rewrites required.
- Auth is the platform admin cookie. v2 surfaces a dedicated observability bearer key so off-platform scrapers don't ride a human's session.
- OTLP push is a stub sink — the route validates the envelope and echoes the accepted count. Persistence + downstream fan-out is a v2 surface.
- Root-cause confidence is not yet a numeric series — it waits on the
Incidentmodel. Today we expose incident event counts.