metrics

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HTTPPort is the port used by the HTTP server (includes a preceding colon)
	HTTPPort = ":8000"

	//MetricsPath is the path for the Prometheus metrics endpoint (includes preceding slash)
	MetricsPath = "/metrics"
)
View Source
const (
	SetNameLabel = "set_name"
)

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
	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 InitializeAll

func InitializeAll()

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

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