Files
upstream-centrifugo/internal/metrics/accessors.go
upstream-mirror b352a9a30d
Some checks failed
test / Lint (push) Failing after 3s
test / Test with Go 1.26.8 (push) Failing after 2s
snapshot of https://github.com/centrifugal/centrifugo.git (master, 2026-09-16; blobs > 131072B omitted)
2026-09-16 01:17:21 +05:00

69 lines
2.6 KiB
Go

package metrics
import "github.com/prometheus/client_golang/prometheus"
// Proxy metrics - exported for use by proxy package.
//
// ProxyCallDurationSummary holds the legacy Summary instrument by default;
// when prometheus.native_histograms is enabled it is a no-op observer (see
// internal noopObserverVec), so callers can continue to construct cached
// observers and call .Observe() without nil-checks. ProxyCallDurationHistogram
// is the canonical companion — prefer it for new queries and OTel export.
var (
ProxyCallDurationSummary prometheus.ObserverVec
ProxyCallDurationHistogram *prometheus.HistogramVec
ProxyCallErrorCount *prometheus.CounterVec
ProxyCallInflightRequests *prometheus.GaugeVec
)
// API metrics - exported for use by api package.
//
// APICommandDurationSummary follows the same pattern as ProxyCallDurationSummary
// (real Summary by default, no-op when native_histograms is enabled).
// APICommandDurationHistogram is the canonical companion.
//
// RPCDurationSummary follows the same pattern. RPCDurationHistogram is the
// companion Histogram exposed as "rpc_duration_seconds_histogram" —
// unconditional, with native (sparse, exponential) schema when
// native_histograms is enabled.
var (
APICommandErrorsTotal *prometheus.CounterVec
APICommandDurationSummary prometheus.ObserverVec
APICommandDurationHistogram *prometheus.HistogramVec
RPCDurationSummary prometheus.ObserverVec
RPCDurationHistogram *prometheus.HistogramVec
)
// Consumer metrics - exported for use by consuming package
var (
ConsumerProcessedTotal *prometheus.CounterVec
ConsumerErrorsTotal *prometheus.CounterVec
)
// Shared poll proxy metrics - exported for use by proxy package
var (
SharedPollProxyRequestItems *prometheus.HistogramVec
SharedPollProxyResponseItems *prometheus.HistogramVec
)
// Middleware metrics - exported for use by middleware package
var (
ConnLimitReached prometheus.Counter
HTTPRequestsTotal *prometheus.CounterVec
)
// Postgres broker metrics exported for use by pgmapbroker and pgstreambroker.
//
// All carry a postgres_ name prefix: these are Postgres-specific (outbox,
// partitions, row cleanup), not generic broker concepts. Metrics emitted by both
// PG brokers are split per kind (broker_* for stream, map_broker_* for map) so
// the two never share a series. Cleanup is stream-only today.
var (
BrokerPostgresCleanupRemovedTotal *prometheus.CounterVec
BrokerPostgresOutboxCursorLagSeconds *prometheus.GaugeVec
MapBrokerPostgresOutboxCursorLagSeconds *prometheus.GaugeVec
BrokerPostgresPartitions *prometheus.GaugeVec
MapBrokerPostgresPartitions *prometheus.GaugeVec
)