metrics

package
v0.0.0-...-96040f1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

Metrics

This package provides metric instrumentation.

You can test metrics locally by spawning a aggregation pushgateway container and pushing metrics there.

# Spawn local gateway
podman run --name cad-pushgw -e PAG_APILISTEN=:9091 -e PAG_LIFECYCLELISTEN=:9092 -p 9091:9091 -p 9092:9092 -d ghcr.io/zapier/prom-aggregation-gateway:v0.7.0
# Verify you can reach the gateway (expect empty answer until you pushed metrics)
curl http://localhost:9091/metrics 
# Point cad to the gateway
export CAD_PROMETHEUS_PUSHGATEWAY="localhost:9091"
# Run cad locally (it is not relevant for cad to succeed to test the metrics)
./cadctl investigate --payload-path payload.json
# Verify your metrics got pushed and are available on the gateway
curl http://localhost:9091/metrics

Documentation

Overview

Package metrics provides prometheus instrumentation for CAD

Index

Constants

This section is empty.

Variables

View Source
var (
	// Alerts is a metric counting all alerts CAD received
	Alerts = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: namespace, Subsystem: subsystemInvestigate,
			Name: "alerts_total",
			Help: "counts investigated alerts by alert and event type",
		}, []string{alertTypeLabel, eventTypeLabel})
	// LimitedSupportSet is a counter for limited support reasons set by cad
	LimitedSupportSet = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: namespace, Subsystem: subsystemInvestigate,
			Name: "limitedsupport_set_total",
			Help: "counts investigations resulting in setting a limited support reason",
		}, []string{alertTypeLabel, eventTypeLabel, lsSummaryLabel})
	// ServicelogPrepared is a counter for investigation ending in a prepared servicelog
	ServicelogPrepared = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: namespace, Subsystem: subsystemInvestigate,
			Name: "servicelog_prepared_total",
			Help: "counts investigations resulting in a prepared servicelog attached to the incident notes",
		}, []string{alertTypeLabel, eventTypeLabel})
	// ServicelogSent is a counter for investigation ending in a sent servicelog
	ServicelogSent = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: namespace, Subsystem: subsystemInvestigate,
			Name: "servicelog_sent_total",
			Help: "counts investigations resulting in a sent servicelog",
		}, []string{alertTypeLabel, eventTypeLabel})
)

Functions

func Inc

func Inc(counterVec *prometheus.CounterVec, lsv ...string)

Inc takes a counterVec and a set of label values and increases by one

func Push

func Push()

Push collects and pushes metrics to the configured pushgateway

Types

This section is empty.

Jump to

Keyboard shortcuts

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