metricsreporter

package
v0.1.36 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package metricsreporter provides a reporter for metrics data collected by package "github.com/rcrowley/go-metrics".

This is a reporter for package "github.com/rcrowley/go-metrics" which will submit the metrics to a metrics.Interface. See:

https://godoc.org/github.com/rcrowley/go-metrics
https://godoc.org/bitbucket.org/pcas/metrics

Example usage:

import (
	"bitbucket.org/pcas/metrics/metricsreporter"
	"bitbucket.org/pcastools/log"
	"github.com/rcrowley/go-metrics"
)

defer metricsreporter.Register(
	m,                       // The destination metrics.Interface
	metrics.DefaultRegistry, // The source go-metrics.Registry
	10 * time.Second,        // The reporting interval
	log.Stderr,              // Log any errors to stderr
).Stop()

Index

Constants

View Source
const DefaultInterval = 10 * time.Second

DefaultInterval is the default reporting interval.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reporter

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

Reporter links a go-metrics.Registry to a metrics.Interface.

func Register

func Register(m metrics.Interface, r gometrics.Registry, interval time.Duration, l log.Interface) *Reporter

Register starts submitting metrics from the registry to the metrics.Interface, reporting with given interval. If the interval is <= 0 then DefaultInterval will be used. Any errors submitting metrics will be logged to l.

func (*Reporter) Stop

func (rep *Reporter) Stop()

Stop stops the reporter submitting metrics from the registry.

Jump to

Keyboard shortcuts

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