prometheusmetrics

package module
v0.0.0-...-f2a1482 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2022 License: Apache-2.0 Imports: 6 Imported by: 21

README

go-metrics-prometheus Build Status

This is a reporter for the go-metrics library which will post the metrics to the prometheus client registry . It just updates the registry, taking care of exporting the metrics is still your responsibility.

Usage:


	import "github.com/deathowl/go-metrics-prometheus"
	import "github.com/prometheus/client_golang/prometheus"

        metricsRegistry := metrics.NewRegistry()
	prometheusClient := prometheusmetrics.NewPrometheusProvider(
	   metrics.DefaultRegistry, "whatever","something",prometheus.DefaultRegisterer, 1*time.Second)
        go prometheusClient.UpdatePrometheusMetrics()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomCollector

type CustomCollector struct {
	prometheus.Collector
	// contains filtered or unexported fields
}

for collecting prometheus.constHistogram objects

func NewCustomCollector

func NewCustomCollector(mutex *sync.Mutex) *CustomCollector

func (*CustomCollector) Collect

func (c *CustomCollector) Collect(ch chan<- prometheus.Metric)

func (*CustomCollector) Describe

func (p *CustomCollector) Describe(ch chan<- *prometheus.Desc)

type PrometheusConfig

type PrometheusConfig struct {
	Registry metrics.Registry // Registry to be exported

	FlushInterval time.Duration //interval to update prom metrics
	// contains filtered or unexported fields
}

func NewPrometheusProvider

func NewPrometheusProvider(r metrics.Registry, namespace string, subsystem string, promRegistry prometheus.Registerer, FlushInterval time.Duration) *PrometheusConfig

NewPrometheusProvider returns a Provider that produces Prometheus metrics. Namespace and subsystem are applied to all produced metrics.

func (*PrometheusConfig) UpdatePrometheusMetrics

func (c *PrometheusConfig) UpdatePrometheusMetrics()

func (*PrometheusConfig) UpdatePrometheusMetricsOnce

func (c *PrometheusConfig) UpdatePrometheusMetricsOnce() error

func (*PrometheusConfig) WithHistogramBuckets

func (c *PrometheusConfig) WithHistogramBuckets(b []float64) *PrometheusConfig

func (*PrometheusConfig) WithTimerBuckets

func (c *PrometheusConfig) WithTimerBuckets(b []float64) *PrometheusConfig

Jump to

Keyboard shortcuts

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