Documentation ¶
Overview ¶
Package metrics provides the metrics recorder
Package metrics provides the metrics recorder
Index ¶
Constants ¶
View Source
const ( MetricLabelInstance = "instance" MetricLabelHandler = "handler" MetricLabelCode = "code" MetricLabelMethod = "method" MetricLabelModule = "module" MetricLabelErrors = "errors" MetricLabelEvent = "event" MetricLabelSite = "site" MetricLabelState = "state" )
Variables ¶
This section is empty.
Functions ¶
func MetricLabelNames ¶ added in v0.0.38
func MetricLabelNames(metricType MetricType) []string
MetricLabelNames returns the labels for the given metric type
func MetricLabels ¶ added in v0.0.35
func MetricLabels() map[MetricType][]string
MetricLabels returns the labels for the given metric type
Types ¶
type MetricData ¶ added in v0.0.46
type MetricType ¶ added in v0.0.35
type MetricType string
const ( //MetricRequestSizeBytes MetricType = "request_size_bytes" // MetricRequestSizeBytes is the request size in bytes //MetricRequestDurationSeconds MetricType = "request_duration_seconds" // MetricRequestDurationSeconds is the request duration in seconds //MetricRequestsTotal MetricType = "requests_total" // MetricRequestsTotal is the total number of requests //MetricRequestsSlowTotal MetricType = "requests_slow_total" // MetricRequestsSlowTotal is the total number of slow requests //MetricRequestsInFlight MetricType = "requests_in_flight" // MetricRequestsInFlight is the number of requests in flight //MetricResponseSizeBytes MetricType = "response_size_bytes" // MetricResponseSizeBytes is the response size in bytes //MetricErrorsTotal MetricType = "errors_total" // MetricErrorsTotal is the total number of errors //MetricEvent MetricType = "event" // MetricEvent is the event //MetricSiteEvent MetricType = "site_event" // MetricSiteEvent is the site event //MetricSummaryLatency MetricType = "summary_latency" // MetricSummaryLatency is the summary latency MetricUptime MetricType = "uptime" MetricRequestsTotal MetricType = "requests_total" MetricRequestsDurationSeconds MetricType = "requests_duration_seconds" MetricRequestsInFlight MetricType = "requests_in_flight" MetricRequestsSlowTotal MetricType = "requests_slow_total" MetricCounterSendBytes MetricType = "counter_send_bytes" MetricCounterRecvBytes MetricType = "counter_recv_bytes" MetricHistogramLatency MetricType = "histogram_latency" MetricSummaryLatency MetricType = "summary_latency" MetricCounterException MetricType = "counter_exception" MetricCounterEvent MetricType = "counter_event" MetricCounterSiteEvent MetricType = "counter_site_event" )
func (MetricType) String ¶ added in v0.0.35
func (m MetricType) String() string
type Metrics ¶
type Metrics interface { Enabled() bool // Enabled returns whether metrics is enabled Disable() Observe(ctx context.Context, data MetricData) Log(ctx context.Context, handler, method string, code int, sendBytes, recvBytes int64, latency float64) }
Metrics is the metrics interface for metrics
type Recorder ¶ added in v0.0.33
type Recorder interface { RequestTotal(module, handler, method, code string) CounterSendBytes(module, handler, method, code string, length int64) CounterRecvBytes(module, handler, method, code string, length int64) RequestDurationSeconds(module, handler, method string, latency int64) SummaryLatencyLog(module, handler, method string, latency int64) CounterException(module, errors string) CounterEvent(module, event string) CounterSiteEvent(module, event, site string) RequestsInFlight(module, state string, value int64) }
Recorder is an interface for recording various metrics.
Click to show internal directories.
Click to hide internal directories.