exporter

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Overview

Package exporter implements the collectors and metrics handlers.

Index

Constants

View Source
const (
	LabelClusterRole     = "cl_role"
	LabelClusterID       = "cl_id"
	LabelReplicasetName  = "rs_nm"
	LabelReplicasetState = "rs_state"

	TypeIsDBGrid                    = "isdbgrid"
	TypeMongos      mongoDBNodeType = "mongos"
	TypeMongod      mongoDBNodeType = "mongod"
	TypeShardServer mongoDBNodeType = "shardsvr"
)

Variables

View Source
var ErrCannotGetTopologyLabels = fmt.Errorf("cannot get topology labels")

ErrCannotGetTopologyLabels Cannot read topology labels.

Functions

func Connect

func Connect(ctx context.Context, dsn string, directConnect bool) (*mongo.Client, error)

func GetNodeType

func GetNodeType(ctx context.Context, client *mongo.Client) (mongoDBNodeType, error)

func NewTopologyInfo

func NewTopologyInfo(ctx context.Context, client *mongo.Client) (*topologyInfo, error)

Types

type CollstatsCollector

type CollstatsCollector struct {
	Ctx             context.Context
	Client          *mongo.Client
	Collections     []string
	CompatibleMode  bool
	DiscoveringMode bool
	Logger          log.Logger
	TopologyInfo    LabelsGetter
}

func (*CollstatsCollector) Collect

func (d *CollstatsCollector) Collect(ch chan<- prometheus.Metric)

func (*CollstatsCollector) Describe

func (d *CollstatsCollector) Describe(ch chan<- *prometheus.Desc)

type DiagnosticDataCollector

type DiagnosticDataCollector struct {
	Ctx            context.Context
	Client         *mongo.Client
	CompatibleMode bool
	Logger         log.Logger
	TopologyInfo   LabelsGetter
}

func (*DiagnosticDataCollector) Collect

func (d *DiagnosticDataCollector) Collect(ch chan<- prometheus.Metric)

func (*DiagnosticDataCollector) Describe

func (d *DiagnosticDataCollector) Describe(ch chan<- *prometheus.Desc)

type Exporter

type Exporter struct {
	Path             string
	Client           *mongo.Client
	Logger           logger.Logger
	Opts             *Opts
	WebListenAddress string
	TopologyInfo     LabelsGetter
}

Exporter holds Exporter methods and attributes.

func New

func New(opts *Opts) (*Exporter, error)

New connects to the database and returns a new Exporter instance.

func (*Exporter) Run

func (e *Exporter) Run()

Run starts the exporter.

type GeneralCollector

type GeneralCollector struct {
	Ctx    context.Context
	Client *mongo.Client
	Logger log.Logger
}

This collector is always enabled and it is not directly related to any particular MongoDB command to gather stats.

func (*GeneralCollector) Collect

func (d *GeneralCollector) Collect(ch chan<- prometheus.Metric)

func (*GeneralCollector) Describe

func (d *GeneralCollector) Describe(ch chan<- *prometheus.Desc)

type IndexstatsCollector

type IndexstatsCollector struct {
	Ctx             context.Context
	Client          *mongo.Client
	Collections     []string
	DiscoveringMode bool
	Logger          log.Logger
	TopologyInfo    LabelsGetter
}

func (*IndexstatsCollector) Collect

func (d *IndexstatsCollector) Collect(ch chan<- prometheus.Metric)

func (*IndexstatsCollector) Describe

func (d *IndexstatsCollector) Describe(ch chan<- *prometheus.Desc)

type LabelsGetter

type LabelsGetter interface {
	// contains filtered or unexported methods
}

type Opts

type Opts struct {
	CompatibleMode          bool
	DiscoveringMode         bool
	GlobalConnPool          bool
	DirectConnect           bool
	URI                     string
	Path                    string
	WebListenAddress        string
	IndexStatsCollections   []string
	CollStatsCollections    []string
	Logger                  logger.Logger
	DisableDiagnosticData   bool
	DisableReplicasetStatus bool
}

Opts holds new exporter options.

type ReplSetGetStatusCollector

type ReplSetGetStatusCollector struct {
	Ctx            context.Context
	Client         *mongo.Client
	CompatibleMode bool
	Logger         log.Logger
	TopologyInfo   LabelsGetter
}

func (*ReplSetGetStatusCollector) Collect

func (d *ReplSetGetStatusCollector) Collect(ch chan<- prometheus.Metric)

func (*ReplSetGetStatusCollector) Describe

func (d *ReplSetGetStatusCollector) Describe(ch chan<- *prometheus.Desc)

type ServerStatusCollector

type ServerStatusCollector struct {
	Ctx            context.Context
	Client         *mongo.Client
	CompatibleMode bool
	Logger         log.Logger
	TopologyInfo   LabelsGetter
}

func (*ServerStatusCollector) Collect

func (d *ServerStatusCollector) Collect(ch chan<- prometheus.Metric)

func (*ServerStatusCollector) Describe

func (d *ServerStatusCollector) Describe(ch chan<- *prometheus.Desc)

type ShardingChangelogStats

type ShardingChangelogStats struct {
	Items *[]ShardingChangelogSummary
}

ShardingChangelogStats is an array of Sharding changelog stats.

type ShardingChangelogSummary

type ShardingChangelogSummary struct {
	ID    *ShardingChangelogSummaryID `bson:"_id"`
	Count float64                     `bson:"count"`
}

ShardingChangelogSummary Sharding Changelog Summary.

type ShardingChangelogSummaryID

type ShardingChangelogSummaryID struct {
	Event string `bson:"event"`
	Note  string `bson:"note"`
}

ShardingChangelogSummaryID Sharding Changelog Summary ID.

Jump to

Keyboard shortcuts

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