Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConnection ¶
func NewConnection(uri string) (wrapper.IConnection, error)
NewConnection opens a connection to mongoDB by using the given uri
func RegisterHealthChecks ¶
func RegisterHealthChecks(mongoUrl string) (netHttp.HandlerFunc, error)
RegisterHealthChecks initializes health checks for the Exporter and returns an http handler func
Types ¶
type Collector ¶
type Collector struct { Mongo wrapper.IConnection ErrorC chan error // contains filtered or unexported fields }
Collector queries one prometheus metric from mongoDB
func NewCollector ¶
func NewCollector(m Metric, con wrapper.IConnection, errorC chan error) *Collector
NewCollector constructor initializes every descriptor and returns a pointer to the collector
func (*Collector) Collect ¶
func (col *Collector) Collect(ch chan<- prometheus.Metric)
Collect implements required collect function for all prometheus collectors
func (*Collector) Describe ¶
func (col *Collector) Describe(ch chan<- *prometheus.Desc)
Describe must be implemented by a prometheus collector It essentially writes all descriptors to the prometheus desc channel.
type Config ¶
Config Root config struct
func ReadConfig ¶
ReadConfig Parses given config content
func ReadConfigFile ¶
ReadConfigFile Initializes a Config instance from a given file path
type Connection ¶
Connection to mongoDB
type HttpServer ¶
type HttpServer struct { Port int // contains filtered or unexported fields }
HttpServer serves endpoints from the given Config
func NewHttpServer ¶
func NewHttpServer(config Config) *HttpServer
NewHttpServer creates a new instance of the HttpServer
func (*HttpServer) Shutdown ¶
func (s *HttpServer) Shutdown(ctx context.Context) error
Shutdown stops the running server
func (*HttpServer) Start ¶
func (s *HttpServer) Start(wg *sync.WaitGroup)
Starts the HttpServer Returns a WaitGroup which will be released as soon as the server stops