Documentation ¶
Index ¶
- Variables
- func BsonMongoTimestampToUnix(timestamp bson.MongoTimestamp) float64
- func GetOplogTimestamp(session *mgo.Session, returnTail bool) (float64, error)
- type ApplyStats
- type AssertsStats
- type BenchmarkStats
- type BufferStats
- type ClientStats
- type ConnectionStats
- type CursorStats
- type CursorStatsOpen
- type Cursors
- type DatabaseStatus
- type DocumentStats
- type DurStats
- type DurTiming
- type ExtraInfo
- type FlushStats
- type GetLastErrorStats
- type GlobalLockStats
- type IndexCounterStats
- type LockStats
- type LockStatsMap
- type MemStats
- type Member
- type MetricsNetworkStats
- type MetricsStats
- type MongodbCollector
- type MongodbCollectorOpts
- type NetworkStats
- type OpcountersReplStats
- type OpcountersStats
- type OperationStats
- type OplogCollectionStats
- type OplogStatus
- type PreloadStats
- type QueryExecutorStats
- type QueueStats
- type RawStatus
- type ReadWriteLockTimes
- type RecordStats
- type ReplSetStatus
- type ReplStats
- type ServerStatus
- type StorageStats
Constants ¶
This section is empty.
Variables ¶
var (
// Namespace is the namespace of the metrics
Namespace = "mongodb"
)
Functions ¶
func BsonMongoTimestampToUnix ¶
func BsonMongoTimestampToUnix(timestamp bson.MongoTimestamp) float64
BsonMongoTimestampToUnix converts a mongo timestamp to UNIX time there's gotta be a better way to do this, but it works for now :/
func GetOplogTimestamp ¶
GetOplogTimestamp fetches the latest oplog timestamp
Types ¶
type ApplyStats ¶
type ApplyStats struct { Batches *BenchmarkStats `bson:"batches"` Ops float64 `bson:"ops"` }
ApplyStats are the stats associated with the apply operation.
func (*ApplyStats) Export ¶
func (applyStats *ApplyStats) Export(ch chan<- prometheus.Metric)
Export exports the apply stats
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 BufferStats ¶
type BufferStats struct { Count float64 `bson:"count"` MaxSizeBytes float64 `bson:"maxSizeBytes"` SizeBytes float64 `bson:"sizeBytes"` }
BufferStats are the stats associated with the buffer
func (*BufferStats) Export ¶
func (bufferStats *BufferStats) Export(ch chan<- prometheus.Metric)
Export exports the buffer stats.
type ClientStats ¶
type ClientStats struct { Total float64 `bson:"total"` Readers float64 `bson:"readers"` Writers float64 `bson:"writers"` }
ClientStats metrics for client stats
func (*ClientStats) Export ¶
func (clientStats *ClientStats) Export(ch chan<- prometheus.Metric)
Export exports the metrics to prometheus
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 DatabaseStatus ¶
type DatabaseStatus struct { RawStatus // embed to collect top-level attributes Shards map[string]*RawStatus `bson:"raw,omitempty"` }
DatabaseStatus represents stats about a database
func GetDatabaseStatus ¶
func GetDatabaseStatus(session *mgo.Session, db string) *DatabaseStatus
GetDatabaseStatus returns stats for a given database
func (*DatabaseStatus) Describe ¶
func (dbStatus *DatabaseStatus) Describe(ch chan<- *prometheus.Desc)
Describe describes database stats for prometheus
func (*DatabaseStatus) Export ¶
func (dbStatus *DatabaseStatus) Export(ch chan<- prometheus.Metric)
Export exports database stats to prometheus
type DocumentStats ¶
type DocumentStats struct { Deleted float64 `bson:"deleted"` Inserted float64 `bson:"inserted"` Returned float64 `bson:"returned"` Updated float64 `bson:"updated"` }
DocumentStats are the stats associated to a document.
func (*DocumentStats) Export ¶
func (documentStats *DocumentStats) Export(ch chan<- prometheus.Metric)
Export exposes the document stats to be consumed by the prometheus server.
type DurStats ¶
type DurStats struct { Commits float64 `bson:"commits"` JournaledMB float64 `bson:"journaledMB"` WriteToDataFilesMB float64 `bson:"writeToDataFilesMB"` Compression float64 `bson:"compression"` CommitsInWriteLock float64 `bson:"commitsInWriteLock"` EarlyCommits float64 `bson:"earlyCommits"` TimeMs DurTiming `bson:"timeMs"` }
DurStats are the stats related to durability.
func (*DurStats) Collect ¶
func (durStats *DurStats) Collect(ch chan<- prometheus.Metric)
Collect collects the metrics for prometheus
func (*DurStats) Describe ¶
func (durStats *DurStats) Describe(ch chan<- *prometheus.Desc)
Describe describes the metrics for prometheus
func (*DurStats) Export ¶
func (durStats *DurStats) Export(ch chan<- prometheus.Metric)
Export export the durability stats for the prometheus server.
type DurTiming ¶
type DurTiming struct { Dt float64 `bson:"dt"` PrepLogBuffer float64 `bson:"prepLogBuffer"` WriteToJournal float64 `bson:"writeToJournal"` WriteToDataFiles float64 `bson:"writeToDataFiles"` RemapPrivateView float64 `bson:"remapPrivateView"` }
DurTiming is the information about durability returned from the server.
func (*DurTiming) Export ¶
func (durTiming *DurTiming) Export(ch chan<- prometheus.Metric)
Export exports the data for the prometheus server.
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 FlushStats ¶
type FlushStats struct { Flushes float64 `bson:"flushes"` TotalMs float64 `bson:"total_ms"` AverageMs float64 `bson:"average_ms"` LastMs float64 `bson:"last_ms"` LastFinished time.Time `bson:"last_finished"` }
FlushStats is the flush stats metrics
func (*FlushStats) Describe ¶
func (flushStats *FlushStats) Describe(ch chan<- *prometheus.Desc)
Describe describes the metrics for prometheus
func (*FlushStats) Export ¶
func (flushStats *FlushStats) Export(ch chan<- prometheus.Metric)
Export exports the metrics for 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 GlobalLockStats ¶
type GlobalLockStats struct { TotalTime float64 `bson:"totalTime"` LockTime float64 `bson:"lockTime"` Ratio float64 `bson:"ratio"` CurrentQueue *QueueStats `bson:"currentQueue"` ActiveClients *ClientStats `bson:"activeClients"` }
GlobalLockStats global lock stats
func (*GlobalLockStats) Describe ¶
func (globalLock *GlobalLockStats) Describe(ch chan<- *prometheus.Desc)
Describe describes the metrics for prometheus
func (*GlobalLockStats) Export ¶
func (globalLock *GlobalLockStats) Export(ch chan<- prometheus.Metric)
Export exports the metrics to prometheus
type IndexCounterStats ¶
type IndexCounterStats struct { Accesses float64 `bson:"accesses"` Hits float64 `bson:"hits"` Misses float64 `bson:"misses"` Resets float64 `bson:"resets"` MissRatio float64 `bson:"missRatio"` }
IndexCounterStats index counter stats
func (*IndexCounterStats) Describe ¶
func (indexCountersStats *IndexCounterStats) Describe(ch chan<- *prometheus.Desc)
Describe describes the metrics for prometheus
func (*IndexCounterStats) Export ¶
func (indexCountersStats *IndexCounterStats) Export(ch chan<- prometheus.Metric)
Export exports the data to prometheus.
type LockStats ¶
type LockStats struct { TimeLockedMicros ReadWriteLockTimes `bson:"timeLockedMicros"` TimeAcquiringMicros ReadWriteLockTimes `bson:"timeAcquiringMicros"` }
LockStats lock stats
type LockStatsMap ¶
LockStatsMap is a map of lock stats
func (LockStatsMap) Describe ¶
func (locks LockStatsMap) Describe(ch chan<- *prometheus.Desc)
Describe describes the metrics for prometheus
func (LockStatsMap) Export ¶
func (locks LockStatsMap) Export(ch chan<- prometheus.Metric)
Export exports the data to prometheus.
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 Member ¶
type Member struct { Name string `bson:"name"` Self *bool `bson:"self,omitempty"` Health *int32 `bson:"health,omitempty"` State int32 `bson:"state"` StateStr string `bson:"stateStr"` Uptime float64 `bson:"uptime"` Optime interface{} `bson:"optime"` OptimeDate time.Time `bson:"optimeDate"` ElectionTime *time.Time `bson:"electionTime,omitempty"` ElectionDate *time.Time `bson:"electionDate,omitempty"` LastHeartbeat *time.Time `bson:"lastHeartbeat,omitempty"` LastHeartbeatRecv *time.Time `bson:"lastHeartbeatRecv,omitempty"` LastHeartbeatMessage *string `bson:"lastHeartbeatMessage,omitempty"` PingMs *float64 `bson:"pingMs,omitempty"` SyncingTo *string `bson:"syncingTo,omitempty"` ConfigVersion *int32 `bson:"configVersion,omitempty"` }
Member represents an array element of ReplSetStatus.Members
type MetricsNetworkStats ¶
type MetricsNetworkStats struct { Bytes float64 `bson:"bytes"` Ops float64 `bson:"ops"` GetMores *BenchmarkStats `bson:"getmores"` ReadersCreated float64 `bson:"readersCreated"` }
MetricsNetworkStats are the network stats.
func (*MetricsNetworkStats) Export ¶
func (metricsNetworkStats *MetricsNetworkStats) Export(ch chan<- prometheus.Metric)
Export exposes the network stats.
type MetricsStats ¶
type MetricsStats struct { Document *DocumentStats `bson:"document"` GetLastError *GetLastErrorStats `bson:"getLastError"` Operation *OperationStats `bson:"operation"` QueryExecutor *QueryExecutorStats `bson:"queryExecutor"` Record *RecordStats `bson:"record"` Repl *ReplStats `bson:"repl"` Storage *StorageStats `bson:"storage"` 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 MongodbCollector ¶
type MongodbCollector struct {
Opts MongodbCollectorOpts
}
MongodbCollector is in charge of collecting mongodb's metrics.
func NewMongodbCollector ¶
func NewMongodbCollector(opts MongodbCollectorOpts) *MongodbCollector
NewMongodbCollector returns a new instance of a MongodbCollector.
func (*MongodbCollector) Collect ¶
func (exporter *MongodbCollector) Collect(ch chan<- prometheus.Metric)
Collect collects all mongodb's metrics.
func (*MongodbCollector) Describe ¶
func (exporter *MongodbCollector) Describe(ch chan<- *prometheus.Desc)
Describe describes all mongodb's metrics.
type MongodbCollectorOpts ¶
type MongodbCollectorOpts struct { URI string TLSCertificateFile string TLSPrivateKeyFile string TLSCaFile string TLSHostnameValidation bool CollectReplSet bool CollectOplog bool CollectDatabaseMetrics bool }
MongodbCollectorOpts is the options of the mongodb collector.
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 OperationStats ¶
type OperationStats struct { Fastmod float64 `bson:"fastmod"` Idhack float64 `bson:"idhack"` ScanAndOrder float64 `bson:"scanAndOrder"` }
OperationStats are the stats for some kind of operations.
func (*OperationStats) Export ¶
func (operationStats *OperationStats) Export(ch chan<- prometheus.Metric)
Export exports the operation stats.
type OplogCollectionStats ¶
type OplogCollectionStats struct { Count float64 `bson:"count"` Size float64 `bson:"size"` StorageSize float64 `bson:"storageSize"` }
OplogCollectionStats represents metrics about an oplog collection
func GetOplogCollectionStats ¶
func GetOplogCollectionStats(session *mgo.Session) (*OplogCollectionStats, error)
GetOplogCollectionStats fetches oplog collection stats
type OplogStatus ¶
type OplogStatus struct { TailTimestamp float64 HeadTimestamp float64 CollectionStats *OplogCollectionStats }
OplogStatus represents oplog metrics
func GetOplogStatus ¶
func GetOplogStatus(session *mgo.Session) *OplogStatus
GetOplogStatus fetches oplog collection stats
func (*OplogStatus) Describe ¶
func (status *OplogStatus) Describe(ch chan<- *prometheus.Desc)
Describe describes metrics collected
func (*OplogStatus) Export ¶
func (status *OplogStatus) Export(ch chan<- prometheus.Metric)
Export exports metrics to Prometheus
type PreloadStats ¶
type PreloadStats struct { Docs *BenchmarkStats `bson:"docs"` Indexes *BenchmarkStats `bson:"indexes"` }
PreloadStats are the stats associated with preload operation.
func (*PreloadStats) Export ¶
func (preloadStats *PreloadStats) Export(ch chan<- prometheus.Metric)
Export exposes the preload stats.
type QueryExecutorStats ¶
type QueryExecutorStats struct { Scanned float64 `bson:"scanned"` ScannedObjects float64 `bson:"scannedObjects"` }
QueryExecutorStats are the stats associated with a query execution.
func (*QueryExecutorStats) Export ¶
func (queryExecutorStats *QueryExecutorStats) Export(ch chan<- prometheus.Metric)
Export exports the query executor stats.
type QueueStats ¶
type QueueStats struct { Total float64 `bson:"total"` Readers float64 `bson:"readers"` Writers float64 `bson:"writers"` }
QueueStats queue stats
func (*QueueStats) Export ¶
func (queueStats *QueueStats) Export(ch chan<- prometheus.Metric)
Export exports the metrics to prometheus
type RawStatus ¶
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
type ReadWriteLockTimes ¶
type ReadWriteLockTimes struct { Read float64 `bson:"R"` Write float64 `bson:"W"` ReadLower float64 `bson:"r"` WriteLower float64 `bson:"w"` }
ReadWriteLockTimes information about the lock
type RecordStats ¶
type RecordStats struct {
Moves float64 `bson:"moves"`
}
RecordStats are stats associated with a record.
func (*RecordStats) Export ¶
func (recordStats *RecordStats) Export(ch chan<- prometheus.Metric)
Export exposes the record stats.
type ReplSetStatus ¶
type ReplSetStatus struct { Set string `bson:"set"` Date time.Time `bson:"date"` MyState int32 `bson:"myState"` Term *int32 `bson:"term,omitempty"` HeartbeatIntervalMillis *float64 `bson:"heartbeatIntervalMillis,omitempty"` Members []Member `bson:"members"` }
ReplSetStatus keeps the data returned by the GetReplSetStatus method
func GetReplSetStatus ¶
func GetReplSetStatus(session *mgo.Session) *ReplSetStatus
GetReplSetStatus returns the replica status info
func (*ReplSetStatus) Describe ¶
func (replStatus *ReplSetStatus) Describe(ch chan<- *prometheus.Desc)
Describe describes the replSetGetStatus metrics for prometheus
func (*ReplSetStatus) Export ¶
func (replStatus *ReplSetStatus) Export(ch chan<- prometheus.Metric)
Export exports the replSetGetStatus stati to be consumed by prometheus
type ReplStats ¶
type ReplStats struct { Apply *ApplyStats `bson:"apply"` Buffer *BufferStats `bson:"buffer"` Network *MetricsNetworkStats `bson:"network"` PreloadStats *PreloadStats `bson:"preload"` }
ReplStats are the stats associated with the replication process.
func (*ReplStats) Export ¶
func (replStats *ReplStats) Export(ch chan<- prometheus.Metric)
Export exposes the replication stats.
type ServerStatus ¶
type ServerStatus struct { Uptime float64 `bson:"uptime"` UptimeEstimate float64 `bson:"uptimeEstimate"` LocalTime time.Time `bson:"localTime"` Asserts *AssertsStats `bson:"asserts"` Dur *DurStats `bson:"dur"` BackgroundFlushing *FlushStats `bson:"backgroundFlushing"` Connections *ConnectionStats `bson:"connections"` ExtraInfo *ExtraInfo `bson:"extra_info"` GlobalLock *GlobalLockStats `bson:"globalLock"` IndexCounter *IndexCounterStats `bson:"indexCounters"` Locks LockStatsMap `bson:"locks,omitempty"` Network *NetworkStats `bson:"network"` Opcounters *OpcountersStats `bson:"opcounters"` OpcountersRepl *OpcountersReplStats `bson:"opcountersRepl"` 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 StorageStats ¶
type StorageStats struct { BucketExhausted float64 `bson:"freelist.search.bucketExhausted"` Requests float64 `bson:"freelist.search.requests"` Scanned float64 `bson:"freelist.search.scanned"` }
StorageStats are the stats associated with the storage.
func (*StorageStats) Export ¶
func (storageStats *StorageStats) Export(ch chan<- prometheus.Metric)
Export exports the storage stats.