Documentation
¶
Overview ¶
Package metrics defines Prometheus metrics for the Runkite control plane.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // HTTP request metrics HTTPRequestsTotal = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "runkite_http_requests_total", Help: "Total number of HTTP requests", }, []string{"method", "path", "status"}, ) HTTPRequestDuration = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Name: "runkite_http_request_duration_seconds", Help: "HTTP request duration in seconds", Buckets: prometheus.DefBuckets, }, []string{"method", "path"}, ) // Run metrics RunsTotal = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "runkite_runs_total", Help: "Total number of runs created", }, []string{"agent_id", "status"}, ) RunDuration = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Name: "runkite_run_duration_seconds", Help: "Run execution duration in seconds", Buckets: []float64{0.1, 0.5, 1, 2, 5, 10, 30, 60, 120, 300}, }, []string{"agent_id"}, ) ActiveRuns = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "runkite_active_runs", Help: "Number of currently active runs", }) // Queue metrics QueueDepth = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "runkite_queue_depth", Help: "Number of jobs currently in the queue", }) // SSE connections ActiveSSEConnections = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "runkite_active_sse_connections", Help: "Number of active SSE streaming connections", }) // WebhookQueueDroppedTotal counts events dropped by the bounded // webhook dispatch worker pool because its queue was full -- see // internal/hooks.Dispatcher's own doc comment for why dropping // (rather than blocking the caller or growing unbounded) is the // deliberate overflow policy. Should stay at 0 in normal operation; // a nonzero rate means the worker pool is undersized for the // sustained webhook event rate, or a subscribed endpoint is slow/down // and backing up delivery attempts for everyone sharing the pool. WebhookQueueDroppedTotal = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "runkite_webhook_queue_dropped_total", Help: "Total number of webhook dispatch jobs dropped because the bounded worker pool's queue was full", }, []string{"event_type"}, ) // PoisonPillTotal counts assignments finalized after reaching the reclaim // generation ceiling, including recovered results. Labels identify the // agent/tenant when known from the assignment payload. PoisonPillTotal = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "runkite_poison_pill_total", Help: "Assignments finalized after reaching reclaim max_retries, including recovered results", }, []string{"agent_id", "tenant_id"}, ) // StatusTransitionErrorsTotal counts fire-and-forget thread/run // status writes that still failed after one retry. A rising rate // usually means threads stuck busy (permanent client 409s) or runs // stuck non-terminal -- alert on this. StatusTransitionErrorsTotal = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "runkite_status_transition_errors_total", Help: "Total number of thread/run status transitions that failed after one retry", }, []string{"op"}, ) )
Functions ¶
func HTTPMiddleware ¶
HTTPMiddleware records request count and duration for every HTTP request except the /metrics endpoint itself.
func SetQueueDepth ¶
func SetQueueDepth(n int64)
SetQueueDepth updates the queue-depth gauge. Call after enqueue/dequeue.
Types ¶
This section is empty.