metrics

package
v1.58.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "version",
		Help: "Gauge with version-string in label",
	}, []string{"version"})
	HttpRequestsTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "http_requests_total",
		Help: "Total number of requests by path, method and status_code.",
	}, []string{"path", "method", "status_code"})
	HttpRequestsInFlight = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "http_requests_in_flight",
		Help: "Current requests being served.",
	}, []string{"path", "method"})
	HttpRequestsDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name: "http_requests_duration",
		Help: "Duration of HTTP requests in seconds by path and method.",
	}, []string{"path", "method"})
	Tasks = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "task_counter",
		Help: "Counter of tasks with name in labels",
	}, []string{"name"})
	TaskDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "task_duration",
		Help:    "Duration of tasks",
		Buckets: []float64{.05, .1, .5, 1, 5, 10, 20, 60, 90, 120, 180, 300},
	}, []string{"task"})
	DBSLongRunningQueries = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "db_long_running_queries",
		Help: "Counter of long-running-queries with database and query in labels",
	}, []string{"database", "query"})
	Errors = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "errors",
		Help: "Counter of errors with name in labels",
	}, []string{"name"})
	NotificationsCollected = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "notifications_collected",
		Help: "Counter of notification event type that gets collected",
	}, []string{"event_type"})
	NotificationsQueued = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "notifications_queued",
		Help: "Counter of notification channel and event type that gets queued",
	}, []string{"channel", "event_type"})
	NotificationsSent = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "notifications_sent",
		Help: "Counter of notifications sent with the channel and notification type in the label",
	}, []string{"channel", "status"})
	Counter = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "counter",
		Help: "Counter of events with name in labels",
	}, []string{"name"})
)

Functions

func HttpMiddleware

func HttpMiddleware(next http.Handler) http.Handler

HttpMiddleware implements mux.MiddlewareFunc. This middleware uses the path template, so the label value will be /obj/{id} rather than /obj/123 which would risk a cardinality explosion. See https://www.robustperception.io/prometheus-middleware-for-gorilla-mux

func MonitorDB

func MonitorDB(db *sqlx.DB)

func Serve

func Serve(addr string) error

Serve serves prometheus metrics on the given address under /metrics

Types

This section is empty.

Jump to

Keyboard shortcuts

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