metric

package
v2.7.11 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyMetricOpts

func ApplyMetricOpts(opts ...ClientOptFn) *metricOpts

func RecordAdditional

func RecordAdditional(props map[string]interface{}) func(opts *CollectFnOpts)

RecordAdditional provides an extension to the base method, err data provided to the metrics.

Types

type ClientOptFn

type ClientOptFn func(*metricOpts)

ClientOptFn is an option used by a metric middleware.

func WithSuffix

func WithSuffix(suffix string) ClientOptFn

WithSuffix returns a metric option that applies a suffix to the service name of the metric.

func WithVec

func WithVec(opts VecOpts) ClientOptFn

WithVec sets a new counter vector to be collected.

type CollectFnOpts

type CollectFnOpts struct {
	Method          string
	Start           time.Time
	Err             error
	AdditionalProps map[string]interface{}
}

CollectFnOpts provides arguments to the collect operation of a metric.

type CounterFn

type CounterFn func(vec *prometheus.CounterVec, o CollectFnOpts)

type HistogramFn

type HistogramFn func(vec *prometheus.HistogramVec, o CollectFnOpts)

type REDClient

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

REDClient is a metrics client for collection RED metrics.

func New

func New(reg prometheus.Registerer, service string, opts ...ClientOptFn) *REDClient

New creates a new REDClient.

func (*REDClient) Record

func (c *REDClient) Record(method string) RecordFn

Record returns a record fn that is called on any given return err. If an error is encountered it will register the err metric. The err is never altered.

type RecordFn

type RecordFn func(err error, opts ...func(opts *CollectFnOpts)) error

type VecOpts

type VecOpts struct {
	Name       string
	Help       string
	LabelNames []string

	CounterFn   CounterFn
	HistogramFn HistogramFn
}

VecOpts expands on the

Jump to

Keyboard shortcuts

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