Documentation
¶
Overview ¶
Package metrics collects Workly's metrics and serves them in the Prometheus text exposition format.
It implements the small subset of the format Workly needs (counters, gauges and histograms with labels) on the standard library, rather than pulling in a Prometheus client.
Index ¶
- type Counter
- type Gauge
- type Histogram
- type Registry
- func (r *Registry) Counter(name, help string, labels ...string) *Counter
- func (r *Registry) Gauge(name, help string, labels ...string) *Gauge
- func (r *Registry) Handler() http.Handler
- func (r *Registry) Histogram(name, help string, buckets []float64, labels ...string) *Histogram
- func (r *Registry) OnCollect(fn func(ctx context.Context))
- func (r *Registry) Write(ctx context.Context, w *bufio.Writer)
- type Workly
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter is a monotonically increasing value per label set.
type Gauge ¶
type Gauge struct {
// contains filtered or unexported fields
}
Gauge is a value per label set that can go up and down.
type Histogram ¶
type Histogram struct {
// contains filtered or unexported fields
}
Histogram counts observations into cumulative buckets per label set.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds metric families and writes them in registration order.
func NewRegistry ¶
func NewRegistry() *Registry
type Workly ¶
type Workly struct {
*Registry
// Counted by the replica that served the request.
TasksEnqueued *Counter
// Counted by the leader, which does all delivery.
Attempts *Counter
TasksCompleted *Counter
AttemptDuration *Histogram
DispatchLag *Histogram
IsLeader *Gauge
QueueAutoPauses *Counter
// Read from the database at scrape time by the leader, so that
// replicas don't report the same queues.
QueueDue *Gauge
QueueScheduled *Gauge
QueueRunning *Gauge
QueueFailed *Gauge
QueuePaused *Gauge
QueueAutoPaused *Gauge
QueueOldestDueAge *Gauge
// Schedules, counted by the leader.
ScheduleRuns *Counter
ScheduleAttempts *Counter
ScheduleAttemptDuration *Histogram
ScheduleFireLag *Histogram
// Read at scrape time by the leader, like the queue gauges.
SchedulePaused *Gauge
ScheduleLastSuccess *Gauge
}
Workly is the set of metrics the server exports.