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 ( 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.