Documentation
¶
Index ¶
Constants ¶
const ( PrometheusMetricPrefix = "coder_ai_gateway_" InterceptionCountStatusFailed = "failed" InterceptionCountStatusCompleted = "completed" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metrics ¶
type Metrics struct {
// Interception-related metrics.
InterceptionDuration *prometheus.HistogramVec
InterceptionCount *prometheus.CounterVec
InterceptionsInflight *prometheus.GaugeVec
PassthroughCount *prometheus.CounterVec
// Prompt-related metrics.
PromptCount *prometheus.CounterVec
// Token-related metrics.
TokenUseCount *prometheus.CounterVec
// Tool-related metrics.
InjectedToolUseCount *prometheus.CounterVec
NonInjectedToolUseCount *prometheus.CounterVec
// Circuit breaker metrics.
CircuitBreakerState *prometheus.GaugeVec // Current state (0=closed, 0.5=half-open, 1=open)
CircuitBreakerTrips *prometheus.CounterVec // Total times circuit opened
CircuitBreakerRejects *prometheus.CounterVec // Requests rejected due to open circuit
// Key pool failover metrics.
KeyPoolStateTransitions *prometheus.CounterVec // Key state transitions during failover.
KeyPoolExhaustions *prometheus.CounterVec // Times the pool ran out of usable keys.
// Keys attempted before success or exhaustion, per interception for
// bridged requests and per request for passthrough requests.
KeyPoolFailoverAttempts *prometheus.HistogramVec
}
func NewMetrics ¶
func NewMetrics(reg prometheus.Registerer) *Metrics
NewMetrics creates AND registers metrics. It will panic if a collector has already been registered. Note: we are not specifying namespace in the metrics; the provided registerer may specify a "namespace" using prometheus.WrapRegistererWithPrefix.