exporter

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package exporter implements the collectors and metrics handlers.

Index

Constants

View Source
const (
	// UnknownState is the values for an unknown rs state.
	// From MongoDB documentation: https://docs.mongodb.com/manual/reference/replica-states/
	UnknownState = 6

	// EnterpriseEdition shows that MongoDB is Enterprise edition.
	EnterpriseEdition = "Enterprise"
	// CommunityEdition shows that MongoDB is Community edition.
	CommunityEdition = "Community"

	// PerconaVendor means that MongoDB provided by Percona.
	PerconaVendor = "Percona"
	// MongoDBVendor means that MongoDB provided by Mongo.
	MongoDBVendor = "MongoDB"
)

Variables

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

ErrCannotGetTopologyLabels Cannot read topology labels.

View Source
var ErrInvalidOrMissingInprogEntry = errors.New("invalid or missing inprog entry in currentop results")
View Source
var ErrInvalidOrMissingTotalsEntry = fmt.Errorf("invalid or misssing totals entry in top results")

Functions

This section is empty.

Types

type Config

type Config struct {
	BaseDir                                    string        `toml:"-"`
	User                                       string        `toml:"user"`
	Password                                   string        `toml:"password"`
	DirectConnect                              bool          `toml:"direct_connect"`
	ConnectTimeout                             time.Duration `toml:"connect_timeout"`
	CollstatsColls                             []string      `toml:"collstats_colls"`
	IndexstatsColls                            []string      `toml:"indexstats_colls"`
	CollectDiagnosticdata                      bool          `toml:"collect_diagnosticdata"`
	CollectReplicasetstatus                    bool          `toml:"collect_replicasetstatus"`
	CollectDBStats                             bool          `toml:"collect_dbstats"`
	CollectDBStatsFreeStorage                  bool          `toml:"collect_dbstatsfreestorage"`
	CollectTopMetrics                          bool          `toml:"collect_topmetrics"`
	CollectCurrentopMetrics                    bool          `toml:"collect_currentopmetrics"`
	CollectIndexStats                          bool          `toml:"collect_indexstats"`
	CollectCollStats                           bool          `toml:"collect_collstats"`
	CollectProfile                             bool          `toml:"collect_profile"`
	CollectProfileSlowqueriesTimeWindowSeconds int           `toml:"collect_profile_slowqueries_time_window_seconds"`
	MetricsOverrideDescendingIndex             bool          `toml:"metrics_override_descending_index"`
	DisableCollstatsIfCollcountMoreThan        int           `toml:"disable_collstats_if_collcount_more_than"`
	DiscoveringMode                            bool          `toml:"discovering_mode"`
	CompatibleMode                             bool          `toml:"compatible_mode"`
}

func (*Config) Scrape

func (c *Config) Scrape(ctx context.Context, target string, ss *types.Samples) error

type Exporter

type Exporter struct {
	// contains filtered or unexported fields
}

Exporter holds Exporter methods and attributes.

func New

func New(opts *Opts) *Exporter

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

func (*Exporter) GetClient

func (e *Exporter) GetClient(ctx context.Context) (*mongo.Client, error)

type Opts

type Opts struct {
	// Only get stats for the collections matching this list of namespaces.
	// Example: db1.col1,db.col1
	CollStatsNamespaces    []string
	CollStatsLimit         int
	CompatibleMode         bool
	DirectConnect          bool
	ConnectTimeout         time.Duration
	DisableDefaultRegistry bool
	DiscoveringMode        bool
	ProfileTimeTS          int

	EnableDBStats            bool
	EnableDBStatsFreeStorage bool
	EnableDiagnosticData     bool
	EnableReplicasetStatus   bool
	EnableCurrentopMetrics   bool
	EnableTopMetrics         bool
	EnableIndexStats         bool
	EnableCollStats          bool
	EnableProfile            bool

	EnableOverrideDescendingIndex bool

	IndexStatsCollections []string

	URI string
}

Opts holds new exporter options.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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