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
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 ¶
EncodeTo collects all outstanding metrics information about the application and writes it to encoder.
func (*Metrics) ErrorEventCounter ¶ added in v0.15.0
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.