metrics

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: MIT Imports: 11 Imported by: 1

Documentation

Overview

Package metrics facilitates writing unit tests by allowing the test to read back the value set in a Prometheus metrics

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRouter added in v0.4.4

func GetRouter() (router *mux.Router)

GetRouter returns an HTTP router with a prometheus metrics endpoint

func LoadValue deprecated

func LoadValue(metricName string, labels ...string) (float64, error)

LoadValue gets the last value reported so unit tests can verify the correct value was reported

Deprecated: this will be removed in a subsequent version

func MetricLabel added in v0.3.91

func MetricLabel(metric prometheus.Metric, labelName string) (value string)

MetricLabel returns the value for a specified label

func MetricName added in v0.3.91

func MetricName(metric prometheus.Metric) (name string)

MetricName returns the metric name

func MetricValue added in v0.3.91

func MetricValue(metric prometheus.Metric) *pcg.Metric

MetricValue checks that a prometheus metric has a specified value

func NewCounter deprecated added in v0.2.0

func NewCounter(opts prometheus.CounterOpts) prometheus.Counter

NewCounter returns a new Prometheus Counter, created through promauto

Deprecated: this will be removed in a subsequent version

func NewCounterVec deprecated added in v0.2.0

func NewCounterVec(opts prometheus.CounterOpts, labels []string) *prometheus.CounterVec

NewCounterVec returns a new Prometheus CounterVec, created through promauto

Deprecated: this will be removed in a subsequent version

func NewGauge deprecated

func NewGauge(opts prometheus.GaugeOpts) prometheus.Gauge

NewGauge returns a new Prometheus Gauge, created through promauto

Deprecated: this will be removed in a subsequent version

func NewGaugeVec deprecated

func NewGaugeVec(opts prometheus.GaugeOpts, labels []string) *prometheus.GaugeVec

NewGaugeVec returns a new Prometheus GaugeVec, created through promauto

Deprecated: this will be removed in a subsequent version

Types

type Handler added in v0.4.3

type Handler struct {
	Path    string
	Handler http.Handler
}

Handler contains an additional HTTP handler to be registered in the Server's HTTP server router

type Server added in v0.4.1

type Server struct {
	Port int
	// contains filtered or unexported fields
}

Server runs an HTTP Server for a Prometheus scrape (i.e. /metric) endpoint

func NewServer added in v0.4.1

func NewServer(port int) (server *Server)

NewServer creates a new server

func NewServerWithHandlers added in v0.4.3

func NewServerWithHandlers(port int, handlers []Handler) *Server

NewServerWithHandlers creates a new server with additional handlers

func (*Server) Run added in v0.4.1

func (server *Server) Run() (err error)

Run starts the HTTP Server

func (*Server) Shutdown added in v0.4.1

func (server *Server) Shutdown(timeout time.Duration) (err error)

Shutdown stops the HTTP Server

Jump to

Keyboard shortcuts

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