metrics

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const Dummy = dummy(0)

Dummy is a dummy recorder.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPProperties

type HTTPProperties struct {
	// Service is the service that has served the request.
	Service string
	// ID is the id of the request handler.
	ID string
}

HTTPProperties are the metric properties for the global server metrics.

type HTTPReqProperties

type HTTPReqProperties struct {
	// Service is the service that has served the request.
	Service string
	// ID is the id of the request handler.
	ID string
	// Method is the method of the request.
	Method string
	// Code is the response of the request.
	Code string
}

HTTPReqProperties are the metric properties for the metrics based on client request.

type Recorder

type Recorder interface {
	// ObserveHTTPRequestDuration measures the duration of an HTTP request.
	ObserveHTTPRequestDuration(ctx context.Context, props HTTPReqProperties, duration time.Duration)
	// ObserveHTTPResponseSize measures the size of an HTTP response in bytes.
	ObserveHTTPResponseSize(ctx context.Context, props HTTPReqProperties, sizeBytes int64)
	// AddInflightRequests increments and decrements the number of inflight request being
	// processed.
	AddInflightRequests(ctx context.Context, props HTTPProperties, quantity int)
}

Recorder knows how to record and measure the metrics. This Interface has the required methods to be used with the HTTP middlewares.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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