prometheus

package
v0.0.0-...-453cd44 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: GPL-3.0 Imports: 7 Imported by: 13

Documentation

Overview

Package prometheus provides functions that are useful to control and manage the built-in prometheus instance.

Index

Constants

View Source
const DefaultPrometheusListen = "127.0.0.1:9233"

DefaultPrometheusListen is registered in https://github.com/prometheus/prometheus/wiki/Default-port-allocations

Variables

This section is empty.

Functions

This section is empty.

Types

type Prometheus

type Prometheus struct {
	Listen string // the listen specification for the net/http server
	// contains filtered or unexported fields
}

Prometheus is the struct that contains information about the prometheus instance. Run Init() on it.

func (*Prometheus) AddManagedResource

func (obj *Prometheus) AddManagedResource(resUUID string, rtype string) error

AddManagedResource increments the Managed Resource counter and updates the resource status.

func (*Prometheus) Init

func (obj *Prometheus) Init() error

Init some parameters - currently the Listen address.

func (*Prometheus) InitKindMetrics

func (obj *Prometheus) InitKindMetrics(kinds []string) error

InitKindMetrics initialized prometheus counters. For each kind of resource, checkApply counters are initialized with all the possible value.

func (*Prometheus) RemoveManagedResource

func (obj *Prometheus) RemoveManagedResource(resUUID string, rtype string) error

RemoveManagedResource decrements the Managed Resource counter and updates the resource status.

func (*Prometheus) Start

func (obj *Prometheus) Start() error

Start runs a http server in a go routine, that responds to /metrics as prometheus would expect.

func (*Prometheus) Stop

func (obj *Prometheus) Stop() error

Stop the http server.

func (*Prometheus) UpdateCheckApplyTotal

func (obj *Prometheus) UpdateCheckApplyTotal(kind string, apply, eventful, errorful bool) error

UpdateCheckApplyTotal refreshes the failing gauge by parsing the internal state map.

func (*Prometheus) UpdatePgraphStartTime

func (obj *Prometheus) UpdatePgraphStartTime() error

UpdatePgraphStartTime updates the mgmt_graph_start_time_seconds metric to the current timestamp.

func (*Prometheus) UpdateState

func (obj *Prometheus) UpdateState(resUUID string, rtype string, newState ResState) error

UpdateState updates the state of the resources in our internal state map then triggers a refresh of the failing gauge.

type ResState

type ResState int

ResState represents the status of a resource.

const (
	// ResStateOK represents a working resource
	ResStateOK ResState = iota
	// ResStateSoftFail represents a resource in soft fail (will be retried)
	ResStateSoftFail
	// ResStateHardFail represents a resource in hard fail (will NOT be retried)
	ResStateHardFail
)

Jump to

Keyboard shortcuts

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