metric

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

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

Metrics is a type that gathers various metrics and information about an application.

func New

func New() *Metrics

New returns a new Metrics that gathers and exposes various metrics about the application.

func (*Metrics) AuditEventCounter added in v0.15.0

func (m *Metrics) AuditEventCounter() io.Writer

AuditEventCounter returns an io.Writer that increments the audit event log counter on each write call.

The returned io.Writer never returns an error on writes.

func (*Metrics) Count

func (m *Metrics) Count(h http.HandlerFunc) http.HandlerFunc

Count returns a HandlerFunc that wraps h and counts the how many requests succeeded (HTTP 200 OK) and how many failed.

Count distingushes requests that fail with some sort of well-defined error (HTTP 4xx) and requests that fail due to some internal error (HTTP 5xx).

func (*Metrics) EncodeTo

func (m *Metrics) EncodeTo(encoder expfmt.Encoder) error

EncodeTo collects all outstanding metrics information about the application and writes it to encoder.

func (*Metrics) ErrorEventCounter added in v0.15.0

func (m *Metrics) ErrorEventCounter() io.Writer

ErrorEventCounter returns an io.Writer that increments the error event log counter on each write call.

The returned io.Writer never returns an error on writes.

func (*Metrics) Latency

func (m *Metrics) Latency(h http.HandlerFunc) http.HandlerFunc

Latency returns a HandlerFunc that wraps h and measures the internal request-response latency.

The internal request-response latency is the time the application takes to generate and send a response after receiving a request. It basically shows how many request the application can handle.

Jump to

Keyboard shortcuts

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