metrics

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapServiceMetrics

func WrapServiceMetrics(service service.Service) service.Service

Types

type MappedMetrics

type MappedMetrics struct {
	Counters   map[string]prometheus.Counter
	Histograms map[string]prometheus.Histogram
	Gauges     map[string]prometheus.Gauge
}

MappedMetrics

Contains the concrete metrics defined by the service. This is passed to the configuration

type Metered

type Metered interface {
	// Metrics
	//
	// Returns a set of definitions for the MappedMetrics. This will provide the metrics
	// wrapper with definitions that will be used for your service. This object will be
	// re-used and passed along to the UpdateMetrics function after every request.
	Metrics() *MappedMetrics
	// UpdateMetrics
	//
	// Called after every response sent from the wrapped service. This gathers the necessary
	// data points so that metrics may be derived from the service call. The MappedMetrics
	// contain all metrics mapped for only the implementing service.
	UpdateMetrics(ctx context.Context, request interface{}, response interface{}, startTime time.Time,
		mappedMetrics *MappedMetrics)
	service.Service
}

Metered

This interface indicates that the service will maintain its ability to serve but also enable the processing of metrics after each request. The ProcessRequestMetrics function will be called on the deferred stack as a result of the automatic wiring.

Jump to

Keyboard shortcuts

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