metrics

package
v1.2.16 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Latency is the latency metric that wrappered or composite api calls will
	// update.
	Latency LatencyMetric = &latencyAdapter{m: helperLatencyHistogram}

	// Errors counts errors encountered by api helpers.
	Errors ResultMetric = &resultAdapter{m: helperResultCounter}
)

Functions

func InstrumentedTransport

func InstrumentedTransport(t http.RoundTripper) http.RoundTripper

InstrumentedTransport is middleware that wraps the provided http.RoundTripper, adding the default Prometheus http client metrics.

The transport should be re-used between clients or the metrics will get lost/re-initialised.

func RegisterMetrics

func RegisterMetrics()

RegisterMetrics ensures that the package metrics are registered.

Types

type LatencyMetric

type LatencyMetric interface {
	Observe(function string, latency time.Duration)
}

LatencyMetric observes latency of wrappered or composite api calls.

type ResultMetric

type ResultMetric interface {
	Increment(function string, err error)
}

ResultMetric counts wrappered function errors.

Jump to

Keyboard shortcuts

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