metrics

package
v0.0.0-...-31318cc Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Collector = &Gatherer{
	AllowListSize: promauto.NewGauge(prometheus.GaugeOpts{
		Namespace: "log_reader",
		Subsystem: "allow_list",
		Name:      "size",
		Help:      "Current size of the allow list",
	}),
	AuthRequestCounter: promauto.NewCounter(prometheus.CounterOpts{
		Namespace: "log_reader",
		Subsystem: "auth_requests",
		Name:      "total",
		Help:      "Count all auth requests",
	}),
	StatusOkRespCounter: promauto.NewCounter(prometheus.CounterOpts{
		Namespace: "log_reader",
		Subsystem: "auth_responses",
		Name:      "status_ok",
		Help:      "Count all auth OK (200) responses",
	}),
	StatusForbiddenRespCounter: promauto.NewCounter(prometheus.CounterOpts{
		Namespace: "log_reader",
		Subsystem: "auth_responses",
		Name:      "status_forbidden",
		Help:      "Count all auth Forbidden (403) responses",
	})}

Collector is the main prometheus data gatherer

Functions

func GetMetricValue

func GetMetricValue(collector prometheus.Counter) float64

GetMetricValue read counter value from a prometheus collector kudos https://stackoverflow.com/questions/57952695/prometheus-counters-how-to-get-current-value-with-golang-client

Types

type Gatherer

type Gatherer struct {
	AllowListSize              prometheus.Gauge
	AuthRequestCounter         prometheus.Counter
	StatusOkRespCounter        prometheus.Counter
	StatusForbiddenRespCounter prometheus.Counter
}

Gatherer contains every metric stat use by the prometheus endpoint

Jump to

Keyboard shortcuts

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