Add mongo document and connection metrics (#4362)
This commit is contained in:
parent
b5abf2c577
commit
9106011f58
|
@ -31,28 +31,35 @@ func NewMongodbData(statLine *StatLine, tags map[string]string) *MongodbData {
|
||||||
}
|
}
|
||||||
|
|
||||||
var DefaultStats = map[string]string{
|
var DefaultStats = map[string]string{
|
||||||
"inserts_per_sec": "Insert",
|
"inserts_per_sec": "Insert",
|
||||||
"queries_per_sec": "Query",
|
"queries_per_sec": "Query",
|
||||||
"updates_per_sec": "Update",
|
"updates_per_sec": "Update",
|
||||||
"deletes_per_sec": "Delete",
|
"deletes_per_sec": "Delete",
|
||||||
"getmores_per_sec": "GetMore",
|
"getmores_per_sec": "GetMore",
|
||||||
"commands_per_sec": "Command",
|
"commands_per_sec": "Command",
|
||||||
"flushes_per_sec": "Flushes",
|
"flushes_per_sec": "Flushes",
|
||||||
"vsize_megabytes": "Virtual",
|
"vsize_megabytes": "Virtual",
|
||||||
"resident_megabytes": "Resident",
|
"resident_megabytes": "Resident",
|
||||||
"queued_reads": "QueuedReaders",
|
"queued_reads": "QueuedReaders",
|
||||||
"queued_writes": "QueuedWriters",
|
"queued_writes": "QueuedWriters",
|
||||||
"active_reads": "ActiveReaders",
|
"active_reads": "ActiveReaders",
|
||||||
"active_writes": "ActiveWriters",
|
"active_writes": "ActiveWriters",
|
||||||
"net_in_bytes": "NetIn",
|
"net_in_bytes": "NetIn",
|
||||||
"net_out_bytes": "NetOut",
|
"net_out_bytes": "NetOut",
|
||||||
"open_connections": "NumConnections",
|
"open_connections": "NumConnections",
|
||||||
"ttl_deletes_per_sec": "DeletedDocuments",
|
"ttl_deletes_per_sec": "DeletedDocuments",
|
||||||
"ttl_passes_per_sec": "Passes",
|
"ttl_passes_per_sec": "Passes",
|
||||||
"cursor_timed_out": "TimedOutC",
|
"cursor_timed_out": "TimedOutC",
|
||||||
"cursor_no_timeout": "NoTimeoutC",
|
"cursor_no_timeout": "NoTimeoutC",
|
||||||
"cursor_pinned": "PinnedC",
|
"cursor_pinned": "PinnedC",
|
||||||
"cursor_total": "TotalC",
|
"cursor_total": "TotalC",
|
||||||
|
"document_deleted": "DeletedD",
|
||||||
|
"document_inserted": "InsertedD",
|
||||||
|
"document_returned": "ReturnedD",
|
||||||
|
"document_updated": "UpdatedD",
|
||||||
|
"connections_current": "CurrentC",
|
||||||
|
"connections_available": "AvailableC",
|
||||||
|
"connections_total_created": "TotalCreatedC",
|
||||||
}
|
}
|
||||||
|
|
||||||
var DefaultReplStats = map[string]string{
|
var DefaultReplStats = map[string]string{
|
||||||
|
|
|
@ -38,6 +38,13 @@ func TestAddNonReplStats(t *testing.T) {
|
||||||
NoTimeoutC: 0,
|
NoTimeoutC: 0,
|
||||||
PinnedC: 0,
|
PinnedC: 0,
|
||||||
TotalC: 0,
|
TotalC: 0,
|
||||||
|
DeletedD: 0,
|
||||||
|
InsertedD: 0,
|
||||||
|
ReturnedD: 0,
|
||||||
|
UpdatedD: 0,
|
||||||
|
CurrentC: 0,
|
||||||
|
AvailableC: 0,
|
||||||
|
TotalCreatedC: 0,
|
||||||
},
|
},
|
||||||
tags,
|
tags,
|
||||||
)
|
)
|
||||||
|
@ -182,43 +189,50 @@ func TestStateTag(t *testing.T) {
|
||||||
d.AddDefaultStats()
|
d.AddDefaultStats()
|
||||||
d.flush(&acc)
|
d.flush(&acc)
|
||||||
fields := map[string]interface{}{
|
fields := map[string]interface{}{
|
||||||
"active_reads": int64(0),
|
"active_reads": int64(0),
|
||||||
"active_writes": int64(0),
|
"active_writes": int64(0),
|
||||||
"commands_per_sec": int64(0),
|
"commands_per_sec": int64(0),
|
||||||
"deletes_per_sec": int64(0),
|
"deletes_per_sec": int64(0),
|
||||||
"flushes_per_sec": int64(0),
|
"flushes_per_sec": int64(0),
|
||||||
"getmores_per_sec": int64(0),
|
"getmores_per_sec": int64(0),
|
||||||
"inserts_per_sec": int64(0),
|
"inserts_per_sec": int64(0),
|
||||||
"member_status": "PRI",
|
"member_status": "PRI",
|
||||||
"state": "PRIMARY",
|
"state": "PRIMARY",
|
||||||
"net_in_bytes": int64(0),
|
"net_in_bytes": int64(0),
|
||||||
"net_out_bytes": int64(0),
|
"net_out_bytes": int64(0),
|
||||||
"open_connections": int64(0),
|
"open_connections": int64(0),
|
||||||
"queries_per_sec": int64(0),
|
"queries_per_sec": int64(0),
|
||||||
"queued_reads": int64(0),
|
"queued_reads": int64(0),
|
||||||
"queued_writes": int64(0),
|
"queued_writes": int64(0),
|
||||||
"repl_commands_per_sec": int64(0),
|
"repl_commands_per_sec": int64(0),
|
||||||
"repl_deletes_per_sec": int64(0),
|
"repl_deletes_per_sec": int64(0),
|
||||||
"repl_getmores_per_sec": int64(0),
|
"repl_getmores_per_sec": int64(0),
|
||||||
"repl_inserts_per_sec": int64(0),
|
"repl_inserts_per_sec": int64(0),
|
||||||
"repl_queries_per_sec": int64(0),
|
"repl_queries_per_sec": int64(0),
|
||||||
"repl_updates_per_sec": int64(0),
|
"repl_updates_per_sec": int64(0),
|
||||||
"repl_lag": int64(0),
|
"repl_lag": int64(0),
|
||||||
"repl_oplog_window_sec": int64(0),
|
"repl_oplog_window_sec": int64(0),
|
||||||
"resident_megabytes": int64(0),
|
"resident_megabytes": int64(0),
|
||||||
"updates_per_sec": int64(0),
|
"updates_per_sec": int64(0),
|
||||||
"vsize_megabytes": int64(0),
|
"vsize_megabytes": int64(0),
|
||||||
"ttl_deletes_per_sec": int64(0),
|
"ttl_deletes_per_sec": int64(0),
|
||||||
"ttl_passes_per_sec": int64(0),
|
"ttl_passes_per_sec": int64(0),
|
||||||
"jumbo_chunks": int64(0),
|
"jumbo_chunks": int64(0),
|
||||||
"total_in_use": int64(0),
|
"total_in_use": int64(0),
|
||||||
"total_available": int64(0),
|
"total_available": int64(0),
|
||||||
"total_created": int64(0),
|
"total_created": int64(0),
|
||||||
"total_refreshing": int64(0),
|
"total_refreshing": int64(0),
|
||||||
"cursor_timed_out": int64(0),
|
"cursor_timed_out": int64(0),
|
||||||
"cursor_no_timeout": int64(0),
|
"cursor_no_timeout": int64(0),
|
||||||
"cursor_pinned": int64(0),
|
"cursor_pinned": int64(0),
|
||||||
"cursor_total": int64(0),
|
"cursor_total": int64(0),
|
||||||
|
"document_deleted": int64(0),
|
||||||
|
"document_inserted": int64(0),
|
||||||
|
"document_returned": int64(0),
|
||||||
|
"document_updated": int64(0),
|
||||||
|
"connections_current": int64(0),
|
||||||
|
"connections_available": int64(0),
|
||||||
|
"connections_total_created": int64(0),
|
||||||
}
|
}
|
||||||
acc.AssertContainsTaggedFields(t, "mongodb", fields, stateTags)
|
acc.AssertContainsTaggedFields(t, "mongodb", fields, stateTags)
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,7 +225,7 @@ type FlushStats struct {
|
||||||
type ConnectionStats struct {
|
type ConnectionStats struct {
|
||||||
Current int64 `bson:"current"`
|
Current int64 `bson:"current"`
|
||||||
Available int64 `bson:"available"`
|
Available int64 `bson:"available"`
|
||||||
TotalCreated int64 `bson:"totalCreated"`
|
TotalCreated int64 `bson:"total_created"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DurTiming stores information related to journaling.
|
// DurTiming stores information related to journaling.
|
||||||
|
@ -289,8 +289,9 @@ type OpcountStats struct {
|
||||||
|
|
||||||
// MetricsStats stores information related to metrics
|
// MetricsStats stores information related to metrics
|
||||||
type MetricsStats struct {
|
type MetricsStats struct {
|
||||||
TTL *TTLStats `bson:"ttl"`
|
TTL *TTLStats `bson:"ttl"`
|
||||||
Cursor *CursorStats `bson:"cursor"`
|
Cursor *CursorStats `bson:"cursor"`
|
||||||
|
Document *DocumentStats `bson:"document"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TTLStats stores information related to documents with a ttl index.
|
// TTLStats stores information related to documents with a ttl index.
|
||||||
|
@ -305,6 +306,14 @@ type CursorStats struct {
|
||||||
Open *OpenCursorStats `bson:"open"`
|
Open *OpenCursorStats `bson:"open"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DocumentStats stores information related to document metrics.
|
||||||
|
type DocumentStats struct {
|
||||||
|
Deleted int64 `bson:"deleted"`
|
||||||
|
Inserted int64 `bson:"inserted"`
|
||||||
|
Returned int64 `bson:"returned"`
|
||||||
|
Updated int64 `bson:"updated"`
|
||||||
|
}
|
||||||
|
|
||||||
// OpenCursorStats stores information related to open cursor metrics
|
// OpenCursorStats stores information related to open cursor metrics
|
||||||
type OpenCursorStats struct {
|
type OpenCursorStats struct {
|
||||||
NoTimeout int64 `bson:"noTimeout"`
|
NoTimeout int64 `bson:"noTimeout"`
|
||||||
|
@ -457,6 +466,12 @@ type StatLine struct {
|
||||||
TimedOutC int64
|
TimedOutC int64
|
||||||
NoTimeoutC, PinnedC, TotalC int64
|
NoTimeoutC, PinnedC, TotalC int64
|
||||||
|
|
||||||
|
// Document fields
|
||||||
|
DeletedD, InsertedD, ReturnedD, UpdatedD int64
|
||||||
|
|
||||||
|
// Connection fields
|
||||||
|
CurrentC, AvailableC, TotalCreatedC int64
|
||||||
|
|
||||||
// Collection locks (3.0 mmap only)
|
// Collection locks (3.0 mmap only)
|
||||||
CollectionLocks *CollectionLockStatus
|
CollectionLocks *CollectionLockStatus
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue