metrics

package
v0.4.0-RC5 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: AGPL-3.0, AGPL-3.0-or-later Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	//Endpoint the endpoint for exposing the metrics
	Endpoint = "/metrics"
	// ProfilingIndexEndpoint the endpoint for exposing the profiling metrics
	ProfilingIndexEndpoint = "/debug/pprof/"
	// ProfileEndpoint the endpoint for exposing the profile of the profiling metrics
	ProfileEndpoint = "/debug/pprof/profile"
	// ProfilingCmdEndpoint the endpoint for exposing the command-line of profiling metrics
	ProfilingCmdEndpoint = "/debug/pprof/cmdline"
	// ProfilingSymbolEndpoint the endpoint for exposing the symbol of profiling metrics
	ProfilingSymbolEndpoint = "/debug/pprof/symbol"
	// ProfilingTraceEndpoint the endpoint for exposing the trace of profiling metrics
	ProfilingTraceEndpoint = "/debug/pprof/trace"
)

Variables

This section is empty.

Functions

func Counter

func Counter(name string) (counter prometheus.Counter, exist bool)

Counter retrieves counter metric by name

func CounterAdd

func CounterAdd(name string, value float64)

CounterAdd increments the counter with the given name.

func CounterInc

func CounterInc(name string)

CounterInc increments the counter with the given name.

func CounterVec

func CounterVec(name string) (counterVec *prometheus.CounterVec, exist bool)

CounterVec retrieves counter ver metric by name

func CounterVecAdd

func CounterVecAdd(name string, label string, value float64)

CounterVecAdd increments the counter vec by the given value, with the given name and label.

func CounterVecInc

func CounterVecInc(name string, label string)

CounterVecInc increments the counter vec with the given name and label.

func Gauge

func Gauge(name string) (gauge prometheus.Gauge, exist bool)

Gauge retrieves gauge metric by name

func GaugeDec

func GaugeDec(name string)

GaugeDec decrements the gauge with the given name.

func GaugeInc

func GaugeInc(name string)

GaugeInc increments the gauge with the given name.

func GaugeSet

func GaugeSet(name string, value float64)

GaugeSet sets the value for gauge with the given name.

func Handler

func Handler() http.Handler

Handler returns the Prometheus http handler.

func Histogram

func Histogram(name string) (histogram prometheus.Histogram, exist bool)

Histogram retrieves histogram metric by name

func HistogramObserve

func HistogramObserve(name string, value float64)

HistogramObserve observes the histogram from the given start time.

func HistogramVec

func HistogramVec(name string) (histgramVec *prometheus.HistogramVec, exist bool)

HistogramVec retrieves histogram ver metric by name

func HistogramVecObserve

func HistogramVecObserve(name string, label string, value float64)

HistogramVecObserve observes the histogram vec with the given name, label and value.

func Init

func Init()

Init initializes the package variables.

func RegisterCounterVecs

func RegisterCounterVecs(opts ...CounterVecOpts)

RegisterCounterVecs registers the provided counter vec metrics to the Prometheus registerer.

func RegisterCounters

func RegisterCounters(opts ...prometheus.CounterOpts)

RegisterCounters registers the provided counter metrics to the Prometheus registerer.

func RegisterGauges

func RegisterGauges(opts ...prometheus.GaugeOpts)

RegisterGauges registers the provided gauge metrics to the Prometheus registerer.

func RegisterHistogramVecs

func RegisterHistogramVecs(opts ...HistogramVecOpts)

RegisterHistogramVecs registers the provided histogram vec metrics to the Prometheus registerer.

func RegisterHistograms

func RegisterHistograms(opts ...prometheus.HistogramOpts)

RegisterHistograms registers the provided histogram metrics to the Prometheus registerer.

func RegisterSummaries

func RegisterSummaries(opts ...prometheus.SummaryOpts)

RegisterSummaries registers the provided summary metrics to the Prometheus registerer.

func Summary

func Summary(name string) (summary prometheus.Summary, exist bool)

Summary retrieves summary metric by name

func UnregisterCounterVecs

func UnregisterCounterVecs(names ...string)

UnregisterCounterVecs unregisters the provided counter vec metrics from the Prometheus registerer.

func UnregisterCounters

func UnregisterCounters(names ...string)

UnregisterCounters unregisters the provided counter metrics from the Prometheus registerer.

func UnregisterGauges

func UnregisterGauges(names ...string)

UnregisterGauges unregisters the provided gauge metrics from the Prometheus registerer.

func UnregisterHistogram

func UnregisterHistogram(names ...string)

UnregisterHistogram unregisters the provided histogram metrics from the Prometheus registerer.

func UnregisterHistogramVecs

func UnregisterHistogramVecs(names ...string)

UnregisterHistogramVecs unregisters the provided histogram vec metrics from the Prometheus registerer.

func UnregisterSummaries

func UnregisterSummaries(names ...string)

UnregisterSummaries unregisters the provided summary metrics from the Prometheus registerer.

Types

type Config

type Config struct {
	// Host is the address to bind the metrics server
	Host string `mapstructure:"Host"`
	// Port is the port to bind the metrics server
	Port int `mapstructure:"Port"`
	// Enabled is the flag to enable/disable the metrics server
	Enabled bool `mapstructure:"Enabled"`
	// ProfilingHost is the address to bind the profiling server
	ProfilingHost string `mapstructure:"ProfilingHost"`
	// ProfilingPort is the port to bind the profiling server
	ProfilingPort int `mapstructure:"ProfilingPort"`
	// ProfilingEnabled is the flag to enable/disable the profiling server
	ProfilingEnabled bool `mapstructure:"ProfilingEnabled"`
}

Config represents the configuration of the metrics

type CounterVecOpts

type CounterVecOpts struct {
	prometheus.CounterOpts
	Labels []string
}

CounterVecOpts holds options for the CounterVec type.

type HistogramVecOpts

type HistogramVecOpts struct {
	prometheus.HistogramOpts
	Labels []string
}

HistogramVecOpts holds options for the HistogramVec type.

Jump to

Keyboard shortcuts

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