metrics

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

type Metrics struct {
	Insertion prometheus.Counter
	Eviction  *prometheus.CounterVec

	Hit  prometheus.Counter
	Miss prometheus.Counter

	Length prometheus.Gauge
	Weight prometheus.Gauge

	// settings
	// SettingsCapacity        prometheus.Gauge
	SettingsTTL              prometheus.Gauge
	SettingsJitterLambda     prometheus.Gauge
	SettingsJitterUpperBound prometheus.Gauge
	SettingsStale            prometheus.Gauge
	// SettingsMissingCapacity prometheus.Gauge
	SettingsMissingTTL   prometheus.Gauge
	SettingsMissingStale prometheus.Gauge
}

@TODO: Should be simple atomic counters and gauges. @TODO: If metrics are disabled, no need to collect them (use a no-op implementation). @TODO: If prometheus metrics are enabled, collect them in a separate goroutine. @TODO: collect revalidation count+delay @TODO: add a label for the cache name @TODO: add comment to metric declaration @TODO: weight should be diplicated in order to include *item[V] weight

func NewMetrics

func NewMetrics(ttl time.Duration, jitterLambda float64, jitterUpperBound time.Duration, stale time.Duration) *Metrics

Jump to

Keyboard shortcuts

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