Documentation ¶
Overview ¶
Package exporter provides all the building blocks of the prometheus-nats-exporter application.
The main components are
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeHTTPHandler ¶
Types ¶
type EventHandler ¶
type EventHandler interface {
HandleEvent(msg *redis.Message) error
}
An EventHandler is responsible to handle all the messages received from a EventListener
func NewEventHandler ¶
func NewEventHandler(metrics *Metrics, logger *slog.Logger) EventHandler
NewEventHandler creates and EventHandler that will handle the message updating the metrics
type EventListener ¶
EventListener interface exposes a single method Run() that shall run until the input context does not get canceled
func NewEventListener ¶
func NewEventListener(rdb *redis.Client, channel string, logger *slog.Logger, handler EventHandler) EventListener
NewEventListener creates and returns a new EventListener. The created listeners uses the rdb connection to subscribe to the channel and forwards all the received messages to the handler
type Metrics ¶
type Metrics struct { Executions *prometheus.CounterVec Completed *prometheus.CounterVec Locked *prometheus.CounterVec Duration *prometheus.HistogramVec LastDuration *prometheus.GaugeVec }
Metrics stores all the metrics exposed by the exporter
func SetupMetrics ¶
SetupMetrics takes care of initializing all the metrics (the names are prefixed with prefix) and register them to the default Registerer