metric

package
Version: v0.0.0-...-5dc576f Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPRequestDuration

func HTTPRequestDuration() metadata

HTTPRequestDuration returns HTTP request duration metric metadata.

func HTTPRequestSize

func HTTPRequestSize() metadata

HTTPRequestSize returns HTTP request size metric metadata.

func HTTPRequestsInflight

func HTTPRequestsInflight() metadata

HTTPRequestsInflight returns HTTP requests inflight metric metadata.

func HTTPRequestsTotal

func HTTPRequestsTotal() metadata

HTTPRequestsTotal returns HTTP requests total metric metadata.

func HTTPResponseSize

func HTTPResponseSize() metadata

HTTPResponseSize returns HTTP response size metric metadata.

Types

type HTTPInflightProperty

type HTTPInflightProperty struct {
	Host     string
	Endpoint string
	Method   string
}

HTTPInflightProperty stores properties for the HTTP metrics of an inflight request.

type HTTPRecorder

type HTTPRecorder interface {
	// RecordRequestDuration measures the duration of an HTTP request.
	RecordRequestDuration(ctx context.Context, prop HTTPRequestProperty, duration time.Duration)
	// RecordRequestSize measures the size of an HTTP request in bytes.
	RecordRequestSize(ctx context.Context, prop HTTPRequestProperty, sizeBytes int64)
	// RecordResponseSize measures the size of an HTTP response in bytes.
	RecordResponseSize(ctx context.Context, prop HTTPRequestProperty, sizeBytes int64)
	// AddTotalRequests increments the total of completed requests.
	AddTotalRequests(ctx context.Context, prop HTTPRequestProperty, quantity int64)
	// AddInflightRequests increments and decrements the number of inflight requests.
	AddInflightRequests(ctx context.Context, prop HTTPInflightProperty, quantity int64)
}

HTTPRecorder records and measures the HTTP metrics. This interface has the required methods to be implemented by the HTTP metrics backend.

type HTTPRecorderConfig

type HTTPRecorderConfig struct {
	DurationBuckets []float64
	SizeBuckets     []float64
	HostLabel       string
	EndpointLabel   string
	MethodLabel     string
	StatusLabel     string
}

HTTPRecorderConfig stores configurations for the HTTP metrics recorder.

func (*HTTPRecorderConfig) Defaults

func (c *HTTPRecorderConfig) Defaults()

Defaults sets default values for HTTP metrics recorder configurations.

type HTTPRequestProperty

type HTTPRequestProperty struct {
	Host     string
	Endpoint string
	Method   string
	Status   string
}

HTTPRequestProperty stores properties for the HTTP metrics of an incoming request.

Source Files

Directories

Path Synopsis
backend
opentelemetry
IMPORTANT: This package is still a work in progress.
IMPORTANT: This package is still a work in progress.
gin

Jump to

Keyboard shortcuts

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