metrics

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SetNameLabel = "set_name"
	SetHashLabel = "set_hash"
)

Constants for metric names and descriptions as well as exported labels for Vector metrics

Variables

View Source
var (
	NumPolicies            prometheus.Gauge
	AddPolicyExecTime      prometheus.Summary
	NumIPTableRules        prometheus.Gauge
	AddIPTableRuleExecTime prometheus.Summary
	NumIPSets              prometheus.Gauge
	AddIPSetExecTime       prometheus.Summary
	NumIPSetEntries        prometheus.Gauge

	// IPSetInventory should not be referenced directly. Use the functions in ipset-inventory.go
	IPSetInventory *prometheus.GaugeVec
)

Prometheus Metrics Gauge metrics have the methods Inc(), Dec(), and Set(float64) Summary metrics has the method Observe(float64) For any Vector metric, you can call With(prometheus.Labels) before the above methods

e.g. SomeGaugeVec.With(prometheus.Labels{label1: val1, label2: val2, ...).Dec()

Functions

func DecIPSetInventory added in v1.1.7

func DecIPSetInventory(setName string)

DecIPSetInventory decreases the number of entries in an IPSet and updates a Prometheus metric.

func GetIPSetInventory added in v1.1.7

func GetIPSetInventory(setName string) int

GetIPSetInventory returns the number of entries in an IPSet, or 0 if the set doesn't exist.

func GetIPSetInventoryLabels added in v1.1.7

func GetIPSetInventoryLabels(setName string) prometheus.Labels

GetIPSetInventoryLabels returns the labels for the IPSetInventory GaugeVec for a given setName.

func IncIPSetInventory added in v1.1.7

func IncIPSetInventory(setName string)

IncIPSetInventory increases the number of entries in an IPSet and updates a Prometheus metric.

func InitializeAll

func InitializeAll()

InitializeAll creates all the Prometheus Metrics. The metrics will be nil before this method is called.

func SetIPSetInventory added in v1.1.7

func SetIPSetInventory(setName string, val int)

SetIPSetInventory sets the number of entries in an IPSet and updates a Prometheus metric.

func StartHTTP added in v1.1.5

func StartHTTP(delayAmountAfterStart int)

StartHTTP starts a HTTP server in a Go routine with endpoint on port 8000. Metrics are exposed on the endpoint /metrics. By being exposed, the metrics can be scraped by a Prometheus Server or Container Insights. The function will pause for delayAmountAfterStart seconds after starting the HTTP server for the first time.

Types

type Timer

type Timer struct {
	// contains filtered or unexported fields
}

Timer is a one-time-use tool for recording time between a start and end point

func StartNewTimer

func StartNewTimer() *Timer

StartNewTimer creates a new Timer

func (*Timer) StopAndRecord added in v1.1.5

func (timer *Timer) StopAndRecord(observer prometheus.Summary)

StopAndRecord ends a timer and records its delta in a summary

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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