Documentation
¶
Overview ¶
Package redis provides a Redis-backed implementation of stats.Collector. All primitives map to native Redis data structures:
- Counter → INCR / INCRBY (string key)
- Gauge → SET / INCR / DECR (string key)
- Set → SADD / SISMEMBER / SCARD / SINTER (set key)
- HLL → PFADD / PFCOUNT / PFMERGE (HyperLogLog key)
- Timer → Sorted set (ZADD) + Lua script for percentiles
Index ¶
- type Collector
- func (c *Collector) Close() error
- func (c *Collector) Counter(key string) stats.Counter
- func (c *Collector) Flush() error
- func (c *Collector) Gauge(key string) stats.Gauge
- func (c *Collector) HLL(key string) stats.HLL
- func (c *Collector) Set(key string) stats.Set
- func (c *Collector) Timer(key string) stats.Timer
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector implements stats.Collector backed by Redis.
type Option ¶
type Option func(*Collector)
Option configures the Redis collector.
func WithContext ¶
WithContext sets the default context for Redis operations.
func WithKeyPrefix ¶
WithKeyPrefix sets a prefix for all Redis keys.
Click to show internal directories.
Click to hide internal directories.