Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RistrettoCollector ¶
type RistrettoCollector[K ristretto.Key, V any] struct { // contains filtered or unexported fields }
RistrettoCollector collects Ristretto cache metrics.
func NewRistrettoCollector ¶
func NewRistrettoCollector[K ristretto.Key, V any](prefix string, metricsFunc func() *ristretto.Metrics) *RistrettoCollector[K, V]
NewRistrettoCollector creates a new RistrettoCollector.
To use this collector, you need to register it with a Prometheus registry:
func main() {
cache, _ := ristretto.NewCache(&ristretto.Config{
NumCounters: 1e7,
MaxCost: 1 << 30,
BufferItems: 64,
})
collector := NewRistrettoCollector("prefix_", func() *ristretto.Metrics {
return cache.Metrics
})
prometheus.MustRegister(collector)
}
func (*RistrettoCollector[K, V]) Collect ¶
func (c *RistrettoCollector[K, V]) Collect(ch chan<- prometheus.Metric)
Collect is called by the Prometheus registry when collecting metrics.
func (*RistrettoCollector[K, V]) Describe ¶
func (c *RistrettoCollector[K, V]) Describe(ch chan<- *prometheus.Desc)
Describe sends the super-set of all possible descriptors of metrics collected by this Collector.
Click to show internal directories.
Click to hide internal directories.