prometheus

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WithDisableMetrics taskset.Property = func(task *taskset.Task) {
	task.ModifyProperty(disableMetricsProperty{}, func(_ interface{}) interface{} {
		return struct{}{}
	})
}

WithDisableMetrics disables metric collection for a particular task.

Functions

func NewPrometheus

func NewPrometheus(metrics Metrics) taskset.Middleware

NewPrometheus creates a middleware that reports basic metrics on each task.

Metric collection can be disabled for a particular task using WithDisableMetrics.

Every metric is reported using label values equal to {properties.Name(task)}. If any of the metrics are nil, then that metric won't be reported.

Types

type Metrics

type Metrics struct {
	// Duration is used to report each task's run duration in seconds.
	// The reported duration will exclude the time a task spends in depend() calls.
	Duration *prometheus.HistogramVec
	// Success is used to report each task's successful execution.
	Success *prometheus.CounterVec
	// Failure is used to report each task's failed execution.
	Failure *prometheus.CounterVec
}

Metrics is a set of metrics reported by prometheus middleware.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL