monitor

package
v0.0.0-...-1513131 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CounterMetric

type CounterMetric interface {
	IncrementCounter(ctx context.Context, tags Tags)
	SetValue(ctx context.Context, value float64, tags Tags)
}

type GaugeMetric

type GaugeMetric interface {
	SetValue(ctx context.Context, value float64, tags Tags)
}

type HistogramMetrics

type HistogramMetrics interface {
	ObserveHistogram(ctx context.Context, value float64, tags Tags)
}

type Labels

type Labels []string

type Monitoring

type Monitoring interface {
	RegisterCounter(ctx context.Context, name string, help string, labels Labels) CounterMetric
	RegisterGauge(ctx context.Context, name string, help string, labels Labels) GaugeMetric
	RegisterHistogram(ctx context.Context, name string, help string, buckets []float64, labels Labels) HistogramMetrics
	ExposeMetrics(addr string)
}

Monitoring is the interface for monitoring operations

type PrometheusMonitoring

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

PrometheusMonitoring struct containing mutex, maps for different types of metrics, and a logger

func NewPrometheusMonitoring

func NewPrometheusMonitoring() *PrometheusMonitoring

NewPrometheusMonitoring initializes and returns a new PrometheusMonitoring instance

func (*PrometheusMonitoring) ExposeMetrics

func (pm *PrometheusMonitoring) ExposeMetrics(addr string)

ExposeMetrics sets up an HTTP server to expose the /metrics endpoint for Prometheus scraping

func (*PrometheusMonitoring) RegisterCounter

func (pm *PrometheusMonitoring) RegisterCounter(ctx context.Context, name string, help string, labels Labels) CounterMetric

RegisterCounter is a public method to register a counter

func (*PrometheusMonitoring) RegisterGauge

func (pm *PrometheusMonitoring) RegisterGauge(ctx context.Context, name string, help string, labels Labels) GaugeMetric

RegisterGauge is a public method to register a gauge

func (*PrometheusMonitoring) RegisterHistogram

func (pm *PrometheusMonitoring) RegisterHistogram(ctx context.Context, name string, help string, buckets []float64, labels Labels) HistogramMetrics

RegisterHistogram is a public method to register a histogram

type Tags

type Tags interface {
	Add(key string, value interface{})
	Delete(key string)
	Get() map[string]string
	With(key string, value interface{}) Tags
	AddTagsFromCtx(ctx context.Context)
	CleanUp()
}

Tags is the interface for managing tags

func NewTags

func NewTags() Tags

NewTags creates a new instance of tagsImpl

func NewTagsKV

func NewTagsKV(key string, value interface{}) Tags

NewTags creates a new instance of tagsImpl

Jump to

Keyboard shortcuts

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