metricsmiddleware

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNew

func MustNew(c Config) endpoint.Middleware

MustNew returns a new metrics middleware but panics in case of error.

func New

func New(c Config) (endpoint.Middleware, error)

New returns a new metrics middleware.

Types

type Config

type Config struct {
	// Metrifier is the metrifier configuration
	Metrifier metrifier.Config

	// LabelDecoder defines decoder for labels. The Labels must also be declared
	// in the Metrifier.ExtraLabels.
	LabelsDecoder LabelsDecoder
}

Config is used to configure a metrics middleware.

func NewDefaultConfig

func NewDefaultConfig(system, subsystem string) Config

NewDefaultConfig returns a new Config with sane defaults.

type LabelsDecoder

type LabelsDecoder func(ctx context.Context, req, resp interface{}, err error) map[string]string

LabelsDecoder defines a functions that generates a label value by processing the endpoint's request and response.

Directories

Path Synopsis
v2
example
This is a simple example that shows how to setup the metrics middleware.
This is a simple example that shows how to setup the metrics middleware.
v3
example
This is a simple example that shows how to setup the metrics middleware.
This is a simple example that shows how to setup the metrics middleware.
v4
example
This is a simple example that shows how to setup the metrics middleware.
This is a simple example that shows how to setup the metrics middleware.

Jump to

Keyboard shortcuts

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