cachex

package
v0.0.706 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RistrettoCollector

type RistrettoCollector struct {
	// contains filtered or unexported fields
}

RistrettoCollector collects Ristretto cache metrics.

func NewRistrettoCollector

func NewRistrettoCollector(prefix string, metricsFunc func() *ristretto.Metrics) *RistrettoCollector

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) Collect

func (c *RistrettoCollector) Collect(ch chan<- prometheus.Metric)

Collect is called by the Prometheus registry when collecting metrics.

func (*RistrettoCollector) Describe

func (c *RistrettoCollector) Describe(ch chan<- *prometheus.Desc)

Describe sends the super-set of all possible descriptors of metrics collected by this Collector.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL