prometheus

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Namespace is the prefix that will be set on the metrics, by default it will be empty.
	Namespace string
	// DurationBuckets are the buckets used by Prometheus for the HTTP request duration metrics,
	// by default uses Prometheus default buckets (from 5ms to 10s).
	DurationBuckets []float64
	// SizeBuckets are the buckets used by Prometheus for the HTTP response size metrics,
	// by default uses a exponential buckets from 100B to 1GB.
	SizeBuckets []float64
	// Registry is the registry that will be used by the recorder to store the metrics,
	// if the default registry is not used then it will use the default one.
	Registry prometheus.Registerer
	// IdentifierLabel is the name that will be set to the handler ID label, by default is `handler`.
	IdentifierLabel string
	// StatusCodeLabel is the name that will be set to the status code label, by default is `code`.
	StatusCodeLabel string
	// MethodLabel is the name that will be set to the method label, by default is `method`.
	MethodLabel string
}

type Recorder

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

func NewRecorder

func NewRecorder(config Config) *Recorder

func (*Recorder) AddInflightRequests

func (r *Recorder) AddInflightRequests(_ context.Context, id string, quantity int)

func (*Recorder) ObserveHTTPRequestDuration

func (r *Recorder) ObserveHTTPRequestDuration(_ context.Context, id string, duration time.Duration, method, code string)

func (*Recorder) ObserveHTTPResponseSize

func (r *Recorder) ObserveHTTPResponseSize(_ context.Context, id string, responseSize int64, method, code string)

func (*Recorder) RegisterOn

func (r *Recorder) RegisterOn(registry prometheus.Registerer) metrics.Recorder

Jump to

Keyboard shortcuts

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