collectors

package
v0.0.0-...-cfb183a Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PrometheusNamespace = "nginx_ingress_controller"

PrometheusNamespace default metric namespace

Functions

func GatherAndCompare

func GatherAndCompare(c prometheus.Collector, expected string, metricNames []string, reg prometheus.Gatherer) error

GatherAndCompare retrieves all metrics exposed by a collector and compares it to an expected output in the Prometheus text exposition format. metricNames allows only comparing the given metrics. All are compared if it's nil.

Types

type BinaryNameMatcher

type BinaryNameMatcher struct {
	Name   string
	Binary string
}

BinaryNameMatcher ...

func (BinaryNameMatcher) MatchAndName

func (em BinaryNameMatcher) MatchAndName(nacl common.NameAndCmdline) (bool, string)

MatchAndName returns false if the match failed, otherwise true and the resulting name.

type Controller

type Controller struct {
	prometheus.Collector
	// contains filtered or unexported fields
}

Controller defines base metrics about the ingress controller

func NewController

func NewController(pod, namespace, class string) *Controller

NewController creates a new prometheus collector for the Ingress controller operations

func (Controller) Collect

func (cm Controller) Collect(ch chan<- prometheus.Metric)

Collect implements the prometheus.Collector interface.

func (*Controller) ConfigSuccess

func (cm *Controller) ConfigSuccess(hash uint64, success bool)

ConfigSuccess set a boolean flag according to the output of the controller configuration reload

func (Controller) Describe

func (cm Controller) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector

func (*Controller) IncReloadCount

func (cm *Controller) IncReloadCount()

IncReloadCount increment the reload counter

func (*Controller) IncReloadErrorCount

func (cm *Controller) IncReloadErrorCount()

IncReloadErrorCount increment the reload error counter

func (*Controller) RemoveMetrics

func (cm *Controller) RemoveMetrics(hosts []string, registry prometheus.Gatherer)

RemoveMetrics removes metrics for hostnames not available anymore

func (*Controller) SetSSLExpireTime

func (cm *Controller) SetSSLExpireTime(servers []*ingress.Server)

SetSSLExpireTime sets the expiration time of SSL Certificates

type NGINXProcessCollector

type NGINXProcessCollector interface {
	prometheus.Collector

	Start()
	Stop()
}

NGINXProcessCollector defines a process collector interface

func NewNGINXProcess

func NewNGINXProcess(pod, namespace, ingressClass string) (NGINXProcessCollector, error)

NewNGINXProcess returns a new prometheus collector for the nginx process

type NGINXStatusCollector

type NGINXStatusCollector interface {
	prometheus.Collector

	Start()
	Stop()
}

NGINXStatusCollector defines a status collector interface

func NewNGINXStatus

func NewNGINXStatus(podName, namespace, ingressClass string, ngxHealthPort int) (NGINXStatusCollector, error)

NewNGINXStatus returns a new prometheus collector the default nginx status module

type SocketCollector

type SocketCollector struct {
	prometheus.Collector
	// contains filtered or unexported fields
}

SocketCollector stores prometheus metrics and ingress meta-data

func NewSocketCollector

func NewSocketCollector(pod, namespace, class string) (*SocketCollector, error)

NewSocketCollector creates a new SocketCollector instance using the ingress watch namespace and class used by the controller

func (SocketCollector) Collect

func (sc SocketCollector) Collect(ch chan<- prometheus.Metric)

Collect implements the prometheus.Collector interface.

func (SocketCollector) Describe

func (sc SocketCollector) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector

func (*SocketCollector) RemoveMetrics

func (sc *SocketCollector) RemoveMetrics(ingresses []string, registry prometheus.Gatherer)

RemoveMetrics deletes prometheus metrics from prometheus for ingresses and host that are not available anymore. Ref: https://godoc.org/github.com/prometheus/client_golang/prometheus#CounterVec.Delete

func (*SocketCollector) SetHosts

func (sc *SocketCollector) SetHosts(hosts sets.String)

SetHosts sets the hostnames that are being served by the ingress controller This set of hostnames is used to filter the metrics to be exposed

func (*SocketCollector) Start

func (sc *SocketCollector) Start()

Start listen for connections in the unix socket and spawns a goroutine to process the content

func (*SocketCollector) Stop

func (sc *SocketCollector) Stop()

Stop stops unix listener

type Stopable

type Stopable interface {
	prometheus.Collector
	Stop()
}

Stopable defines a prometheus collector that can be stopped

Jump to

Keyboard shortcuts

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