Documentation
¶
Index ¶
- Variables
- func GetMongosInfo(client *mongo.Client) *[]MongosInfo
- func GetShards(client *mongo.Client) *[]ShardingTopoShardInfo
- func GetTotalChunks(client *mongo.Client) float64
- func GetTotalChunksByShard(client *mongo.Client) *[]ShardingTopoChunkInfo
- func GetTotalDatabases(client *mongo.Client) *[]ShardingTopoStatsTotalDatabases
- func GetTotalShardedCollections(client *mongo.Client) float64
- func IsBalancerEnabled(client *mongo.Client) float64
- func IsClusterBalanced(client *mongo.Client) float64
- type AssertsStats
- type BenchmarkStats
- type CollectionStatList
- type CollectionStatus
- type CursorStats
- type CursorStatsOpen
- type DatabaseStatList
- type DatabaseStatus
- type GetLastErrorStats
- type MetricsStats
- type MongosBalancerLock
- type MongosInfo
- type NetworkStats
- type RawStatus
- type ServerStatus
- type ShardingChangelogStats
- type ShardingChangelogSummary
- type ShardingChangelogSummaryId
- type ShardingStats
- type ShardingTopoChunkInfo
- type ShardingTopoShardInfo
- type ShardingTopoStats
- type ShardingTopoStatsTotalDatabases
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
GetTotalShardedCollections gets total sharded collections.
func IsBalancerEnabled ¶
IsBalancerEnabled check is balancer enabled.
func IsClusterBalanced ¶
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 ¶
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 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 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 ShardingTopoShardInfo ¶
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)