Categorygithub.com/redis/go-redis/extra/redisprometheus/v9
modulepackage
9.7.0
Repository: https://github.com/redis/go-redis.git
Documentation: pkg.go.dev

# README

Prometheus Metric Collector

This package implements a prometheus.Collector for collecting metrics about the connection pool used by the various redis clients. Supported clients are redis.Client, redis.ClusterClient, redis.Ring and redis.UniversalClient.

Example

client := redis.NewClient(options)
collector := redisprometheus.NewCollector(namespace, subsystem, client)
prometheus.MustRegister(collector)

Metrics

NameTypeDescription
pool_hit_totalCounter metricnumber of times a connection was found in the pool
pool_miss_totalCounter metricnumber of times a connection was not found in the pool
pool_timeout_totalCounter metricnumber of times a timeout occurred when getting a connection from the pool
pool_conn_total_currentGauge metriccurrent number of connections in the pool
pool_conn_idle_currentGauge metriccurrent number of idle connections in the pool
pool_conn_stale_totalCounter metricnumber of times a connection was removed from the pool because it was stale

# Functions

NewCollector returns a new Collector based on the provided StatGetter.

# Structs

Collector collects statistics from a redis client.

# Interfaces

StatGetter provides a method to get pool statistics.