mirror of
https://github.com/redis/go-redis.git
synced 2025-07-31 05:04:23 +03:00
feat(extra/redisprometheus): prometheus.Collector implementation for redis clients
Signed-off-by: Knut Zuidema <me@knutzuidema.de>
This commit is contained in:
26
extra/redisprometheus/README.md
Normal file
26
extra/redisprometheus/README.md
Normal file
@ -0,0 +1,26 @@
|
||||
# Prometheus Metric Collector
|
||||
|
||||
This package implements a [`prometheus.Collector`](https://pkg.go.dev/github.com/prometheus/client_golang@v1.12.2/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
|
||||
|
||||
```go
|
||||
client := redis.NewClient(options)
|
||||
collector := redisprometheus.NewCollector(namespace, subsystem, client)
|
||||
prometheus.MustRegister(collector)
|
||||
```
|
||||
|
||||
### Metrics
|
||||
|
||||
| Name | Type | Description |
|
||||
|---------------------------|----------------|-----------------------------------------------------------------------------|
|
||||
| `pool_hit_total` | Counter metric | number of times a connection was found in the pool |
|
||||
| `pool_miss_total` | Counter metric | number of times a connection was not found in the pool |
|
||||
| `pool_timeout_total` | Counter metric | number of times a timeout occurred when getting a connection from the pool |
|
||||
| `pool_conn_total_current` | Gauge metric | current number of connections in the pool |
|
||||
| `pool_conn_idle_current` | Gauge metric | current number of idle connections in the pool |
|
||||
| `pool_conn_stale_total` | Counter metric | number of times a connection was removed from the pool because it was stale |
|
||||
|
||||
|
Reference in New Issue
Block a user