ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 10m23s
ci / test (pull_request) Successful in 12m59s
ci / build (pull_request) Canceled after 7m17s
ci / image (pull_request) Canceled after 0s
The API serves Prometheus metrics on a listener of its own (UPTIME_API_METRICS_LISTEN, default :9090, "off" disables it), so the public ingress never exposes them: - requests by route and status, with durations except for long polls and agent streams - dispatched checks, stored and rejected results per region, how late results arrive, live checkers and overdue checks per platform region - notification and subscriber mail deliveries, incidents opened and resolved - runs, duration and last success of the background jobs - platform totals (orgs, users, monitors by type, status pages, subscribers, open incidents, pending notifications), read at most every 15 seconds when scraped - the Postgres and Redis connection pools, Go runtime and build info The Helm chart exposes the port on the API service and can add a ServiceMonitor for the Prometheus Operator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
82 lines
2.2 KiB
Go
82 lines
2.2 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.31.1
|
|
// source: metrics.sql
|
|
|
|
package store
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
const monitorCounts = `-- name: MonitorCounts :many
|
|
SELECT type, enabled, count(*)::bigint AS monitors
|
|
FROM monitors
|
|
GROUP BY type, enabled
|
|
ORDER BY type, enabled
|
|
`
|
|
|
|
type MonitorCountsRow struct {
|
|
Type string
|
|
Enabled bool
|
|
Monitors int64
|
|
}
|
|
|
|
// System scope. Monitors by type and whether they are enabled.
|
|
func (q *Queries) MonitorCounts(ctx context.Context) ([]MonitorCountsRow, error) {
|
|
rows, err := q.db.Query(ctx, monitorCounts)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
items := []MonitorCountsRow{}
|
|
for rows.Next() {
|
|
var i MonitorCountsRow
|
|
if err := rows.Scan(&i.Type, &i.Enabled, &i.Monitors); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const platformCounts = `-- name: PlatformCounts :one
|
|
SELECT
|
|
(SELECT count(*) FROM orgs)::bigint AS orgs,
|
|
(SELECT count(*) FROM users)::bigint AS users,
|
|
(SELECT count(*) FROM status_pages)::bigint AS status_pages,
|
|
(SELECT count(*) FROM status_page_subscribers WHERE confirmed_at IS NOT NULL)::bigint AS subscribers,
|
|
(SELECT count(*) FROM incidents WHERE resolved_at IS NULL)::bigint AS open_incidents,
|
|
(SELECT count(*) FROM notifications WHERE status = 'pending')::bigint AS pending_notifications,
|
|
(SELECT count(*) FROM subscriber_notifications WHERE status = 'pending')::bigint AS pending_subscriber_notifications
|
|
`
|
|
|
|
type PlatformCountsRow struct {
|
|
Orgs int64
|
|
Users int64
|
|
StatusPages int64
|
|
Subscribers int64
|
|
OpenIncidents int64
|
|
PendingNotifications int64
|
|
PendingSubscriberNotifications int64
|
|
}
|
|
|
|
// System scope. Platform totals for the operator metrics.
|
|
func (q *Queries) PlatformCounts(ctx context.Context) (PlatformCountsRow, error) {
|
|
row := q.db.QueryRow(ctx, platformCounts)
|
|
var i PlatformCountsRow
|
|
err := row.Scan(
|
|
&i.Orgs,
|
|
&i.Users,
|
|
&i.StatusPages,
|
|
&i.Subscribers,
|
|
&i.OpenIncidents,
|
|
&i.PendingNotifications,
|
|
&i.PendingSubscriberNotifications,
|
|
)
|
|
return i, err
|
|
}
|