prometheus

package
v1.0.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KB float64 = 1 << (10 * iota)
	MB
	GB
	TB
)

Variables

This section is empty.

Functions

func NewMetric

func NewMetric(m *Metric, subsystem string) prometheus.Collector

NewMetric associates prometheus.Collector based on Metric.Type

Types

type ContextHandlerFunc

type ContextHandlerFunc func(c *contextHttp.HttpContext) error

type FavContextKeyType

type FavContextKeyType string

type Metric

type Metric struct {
	MetricCollector prometheus.Collector
	ID              string
	Name            string
	Description     string
	Type            string
	Args            []string
	Buckets         []float64
}

type Prometheus

type Prometheus struct {
	Ppg PushGateway

	MetricsList []*Metric
	MetricsPath string
	Subsystem   string

	RequestCounterURLLabelMappingFunc  RequestCounterLabelMappingFunc
	RequestCounterHostLabelMappingFunc RequestCounterLabelMappingFunc

	URLLabelFromContext string
	Datacontext         context.Context
	// contains filtered or unexported fields
}

func NewPrometheus

func NewPrometheus() *Prometheus

NewPrometheus generates a new set of metrics with a certain subsystem name

func (*Prometheus) HandlerFunc

func (p *Prometheus) HandlerFunc() ContextHandlerFunc

HandlerFunc defines handler function for middleware

func (*Prometheus) SetPushGateway

func (p *Prometheus) SetPushGateway()

func (*Prometheus) SetPushGatewayJob

func (p *Prometheus) SetPushGatewayJob(j string)

func (*Prometheus) SetPushGatewayUrl

func (p *Prometheus) SetPushGatewayUrl(pushGatewayURL, metricspath string)

func (*Prometheus) SetPushIntervalThreshold

func (p *Prometheus) SetPushIntervalThreshold(isTurn bool, pushIntervalThreshold int)

type PushGateway

type PushGateway struct {
	CounterPush           bool
	PushIntervalSeconds   time.Duration
	PushIntervalThreshold int
	PushGatewayURL        string
	Job                   string
	// contains filtered or unexported fields
}

PushGateway contains the configuration for pushing to a Prometheus pushgateway (optional)

type RequestCounterLabelMappingFunc

type RequestCounterLabelMappingFunc func(c *contextHttp.HttpContext) string

Jump to

Keyboard shortcuts

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