exp

package
v0.0.0-...-d3c1216 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddVar

func AddVar(name string, newVar expvar.Var)

AddVar allows adding arbitrary vars or maps to our main map.

func GetMap

func GetMap(name string) *expvar.Map

GetMap returns a known-expvar map by name.

Types

type CacheCollector

type CacheCollector struct {
	Stats CacheList
	// contains filtered or unexported fields
}

CacheCollector is our input for creating metrics for our cache data.

func (*CacheCollector) Collect

func (c *CacheCollector) Collect(metrics chan<- prometheus.Metric)

Collect satisfies the Collector interface for prometheus.

func (*CacheCollector) Describe

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

Describe satisfies the Collector interface for prometheus.

type CacheList

type CacheList map[string]func() *cache.Stats

CacheList is a map of label to stats functions for each cache.

type Metrics

type Metrics struct {
	QueryErrors  *prometheus.CounterVec
	QueryMissing *prometheus.CounterVec
	QueryTime    *prometheus.HistogramVec
	ReqTime      *prometheus.HistogramVec
	Uptime       prometheus.CounterFunc
}

Metrics contains the exported prometheus metrics used by the application.

func GetMetrics

func GetMetrics(collector *CacheCollector) *Metrics

GetMetrics sets up metrics on startup. @Description Retrieve internal application metrics. @Summary Return auth proxy metrics in open metrics format @Tags stats @Produce json @Success 200 {object} any "Auth Proxy Prometheus metrics" @Router /metrics [get]

type Time

type Time struct {
	time.Time
	Places TimeLength
}

Time allows formatting time Durations.

func (*Time) Since

func (e *Time) Since() interface{}

Since returns a pretty-formatted time duration for expvar.

type TimeLength

type TimeLength int
const (
	DefaultPlaces TimeLength = 2
	OnePlace      TimeLength = 1
	TwoPlaces     TimeLength = DefaultPlaces
	ThreePlaces   TimeLength = 3
)

Jump to

Keyboard shortcuts

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