metrics

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: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Recorder Recorder
	// func that allows you to provide a strategy to identify/group metrics
	// you can group metrics by request host/url/... or app name ...
	// by default, we group metrics by request url
	IdentifierProvider func(req *http.Request) string
	// if set to true, each response status will be represented by a metrics
	// if set to false, response status codes will be grouped by first digit (204/201/200/... -> 2xx; 404/403/... -> 4xx)
	SplitStatus bool
	// if set to true, recorder will add a responseSize metric
	ObserveResponseSize bool
	// if set to true, recorder will add a metric representing the number of inflight requests
	MeasureInflightRequests bool
}

func NewConfig

func NewConfig(recorder Recorder) *Config

type Recorder

type Recorder interface {
	ObserveHTTPRequestDuration(ctx context.Context, id string, duration time.Duration, method, code string)
	ObserveHTTPResponseSize(ctx context.Context, id string, responseSize int64, method, code string)
	AddInflightRequests(ctx context.Context, id string, quantity int)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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