mongos

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2019 License: Apache-2.0 Imports: 7 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(session *mgo.Session) *[]MongosInfo

func GetShards

func GetShards(session *mgo.Session) *[]ShardingTopoShardInfo

func GetTotalChunks

func GetTotalChunks(session *mgo.Session) float64

func GetTotalChunksByShard

func GetTotalChunksByShard(session *mgo.Session) *[]ShardingTopoChunkInfo

func GetTotalDatabases

func GetTotalDatabases(session *mgo.Session) *[]ShardingTopoStatsTotalDatabases

func GetTotalShardedCollections

func GetTotalShardedCollections(session *mgo.Session) float64

func IsBalancerEnabled

func IsBalancerEnabled(session *mgo.Session) float64

func IsClusterBalanced

func IsClusterBalanced(session *mgo.Session) float64

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(session *mgo.Session) *CollectionStatList

GetDatabaseStatus returns stats for a given database

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 ConnectionStats

type ConnectionStats struct {
	Current      float64 `bson:"current"`
	Available    float64 `bson:"available"`
	TotalCreated float64 `bson:"totalCreated"`
}

ConnectionStats are connections metrics

func (*ConnectionStats) Describe

func (connectionStats *ConnectionStats) Describe(ch chan<- *prometheus.Desc)

Describe describes the metrics for prometheus

func (*ConnectionStats) Export

func (connectionStats *ConnectionStats) Export(ch chan<- prometheus.Metric)

Export exports the data to prometheus.

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 Cursors

type Cursors struct {
	TotalOpen      float64 `bson:"totalOpen"`
	TimeOut        float64 `bson:"timedOut"`
	TotalNoTimeout float64 `bson:"totalNoTimeout"`
	Pinned         float64 `bson:"pinned"`
}

Cursors are the cursor metrics

func (*Cursors) Describe

func (cursors *Cursors) Describe(ch chan<- *prometheus.Desc)

Describe describes the metrics for prometheus

func (*Cursors) Export

func (cursors *Cursors) Export(ch chan<- prometheus.Metric)

Export exports the data to prometheus.

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(session *mgo.Session) *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 ExtraInfo

type ExtraInfo struct {
	HeapUsageBytes float64 `bson:"heap_usage_bytes"`
	PageFaults     float64 `bson:"page_faults"`
}

ExtraInfo has extra info metrics

func (*ExtraInfo) Describe

func (extraInfo *ExtraInfo) Describe(ch chan<- *prometheus.Desc)

Describe describes the metrics for prometheus

func (*ExtraInfo) Export

func (extraInfo *ExtraInfo) Export(ch chan<- prometheus.Metric)

Export exports the metrics to prometheus.

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 MemStats

type MemStats struct {
	Bits              float64 `bson:"bits"`
	Resident          float64 `bson:"resident"`
	Virtual           float64 `bson:"virtual"`
	Mapped            float64 `bson:"mapped"`
	MappedWithJournal float64 `bson:"mappedWithJournal"`
}

MemStats tracks the mem stats metrics.

func (*MemStats) Describe

func (memStats *MemStats) Describe(ch chan<- *prometheus.Desc)

Describe describes the metrics for prometheus

func (*MemStats) Export

func (memStats *MemStats) Export(ch chan<- prometheus.Metric)

Export exports the data to prometheus.

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(session *mgo.Session) *MongosBalancerLock

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 OpcountersReplStats

type OpcountersReplStats struct {
	Insert  float64 `bson:"insert"`
	Query   float64 `bson:"query"`
	Update  float64 `bson:"update"`
	Delete  float64 `bson:"delete"`
	GetMore float64 `bson:"getmore"`
	Command float64 `bson:"command"`
}

OpcountersReplStats opcounters stats

func (*OpcountersReplStats) Describe

func (opCounters *OpcountersReplStats) Describe(ch chan<- *prometheus.Desc)

Describe describes the metrics for prometheus

func (*OpcountersReplStats) Export

func (opCounters *OpcountersReplStats) Export(ch chan<- prometheus.Metric)

Export exports the data to prometheus.

type OpcountersStats

type OpcountersStats struct {
	Insert  float64 `bson:"insert"`
	Query   float64 `bson:"query"`
	Update  float64 `bson:"update"`
	Delete  float64 `bson:"delete"`
	GetMore float64 `bson:"getmore"`
	Command float64 `bson:"command"`
}

OpcountersStats opcounters stats

func (*OpcountersStats) Describe

func (opCounters *OpcountersStats) Describe(ch chan<- *prometheus.Desc)

Describe describes the metrics for prometheus

func (*OpcountersStats) Export

func (opCounters *OpcountersStats) 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 {
	Uptime         float64   `bson:"uptime"`
	UptimeEstimate float64   `bson:"uptimeEstimate"`
	LocalTime      time.Time `bson:"localTime"`

	Asserts *AssertsStats `bson:"asserts"`

	Connections *ConnectionStats `bson:"connections"`

	ExtraInfo *ExtraInfo `bson:"extra_info"`

	Network *NetworkStats `bson:"network"`

	Opcounters *OpcountersStats `bson:"opcounters"`
	Mem        *MemStats        `bson:"mem"`
	Metrics    *MetricsStats    `bson:"metrics"`

	Cursors *Cursors `bson:"cursors"`
}

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

func GetServerStatus

func GetServerStatus(session *mgo.Session) *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(session *mgo.Session) *ShardingChangelogStats

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
}

func GetShardingStatus

func GetShardingStatus(session *mgo.Session) *ShardingStats

func (*ShardingStats) Describe

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

func (*ShardingStats) Export

func (status *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(session *mgo.Session) *ShardingTopoStats

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