mongos

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Namespace is the namespace of the metrics
	Namespace = "mongodb_mongos"
)

Functions

func GetMongosInfo

func GetMongosInfo(client *mongo.Client) *[]MongosInfo

GetMongosInfo gets mongos info.

func GetShards

func GetShards(client *mongo.Client) *[]ShardingTopoShardInfo

GetShards gets shards.

func GetTotalChunks

func GetTotalChunks(client *mongo.Client) float64

GetTotalChunks gets total chunks.

func GetTotalChunksByShard

func GetTotalChunksByShard(client *mongo.Client) *[]ShardingTopoChunkInfo

GetTotalChunksByShard gets total chunks by shard.

func GetTotalDatabases

func GetTotalDatabases(client *mongo.Client) *[]ShardingTopoStatsTotalDatabases

GetTotalDatabases gets total databases.

func GetTotalShardedCollections

func GetTotalShardedCollections(client *mongo.Client) float64

GetTotalShardedCollections gets total sharded collections.

func IsBalancerEnabled

func IsBalancerEnabled(client *mongo.Client) float64

IsBalancerEnabled check is balancer enabled.

func IsClusterBalanced

func IsClusterBalanced(client *mongo.Client) float64

IsClusterBalanced check is cluster balanced.

Types

type AssertsStats

type AssertsStats struct {
	Regular   float64 `bson:"regular"`
	Warning   float64 `bson:"warning"`
	Msg       float64 `bson:"msg"`
	User      float64 `bson:"user"`
	Rollovers float64 `bson:"rollovers"`
}

AssertsStats has the assets metrics

func (*AssertsStats) Describe

func (asserts *AssertsStats) Describe(ch chan<- *prometheus.Desc)

Describe describes the metrics for prometheus

func (*AssertsStats) Export

func (asserts *AssertsStats) Export(ch chan<- prometheus.Metric)

Export exports the metrics to prometheus.

type BenchmarkStats

type BenchmarkStats struct {
	Num         float64 `bson:"num"`
	TotalMillis float64 `bson:"totalMillis"`
}

BenchmarkStats is bechmark info about an operation.

type CollectionStatList added in v0.4.0

type CollectionStatList struct {
	Members []CollectionStatus
}

CollectionStatList contains stats from all collections.

func GetCollectionStatList added in v0.4.0

func GetCollectionStatList(client *mongo.Client) *CollectionStatList

GetCollectionStatList returns stats for all non-system collections.

func (*CollectionStatList) Describe added in v0.4.0

func (collStatList *CollectionStatList) Describe(ch chan<- *prometheus.Desc)

Describe describes database stats for prometheus.

func (*CollectionStatList) Export added in v0.4.0

func (collStatList *CollectionStatList) Export(ch chan<- prometheus.Metric)

Export exports database stats to prometheus.

type CollectionStatus added in v0.4.0

type CollectionStatus struct {
	Database    string
	Name        string
	Size        int `bson:"size,omitempty"`
	Count       int `bson:"count,omitempty"`
	AvgObjSize  int `bson:"avgObjSize,omitempty"`
	StorageSize int `bson:"storageSize,omitempty"`
	Indexes     int `bson:"indexSizes,omitempty"`
	IndexesSize int `bson:"totalIndexSize,omitempty"`
}

CollectionStatus represents stats about a collection in database (mongod and raw from mongos).

type CursorStats

type CursorStats struct {
	TimedOut float64          `bson:"timedOut"`
	Open     *CursorStatsOpen `bson:"open"`
}

CursorStats are the stats for cursors

func (*CursorStats) Export

func (cursorStats *CursorStats) Export(ch chan<- prometheus.Metric)

Export exports the cursor stats.

type CursorStatsOpen

type CursorStatsOpen struct {
	NoTimeout float64 `bson:"noTimeout"`
	Pinned    float64 `bson:"pinned"`
	Total     float64 `bson:"total"`
}

CursorStatsOpen are the stats for open cursors

type DatabaseStatList added in v0.4.0

type DatabaseStatList struct {
	Members []DatabaseStatus
}

DatabaseStatList contains stats from all databases

func GetDatabaseStatList added in v0.4.0

func GetDatabaseStatList(client *mongo.Client) *DatabaseStatList

GetDatabaseStatList returns stats for all databases

func (*DatabaseStatList) Describe added in v0.4.0

func (dbStatList *DatabaseStatList) Describe(ch chan<- *prometheus.Desc)

Describe describes database stats for prometheus

func (*DatabaseStatList) Export added in v0.4.0

func (dbStatList *DatabaseStatList) Export(ch chan<- prometheus.Metric)

Export exports database stats to prometheus

type DatabaseStatus added in v0.4.0

type DatabaseStatus struct {
	RawStatus                       // embed to collect top-level attributes
	Shards    map[string]*RawStatus `bson:"raw,omitempty"`
}

DatabaseStatus represents stats about a database (mongod and raw from mongos)

type GetLastErrorStats

type GetLastErrorStats struct {
	Wtimeouts float64         `bson:"wtimeouts"`
	Wtime     *BenchmarkStats `bson:"wtime"`
}

GetLastErrorStats are the last error stats.

func (*GetLastErrorStats) Export

func (getLastErrorStats *GetLastErrorStats) Export(ch chan<- prometheus.Metric)

Export exposes the get last error stats.

type MetricsStats

type MetricsStats struct {
	GetLastError *GetLastErrorStats `bson:"getLastError"`
	Cursor       *CursorStats       `bson:"cursor"`
}

MetricsStats are all stats associated with metrics of the system

