Documentation ¶
Index ¶
- Variables
- func GatherAndCompare(c prometheus.Collector, expected string, metricNames []string, ...) error
- type BinaryNameMatcher
- type Controller
- func (cm Controller) Collect(ch chan<- prometheus.Metric)
- func (cm *Controller) ConfigSuccess(hash uint64, success bool)
- func (cm Controller) Describe(ch chan<- *prometheus.Desc)
- func (cm *Controller) IncCheckCount(namespace, name string)
- func (cm *Controller) IncCheckErrorCount(namespace, name string)
- func (cm *Controller) IncReloadCount()
- func (cm *Controller) IncReloadErrorCount()
- func (cm *Controller) OnStartedLeading(electionID string)
- func (cm *Controller) OnStoppedLeading(electionID string)
- func (cm *Controller) RemoveAllSSLExpireMetrics(registry prometheus.Gatherer)
- func (cm *Controller) RemoveMetrics(hosts []string, registry prometheus.Gatherer)
- func (cm *Controller) SetSSLExpireTime(servers []*ingress.Server)
- type NGINXProcessCollector
- type NGINXStatusCollector
- type SocketCollector
- func (sc SocketCollector) Collect(ch chan<- prometheus.Metric)
- func (sc SocketCollector) Describe(ch chan<- *prometheus.Desc)
- func (sc *SocketCollector) RemoveMetrics(ingresses []string, registry prometheus.Gatherer)
- func (sc *SocketCollector) SetHosts(hosts sets.String)
- func (sc *SocketCollector) Start()
- func (sc *SocketCollector) Stop()
- type Stoppable
Constants ¶
This section is empty.
Variables ¶
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 ¶
BinaryNameMatcher define a namer using the binary name
func (BinaryNameMatcher) MatchAndName ¶
func (em BinaryNameMatcher) MatchAndName(nacl common.ProcAttributes) (bool, string)
MatchAndName returns false if the match failed, otherwise true and the resulting name.
func (BinaryNameMatcher) String ¶
func (em BinaryNameMatcher) String() string
String returns the name of the binary to match
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) IncCheckCount ¶
func (cm *Controller) IncCheckCount(namespace, name string)
IncCheckCount increment the check counter
func (*Controller) IncCheckErrorCount ¶
func (cm *Controller) IncCheckErrorCount(namespace, name string)
IncCheckErrorCount increment the check error counter
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) OnStartedLeading ¶
func (cm *Controller) OnStartedLeading(electionID string)
OnStartedLeading indicates the pod was elected as the leader
func (*Controller) OnStoppedLeading ¶
func (cm *Controller) OnStoppedLeading(electionID string)
OnStoppedLeading indicates the pod stopped being the leader
func (*Controller) RemoveAllSSLExpireMetrics ¶
func (cm *Controller) RemoveAllSSLExpireMetrics(registry prometheus.Gatherer)
RemoveAllSSLExpireMetrics removes metrics for expiration of SSL Certificates
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) (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, metricsPerHost bool) (*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
type Stoppable ¶
type Stoppable interface { prometheus.Collector Stop() }
Stoppable defines a prometheus collector that can be stopped