baseprometheus

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MetricsHandler

func MetricsHandler(_ context.Context) http.Handler

MetricsHandler returns a handler for prometheus metrics

Types

type BaseMetricsBus

type BaseMetricsBus[TMetricsBus any] struct {
	// contains filtered or unexported fields
}

BaseMetricsBus is a base type for metrics buses

func NewBus

func NewBus[TMetricsBus any](ctx context.Context, mPrefix string) *BaseMetricsBus[TMetricsBus]

NewBus creates a new metrics bus

func (*BaseMetricsBus[TMetricsBus]) AddCounter

func (m *BaseMetricsBus[TMetricsBus]) AddCounter(
	createChild createChildMetric[TMetricsBus],
	mname, descr string, labels ...basemetrics.LabelName,
) (*Counter, error)

AddCounter adds a new counter to the bus

func (*BaseMetricsBus[TMetricsBus]) AddGauge

func (m *BaseMetricsBus[TMetricsBus]) AddGauge(
	createChild createChildMetric[TMetricsBus],
	mname, descr string, labels ...basemetrics.LabelName,
) (*Gauge, error)

AddGauge adds a new gauge to the bus

func (*BaseMetricsBus[TMetricsBus]) AddHisto

func (m *BaseMetricsBus[TMetricsBus]) AddHisto(
	createChild createChildMetric[TMetricsBus],
	mname, descr string, buckets []float64, labels ...basemetrics.LabelName,
) (*Histo, error)

AddHisto adds a new histogram to the bus

func (*BaseMetricsBus[TMetricsBus]) CreateChild

func (m *BaseMetricsBus[TMetricsBus]) CreateChild(createChildBus func(b *BaseMetricsBus[TMetricsBus]) *TMetricsBus,
	parentBus *TMetricsBus,
	labels ...basemetrics.Label,
) *TMetricsBus

CreateChild creates a child bus

type Counter

type Counter struct {
	// contains filtered or unexported fields
}

Counter is a type for counters

func (*Counter) Add

func (c *Counter) Add(v float64, labels ...basemetrics.Label)

Add adds value to counter

func (*Counter) ChildWith

func (c *Counter) ChildWith(labels []basemetrics.Label) *Counter

ChildWith creates a child counter with new labels

func (*Counter) Inc

func (c *Counter) Inc(labels ...basemetrics.Label)

Inc increments counter

type Gauge

type Gauge struct {
	// contains filtered or unexported fields
}

Gauge is a type for gauges

func (*Gauge) Add

func (g *Gauge) Add(v float64, labels ...basemetrics.Label)

Add adds value to gauge

func (*Gauge) ChildWith

func (g *Gauge) ChildWith(labels []basemetrics.Label) *Gauge

ChildWith creates a child gauge with new labels

func (*Gauge) Set

func (g *Gauge) Set(v float64, labels ...basemetrics.Label)

Set sets value to gauge

type Histo

type Histo struct {
	// contains filtered or unexported fields
}

Histo is a type for histograms

func (*Histo) ChildWith

func (h *Histo) ChildWith(labels []basemetrics.Label) *Histo

ChildWith creates a child histogram with new labels

func (*Histo) Observe

func (h *Histo) Observe(v float64, labels ...basemetrics.Label)

Observe observes histogram

Jump to

Keyboard shortcuts

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