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.