metrics

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package metrics handles updating metrics based on ConfigMap values

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	Server            *http.Server
	Registeredmetrics map[string]*prometheus.GaugeVec
	Clientset         *kubernetes.Clientset
	Informer          cache.SharedIndexInformer
}

Server exposes a prometheus metrics endpoint It uses a SharedInformer to look for ConfigMaps with a specific prefix, it reads the labels and updates the Prometheus endpoint with a metric representing it.

func NewServer

func NewServer() *Server

NewServer Returns a new Server which holds the HTTP Server to expose the metrics endpoint, a map of registered metrics, clientset to communicate with the API Server and the Informer to listen for ConfigMaps.

func (*Server) OnAdd

func (m *Server) OnAdd(obj interface{})

OnAdd checks if a metric is registered based on the ConfigMap labels, if not it createds and registers it and then records it if it does, it just records it.

func (*Server) OnDelete

func (m *Server) OnDelete(obj interface{})

OnDelete checks if a metric is registered based on the ConfigMap labels, if not it createds and registers it and then records it if it does, it just records it.

func (*Server) OnUpdate

func (m *Server) OnUpdate(oldObj, obj interface{})

OnUpdate checks if a metric is registered based on the ConfigMap labels, if not it createds and registers it and then records it if it does, it just records it.

Jump to

Keyboard shortcuts

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