prometheusmetrics

package module
v0.0.0-...-802b7d0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

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"

    	prometheusRegistry := prometheus.NewRegistry()
        metricsRegistry := metrics.NewRegistry()
        pClient := NewPrometheusProvider(metricsRegistry, "test", "subsys", prometheusRegistry, 1*time.Second)
        go pClient.UpdatePrometheusMetrics()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Converter

func Converter(converter MetricConverter) optSetter

func DefaultKeyNormalizer

func DefaultKeyNormalizer(key string) string

func DefaultMetricConverter

func DefaultMetricConverter(name string, i interface{}) (float64, error)

func FlushRate

func FlushRate(duration time.Duration) optSetter

func KeyNormalizer

func KeyNormalizer(normalizer Normalizer) optSetter

func LowerCaseKeyNormalizer

func LowerCaseKeyNormalizer(key string) string

Types

type MetricConverter

type MetricConverter func(name string, metric interface{}) (float64, error)

type Normalizer

type Normalizer func(name string) string

type PrometheusConfig

type PrometheusConfig struct {
	Namespace string

	Subsystem string

	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, setters ...optSetter) (*PrometheusConfig, error)

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

Jump to

Keyboard shortcuts

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