Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultHandler = &Handler{ TrimPrefix: stats.DefaultEngine.Prefix, }
DefaultHandler is a prometheus handler configured to trim the default metric namespace off of metrics that it handles.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// Setting this field will trim this prefix from metric namespaces of the
// metrics received by this handler.
//
// Unlike statsd-like systems, it is common for prometheus metrics to not
// be prefixed and instead use labels to identify which service or group
// of services the metrics are coming from. The intent of this field is to
// provide support for this use case.
//
// Note that triming only applies to the metric namespace, the metric
// name will always be left untouched.
//
// If empty, no prefix trimming is done.
TrimPrefix string
// MetricTimeout defines how long the handler exposes metrics that aren't
// receiving updates.
//
// The default is to use a 2 minutes metric timeout.
MetricTimeout time.Duration
// Buckets is the registry of histogram buckets used by the handler,
// If nil, stats.Buckets is used instead.
Buckets stats.HistogramBuckets
// contains filtered or unexported fields
}
Handler is a type that bridges the stats API to a prometheus-compatible HTTP endpoint.
Typically, a program creates one Handler, registers it to the stats package, and adds it to the muxer used by the application under the /metrics path.
The handle ignores histograms that have no buckets set.
func (*Handler) HandleMeasures ¶
HandleMetric satisfies the stats.Handler interface.
Source Files
¶
- append.go
- handler.go
- label.go
- metric.go
Click to show internal directories.
Click to hide internal directories.