metrics

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalMetricCache = NewMetricCache()

Global metric cache instance.

Functions

func EscapeKeyValue

func EscapeKeyValue(s string) string

func GetMetrics

func GetMetrics() string

func GetMetricsByKey

func GetMetricsByKey() map[string]string

func Handle

func Handle() http.Handler

func StartAdvancedMQTTMetricsPublisher

func StartAdvancedMQTTMetricsPublisher(ctx context.Context, topicPrefix string, mqttClient *mqtt.Client, interval time.Duration)

func StartSimpleMQTTMetricsPublisher

func StartSimpleMQTTMetricsPublisher(ctx context.Context, topicPrefix string, mqttClient *mqtt.Client, interval time.Duration)

Types

type MetricCache

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

MetricCache caches different types of Prometheus metrics by label.

func NewMetricCache

func NewMetricCache() *MetricCache

NewMetricCache initializes a new metric cache.

func (*MetricCache) GetCounter

func (mc *MetricCache) GetCounter(name string, labels prometheus.Labels) prometheus.Counter

GetCounter retrieves or creates a counter from the cache.

func (*MetricCache) GetGauge

func (mc *MetricCache) GetGauge(name string, labels prometheus.Labels) prometheus.Gauge

GetGauge retrieves or creates a gauge from the cache.

func (*MetricCache) GetHistogram

func (mc *MetricCache) GetHistogram(name string, labels prometheus.Labels, buckets []float64) prometheus.Histogram

GetHistogram retrieves or creates a histogram from the cache.

Jump to

Keyboard shortcuts

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