Documentation
¶
Overview ¶
Package metrics is a self-contained Prometheus exporter for the CLI and its embedded MCP server.
The public GitHub mirror forbids imports of internal monorepo packages (`just cli-check-isolation`), so this package copies the push pattern of the internal sdk/go_metrics instead of importing it: counters, gauges, and histograms are held in process, rendered as Prometheus text exposition, and POSTed to VICTORIA_METRICS_PUSH_URL on a fixed interval. Without that env var the push loop never starts and metrics stay pull-only via Handler.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
Handler serves the current registry as Prometheus text exposition. It is meant for an internal scrape port, not the public MCP endpoint.
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter is a monotonically increasing metric split by label values.
func NewCounter ¶
NewCounter registers a counter family. labelNames must match the length of every labelValues argument passed to Inc/Add; mismatched calls are dropped.
type Gauge ¶
type Gauge struct {
// contains filtered or unexported fields
}
Gauge is a metric that can go up and down, split by label values.
func NewGauge ¶
NewGauge registers a gauge family. labelNames must match the length of every labelValues argument passed to Set/Inc/Dec; mismatched calls are dropped.
type GaugeFunc ¶
type GaugeFunc struct {
// contains filtered or unexported fields
}
GaugeFunc computes its value at every render instead of storing one. Use it for counts derived from other state, where a stored value would go stale when traffic stops.
func NewGaugeFunc ¶
NewGaugeFunc registers a computed gauge family. fn runs on every render (push tick or scrape) and must be cheap and lock-safe.
type Histogram ¶
type Histogram struct {
// contains filtered or unexported fields
}
Histogram is a cumulative distribution split by label values. Buckets are fixed upper bounds; the implicit +Inf bucket tracks every observation.
func NewHistogram ¶
NewHistogram registers a histogram family. A nil buckets argument uses defaultBuckets. labelNames must match the length of every labelValues argument passed to Observe; mismatched calls are dropped.