Documentation
¶
Index ¶
- func RunAndBind(config *Config)
- type AggregationResult
- type ChangeStreamEvent
- type ChangeStreamEventNamespace
- type Collector
- type Config
- type Cursor
- type Driver
- type Metric
- type MongoDBConfig
- type MongoDBDriver
- func (mdb *MongoDBDriver) Aggregate(ctx context.Context, db string, col string, pipeline bson.A) (Cursor, error)
- func (mdb *MongoDBDriver) Connect(ctx context.Context, opts ...*options.ClientOptions) error
- func (mdb *MongoDBDriver) Ping(ctx context.Context, rp *readpref.ReadPref) error
- func (mdb *MongoDBDriver) Watch(ctx context.Context, db string, col string, pipeline mongo.Pipeline) (Cursor, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunAndBind ¶
func RunAndBind(config *Config)
Run executes a blocking http server. Starts the http listener with the /metrics endpoint and parses all configured metrics passed by config
Types ¶
type ChangeStreamEvent ¶
type ChangeStreamEvent struct {
NS *ChangeStreamEventNamespace
}
MongoDB event stream
type ChangeStreamEventNamespace ¶
MongoDB event stream
type Collector ¶
The collector holds the configureation and the mongodb driver
func (*Collector) PullHandler ¶
Execute aggregations and update metrics in intervals
func (*Collector) PushHandler ¶
type Config ¶
type Config struct { MongoDBConfig MongoDBConfig `mapstructure:"mongodb"` Bind string LogLevel string Metrics []*Metric }
Global configuration which holds all monitored aggregations
type Cursor ¶
type Cursor interface { Next(ctx context.Context) bool Close(ctx context.Context) error Decode(val interface{}) error }
Represents a cursor to fetch records from
type Driver ¶
type Driver interface { Connect(ctx context.Context, opts ...*options.ClientOptions) error Ping(ctx context.Context, rp *readpref.ReadPref) error Aggregate(ctx context.Context, db string, col string, pipeline bson.A) (Cursor, error) Watch(ctx context.Context, db string, col string, pipeline mongo.Pipeline) (Cursor, error) }
MongoDB driver abstraction
type Metric ¶
type Metric struct { Name string Type string Help string Value string Interval int64 ConstLabels prometheus.Labels Mode string Labels []string Database string Collection string Pipeline string // contains filtered or unexported fields }
MongoDB aggregation metric
type MongoDBConfig ¶
type MongoDBConfig struct { URI string MaxConnections int32 ConnectionTimeout time.Duration DefaultInterval int64 DefaultDatabase string DefaultCollection string }
MongoDB client options
type MongoDBDriver ¶
type MongoDBDriver struct {
// contains filtered or unexported fields
}
MongoDB driver
func (*MongoDBDriver) Aggregate ¶
func (mdb *MongoDBDriver) Aggregate(ctx context.Context, db string, col string, pipeline bson.A) (Cursor, error)
Aggregation rquery
func (*MongoDBDriver) Connect ¶
func (mdb *MongoDBDriver) Connect(ctx context.Context, opts ...*options.ClientOptions) error
Connect to the server
Click to show internal directories.
Click to hide internal directories.