metrics

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RegisterMetric = NewMetricsRegister()
)

Functions

This section is empty.

Types

type CounterMetric

type CounterMetric struct {
	Metric
	Counter prometheus.Counter
}

func NewCounterWithOpts

func NewCounterWithOpts(opts prometheus.CounterOpts) CounterMetric

func (CounterMetric) Get

func (g CounterMetric) Get() *Metric

type CounterVecMetric

type CounterVecMetric struct {
	Metric
	CounterVec *prometheus.CounterVec
}

func NewCounterVecWithOpts

func NewCounterVecWithOpts(opts prometheus.CounterOpts, labelNames []string) CounterVecMetric

func (CounterVecMetric) Get

func (g CounterVecMetric) Get() *Metric

type GaugeMetric

type GaugeMetric struct {
	Metric
	Gauge prometheus.Gauge
}

func NewGaugeWithOpts

func NewGaugeWithOpts(opts prometheus.GaugeOpts) GaugeMetric

func (GaugeMetric) Get

func (g GaugeMetric) Get() *Metric

type IMetric

type IMetric interface {
	Get() *Metric
}

type Metric

type Metric struct {
	Type      string
	Namespace string
	Subsystem string
	Name      string
	Help      string
	FQDN      string
}

type MetricRegistry

type MetricRegistry struct {
	Registerer prometheus.Registerer
	Metrics    []*Metric
	// contains filtered or unexported fields
}

func NewMetricsRegister

func NewMetricsRegister() *MetricRegistry

func (*MetricRegistry) MustRegister

func (m *MetricRegistry) MustRegister(cs IMetric)

MustRegister registers a metric if it hasn't been registered yet.

Usage: MustRegister(...) Example:

func init() {
     metrics.RegisterMetric.MustRegister(errorsTotal)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