func (*MetricsStats) Describe

func (metricsStats *MetricsStats) Describe(ch chan<- *prometheus.Desc)

Describe describes the metrics for prometheus

func (*MetricsStats) Export

func (metricsStats *MetricsStats) Export(ch chan<- prometheus.Metric)

Export exports the metrics stats.

type MongosBalancerLock

type MongosBalancerLock struct {
	State   float64   `bson:"state"`
	Process string    `bson:"process"`
	Who     string    `bson:"who"`
	When    time.Time `bson:"when"`
	Why     string    `bson:"why"`
}

func GetMongosBalancerLock

func GetMongosBalancerLock(client *mongo.Client) *MongosBalancerLock

GetMongosBalancerLock gets mongos balncer lock.

type MongosInfo

type MongosInfo struct {
	Name         string    `bson:"_id"`
	Ping         time.Time `bson:"ping"`
	Up           float64   `bson:"up"`
	Waiting      bool      `bson:"waiting"`
	MongoVersion string    `bson:"mongoVersion"`
}

type NetworkStats

type NetworkStats struct {
	BytesIn     float64 `bson:"bytesIn"`
	BytesOut    float64 `bson:"bytesOut"`
	NumRequests float64 `bson:"numRequests"`
}

NetworkStats network stats

func (*NetworkStats) Describe

func (networkStats *NetworkStats) Describe(ch chan<- *prometheus.Desc)

Describe describes the metrics for prometheus

func (*NetworkStats) Export

func (networkStats *NetworkStats) Export(ch chan<- prometheus.Metric)

Export exports the data to prometheus

type RawStatus added in v0.4.0

type RawStatus struct {
	Name        string `bson:"db,omitempty"`
	IndexSize   int    `bson:"indexSize,omitempty"`
	DataSize    int    `bson:"dataSize,omitempty"`
	Collections int    `bson:"collections,omitempty"`
	Objects     int    `bson:"objects,omitempty"`
	Indexes     int    `bson:"indexes,omitempty"`
}

RawStatus represents stats about a database from Mongos side

type ServerStatus

type ServerStatus struct {
	commoncollector.ServerStatus `bson:",inline"`

	Metrics *MetricsStats `bson:"metrics"`
}

ServerStatus keeps the data returned by the serverStatus() method.

func GetServerStatus

func GetServerStatus(client *mongo.Client) *ServerStatus

GetServerStatus returns the server status info.

func (*ServerStatus) Describe

func (status *ServerStatus) Describe(ch chan<- *prometheus.Desc)

Describe describes the server status for prometheus.

func (*ServerStatus) Export

func (status *ServerStatus) Export(ch chan<- prometheus.Metric)

Export exports the server status to be consumed by prometheus.

type ShardingChangelogStats

type ShardingChangelogStats struct {
	Items *[]ShardingChangelogSummary
}

func GetShardingChangelogStatus

func GetShardingChangelogStatus(client *mongo.Client) *ShardingChangelogStats

GetShardingChangelogStatus gets sharding changelog status.

func (*ShardingChangelogStats) Describe

func (status *ShardingChangelogStats) Describe(ch chan<- *prometheus.Desc)

func (*ShardingChangelogStats) Export

func (status *ShardingChangelogStats) Export(ch chan<- prometheus.Metric)

type ShardingChangelogSummary

type ShardingChangelogSummary struct {
	Id    *ShardingChangelogSummaryId `bson:"_id"`
	Count float64                     `bson:"count"`
}

type ShardingChangelogSummaryId

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

type ShardingStats

type ShardingStats struct {
	IsBalanced      float64
	BalancerEnabled float64
	Changelog       *ShardingChangelogStats
	Topology        *ShardingTopoStats
	BalancerLock    *MongosBalancerLock
	Mongos          *[]MongosInfo

	Client *mongo.Client
}

func GetShardingStatus

func GetShardingStatus(client *mongo.Client) *ShardingStats

GetShardingStatus gets sharding status.

func (*ShardingStats) Describe

func (s *ShardingStats) Describe(ch chan<- *prometheus.Desc)

func (*ShardingStats) Export

func (s *ShardingStats) Export(ch chan<- prometheus.Metric)

type ShardingTopoChunkInfo

type ShardingTopoChunkInfo struct {
	Shard  string  `bson:"_id"`
	Chunks float64 `bson:"count"`
}

type ShardingTopoShardInfo

type ShardingTopoShardInfo struct {
	Shard    string `bson:"_id"`
	Host     string `bson:"host"`
	Draining bool   `bson:"draining",omitifempty`
}

type ShardingTopoStats

type ShardingTopoStats struct {
	TotalChunks      float64
	TotalCollections float64
	TotalDatabases   *[]ShardingTopoStatsTotalDatabases
	Shards           *[]ShardingTopoShardInfo
	ShardChunks      *[]ShardingTopoChunkInfo
}

func GetShardingTopoStatus

func GetShardingTopoStatus(client *mongo.Client) *ShardingTopoStats

GetShardingTopoStatus gets sharding topo status.

func (*ShardingTopoStats) Describe

func (status *ShardingTopoStats) Describe(ch chan<- *prometheus.Desc)

func (*ShardingTopoStats) Export

func (status *ShardingTopoStats) Export(ch chan<- prometheus.Metric)

type ShardingTopoStatsTotalDatabases

type ShardingTopoStatsTotalDatabases struct {
	Partitioned bool    `bson:"_id"`
	Total       float64 `bson:"total"`
}

Jump to

Keyboard shortcuts

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