metrics

package
v0.0.0-...-bb33fa6 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buckets

type Buckets struct {
	Start int
	Range uint
	Count uint
}

type Counter

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

func NewCounter

func NewCounter(opts CounterOpts) *Counter

func (*Counter) Add

func (counter *Counter) Add(value float64)

func (*Counter) Description

func (counter *Counter) Description() *Description

func (*Counter) Get

func (counter *Counter) Get() float64

func (*Counter) Inc

func (counter *Counter) Inc()

func (*Counter) JsonData

func (counter *Counter) JsonData() any

func (*Counter) Reset

func (counter *Counter) Reset()

func (*Counter) Write

func (counter *Counter) Write(writer io.Writer)

type CounterOpts

type CounterOpts struct {
	Name string
	Help string
}

type CounterVector

type CounterVector struct {
	*MetricVector[*Counter]
	// contains filtered or unexported fields
}

func NewCounterVector

func NewCounterVector(opts CounterOpts, labels ...string) *CounterVector

func (*CounterVector) Description

func (counterVector *CounterVector) Description() *Description

func (*CounterVector) JsonData

func (counterVector *CounterVector) JsonData() any

func (*CounterVector) Reset

func (counterVector *CounterVector) Reset()

func (*CounterVector) Write

func (counterVector *CounterVector) Write(writer io.Writer)

type Description

type Description struct {
	Name string `json:"name"`
	Type string `json:"type"`
	Help string `json:"help"`
}

type Gauge

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

func NewGauge

func NewGauge(opts GaugeOpts) *Gauge

func (*Gauge) Add

func (gauge *Gauge) Add(value float64)

func (*Gauge) Dec

func (gauge *Gauge) Dec()

func (*Gauge) Description

func (gauge *Gauge) Description() *Description

func (*Gauge) Get

func (gauge *Gauge) Get() float64

func (*Gauge) Inc

func (gauge *Gauge) Inc()

func (*Gauge) JsonData

func (gauge *Gauge) JsonData() any

func (*Gauge) Reset

func (gauge *Gauge) Reset()

func (*Gauge) Set

func (gauge *Gauge) Set(value float64)

func (*Gauge) Sub

func (gauge *Gauge) Sub(value float64)

func (*Gauge) Write

func (gauge *Gauge) Write(writer io.Writer)

type GaugeOpts

type GaugeOpts struct {
	Name string
	Help string
}

type GaugeVector

type GaugeVector struct {
	*MetricVector[*Gauge]
	// contains filtered or unexported fields
}

func NewGaugeVector

func NewGaugeVector(opts GaugeOpts, labels ...string) *GaugeVector

func (*GaugeVector) Description

func (gaugeVector *GaugeVector) Description() *Description

func (*GaugeVector) JsonData

func (gaugeVector *GaugeVector) JsonData() any

func (*GaugeVector) Reset

func (gaugeVector *GaugeVector) Reset()

func (*GaugeVector) Write

func (gaugeVector *GaugeVector) Write(writer io.Writer)

type Handler

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

func (Handler) ServeHTTP

func (handler Handler) ServeHTTP(writer http.ResponseWriter, request *http.Request)

type Histogram

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

func NewHistogram

func NewHistogram(opts HistogramOpts) *Histogram

func (*Histogram) Description

func (histogram *Histogram) Description() *Description

func (*Histogram) JsonData

func (histogram *Histogram) JsonData() any

func (*Histogram) Observe

func (histogram *Histogram) Observe(value float64)

func (*Histogram) Reset

func (histogram *Histogram) Reset()

func (*Histogram) Write

func (histogram *Histogram) Write(writer io.Writer)

type HistogramJsonDataItem

type HistogramJsonDataItem struct {
	Buckets  Buckets   `json:"buckets,omitempty"`
	MinusInf float64   `json:"minus_inf"`
	PlusInf  float64   `json:"plus_inf"`
	Values   []float64 `json:"values"`
}

type HistogramOpts

type HistogramOpts struct {
	Name    string
	Help    string
	Buckets Buckets
}

type HistogramVector

type HistogramVector struct {
	*MetricVector[*Histogram]
	// contains filtered or unexported fields
}

func NewHistogramVector

func NewHistogramVector(opts HistogramOpts, labels ...string) *HistogramVector

func (*HistogramVector) Description

func (histogramVector *HistogramVector) Description() *Description

func (*HistogramVector) JsonData

func (histogramVector *HistogramVector) JsonData() any

func (*HistogramVector) Reset

func (histogramVector *HistogramVector) Reset()

func (*HistogramVector) Write

func (histogramVector *HistogramVector) Write(writer io.Writer)

type JsonHandler

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

func (JsonHandler) ServeHTTP

func (handler JsonHandler) ServeHTTP(writer http.ResponseWriter, request *http.Request)

type Label

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

func NewLabel

func NewLabel(opts LabelOpts) *Label

func (*Label) Description

func (label *Label) Description() *Description

func (*Label) Get

func (label *Label) Get() string

func (*Label) JsonData

func (label *Label) JsonData() any

func (*Label) Reset

func (label *Label) Reset()

func (*Label) Set

func (label *Label) Set(value string)

func (*Label) Write

func (label *Label) Write(writer io.Writer)

type LabelOpts

type LabelOpts struct {
	Name string
	Help string
}

type LabelVector

type LabelVector struct {
	*MetricVector[*Label]
	// contains filtered or unexported fields
}

func NewLabelVector

func NewLabelVector(opts LabelOpts, labels ...string) *LabelVector

func (*LabelVector) Description

func (labelVector *LabelVector) Description() *Description

func (*LabelVector) JsonData

func (labelVector *LabelVector) JsonData() any

func (*LabelVector) Reset

func (labelVector *LabelVector) Reset()

func (*LabelVector) Write

func (labelVector *LabelVector) Write(writer io.Writer)

type Labels

type Labels map[string]string

type Metric

type Metric interface {
	Description() *Description
	Write(io.Writer)
	JsonData() any
	Reset()
}

type MetricJsonData

type MetricJsonData struct {
	Description Description `json:"description"`
	Data        any         `json:"data"`
}

type MetricVector

type MetricVector[T Metric] struct {
	Metric
	// contains filtered or unexported fields
}

func NewMetricVector

func NewMetricVector[T Metric](defaultConsctructor func() T, labels ...string) *MetricVector[T]

func (*MetricVector[T]) With

func (metricVector *MetricVector[T]) With(labels Labels) T

func (*MetricVector[T]) WithLabelValues

func (metricVector *MetricVector[T]) WithLabelValues(labels ...string) T

type MetricVectorJsonData

type MetricVectorJsonData struct {
	Description Description `json:"description"`
	Labels      []string    `json:"labels"`
	Data        any         `json:"data"`
}

type Registry

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

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Handler

func (registry *Registry) Handler() Handler

func (*Registry) JsonHandler

func (registry *Registry) JsonHandler() JsonHandler

func (*Registry) Register

func (registry *Registry) Register(metric Metric)

Jump to

Keyboard shortcuts

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