snapshot of https://github.com/centrifugal/centrifugo.git (master, 2026-09-16; blobs > 131072B omitted)
This commit is contained in:
68
internal/metrics/accessors.go
Normal file
68
internal/metrics/accessors.go
Normal file
@@ -0,0 +1,68 @@
|
||||
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
|
||||
)
|
||||
Reference in New Issue
Block a user