-
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathserver_status.go
More file actions
222 lines (192 loc) · 9.35 KB
/
Copy pathserver_status.go
File metadata and controls
222 lines (192 loc) · 9.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
// Copyright 2019-present Kuei-chun Chen. All rights reserved.
// server_status.go
package ftdc
import (
"time"
"go.mongodb.org/mongo-driver/bson"
)
// DocumentDoc contains db.serverStatus().document
type DocumentDoc struct {
Deleted int `json:"deleted" bson:"deleted"`
Inserted int `json:"inserted" bson:"inserted"`
Returned int `json:"returned" bson:"returned"`
Updated int `json:"updated" bson:"updated"`
}
// ExtraInfoDoc contains db.serverStatus().extra_info
type ExtraInfoDoc struct {
PageFaults uint64 `json:"page_faults" bson:"page_faults"`
}
// GlobalLockSubDoc contains db.serverStatus().globalLockDoc.[activeClients|currentQueue]
type GlobalLockSubDoc struct {
Readers uint64 `json:"readers" bson:"readers"`
Total uint64 `json:"total" bson:"total"`
Writers uint64 `json:"writers" bson:"writers"`
}
// GlobalLockDoc contains db.serverStatus().globalLockDoc
type GlobalLockDoc struct {
ActiveClients GlobalLockSubDoc `json:"activeClients" bson:"activeClients"`
CurrentQueue GlobalLockSubDoc `json:"currentQueue" bson:"currentQueue"`
TotalTime int `json:"totalTime" bson:"totalTime"`
}
// MemDoc containers db.serverStatus().mem
type MemDoc struct {
Resident uint64 `json:"resident" bson:"resident"`
Virtual uint64 `json:"virtual" bson:"virtual"`
}
// MetricsDoc contains db.serverStatus().metrics
type MetricsDoc struct {
Document DocumentDoc `json:"document" bson:"document"`
QueryExecutor QueryExecutorDoc `json:"queryExecutor" bson:"queryExecutor"`
Operation OperationDoc `json:"operation" bson:"operation"`
}
// NetworkDoc contains db.serverStatus().network
type NetworkDoc struct {
BytesIn uint64 `json:"bytesIn" bson:"bytesIn"`
BytesOut uint64 `json:"bytesOut" bson:"bytesOut"`
NumRequests uint64 `json:"numRequests" bson:"numRequests"`
PhysicalBytesIn uint64 `json:"physicalBytesIn" bson:"physicalBytesIn"`
PhysicalBytesOut uint64 `json:"physicalBytesOut" bson:"physicalBytesOut"`
}
// OperationDoc contains db.serverStatus().operation
type OperationDoc struct {
ScanAndOrder uint64 `json:"scanAndOrder" bson:"scanAndOrder"`
WriteConflicts uint64 `json:"writeConflicts" bson:"writeConflicts"`
}
// OpCountersDoc contains db.serverStatus().OpCounters
type OpCountersDoc struct {
Command uint64 `json:"command" bson:"command"`
Delete uint64 `json:"delete" bson:"delete"`
Getmore uint64 `json:"getmore" bson:"getmore"`
Insert uint64 `json:"insert" bson:"insert"`
Query uint64 `json:"query" bson:"query"`
Update uint64 `json:"update" bson:"update"`
}
// OpLatenciesDoc contains db.serverStatus().opLatencies
type OpLatenciesDoc struct {
Commands OpLatenciesOpDoc `json:"commands" bson:"commands"`
Reads OpLatenciesOpDoc `json:"reads" bson:"reads"`
Writes OpLatenciesOpDoc `json:"writes" bson:"writes"`
}
// OpLatenciesOpDoc contains doc of db.serverStatus().opLatencies
type OpLatenciesOpDoc struct {
Latency uint64 `json:"latency" bson:"latency"`
Ops uint64 `json:"ops" bson:"ops"`
}
// QueryExecutorDoc contains db.serverStatus().queryExecutor
type QueryExecutorDoc struct {
Scanned uint64 `json:"scanned" bson:"scanned"`
ScannedObjects uint64 `json:"scannedObjects" bson:"scannedObjects"`
}
// WiredTigerBlockManagerDoc contains db.serverStatus().wiredTiger.cache
type WiredTigerBlockManagerDoc struct {
BytesRead uint64 `json:"bytes read"`
BytesWritten uint64 `json:"bytes written"`
BytesWrittenCheckPoint uint64 `json:"bytes written for checkpoint"`
}
// WiredTigerCacheDoc contains db.serverStatus().wiredTiger.cache
type WiredTigerCacheDoc struct {
BytesReadIntoCache uint64 `json:"bytes read into cache" bson:"bytes read into cache"`
BytesWrittenFromCache uint64 `json:"bytes written from cache" bson:"bytes written from cache"`
CurrentlyInCache uint64 `json:"bytes currently in the cache" bson:"bytes currently in the cache"`
MaxBytesConfigured uint64 `json:"maximum bytes configured" bson:"maximum bytes configured"`
ModifiedPagesEvicted uint64 `json:"modified pages evicted" bson:"modified pages evicted"`
UnmodifiedPagesEvicted uint64 `json:"unmodified pages evicted" bson:"unmodified pages evicted"`
TrackedDirtyBytes uint64 `json:"tracked dirty bytes in the cache" bson:"tracked dirty bytes in the cache"`
}
// WiredTigerDataHandleDoc contains db.serverStatus().wiredTiger.data-handle
type WiredTigerDataHandleDoc struct {
Active uint64 `json:"connection data handles currently active" bson:"connection data handles currently active"`
Size uint64 `json:"connection data handle size" bson:"connection data handle size"`
}
// ConcurrentTransactionsCountDoc contains db.serverStatus().wiredTiger.concurrentTransactions.[read|write]
type ConcurrentTransactionsCountDoc struct {
Available uint64 `json:"available" bson:"available"`
Out uint64 `json:"out" bson:"out"`
TotalTickets uint64 `json:"totalTickets" bson:"totalTickets"`
}
// ConcurrentTransactionsDoc contains db.serverStatus().wiredTiger.concurrentTransactions
type ConcurrentTransactionsDoc struct {
Read ConcurrentTransactionsCountDoc `json:"read" bson:"read"`
Write ConcurrentTransactionsCountDoc `json:"write" bson:"write"`
}
// WiredTigerDoc contains db.serverStatus().wiredTiger
type WiredTigerDoc struct {
Perf interface{} `json:"perf" bson:"perf"`
BlockManager WiredTigerBlockManagerDoc `json:"block-manager" bson:"block-manager"`
Cache WiredTigerCacheDoc `json:"cache" bson:"cache"`
ConcurrentTransactions ConcurrentTransactionsDoc `json:"concurrentTransactions" bson:"concurrentTransactions"`
DataHandle WiredTigerDataHandleDoc `json:"data-handle" bson:"data-handle"`
}
// ConnectionsDoc contains db.serverStatus().connections
type ConnectionsDoc struct {
Current uint64 `json:"current" bson:"current"`
Available uint64 `json:"available" bson:"available"`
TotalCreated uint64 `json:"totalCreated" bson:"totalCreated"`
Active uint64 `json:"active" bson:"active"`
}
// QueueTicketsDoc contains ticket info for queues
type QueueTicketsDoc struct {
Out uint64 `json:"out" bson:"out"`
Available uint64 `json:"available" bson:"available"`
TotalTickets uint64 `json:"totalTickets" bson:"totalTickets"`
}
// ExecutionQueuesDoc contains db.serverStatus().queues.execution
type ExecutionQueuesDoc struct {
Read QueueTicketsDoc `json:"read" bson:"read"`
Write QueueTicketsDoc `json:"write" bson:"write"`
}
// QueuesDoc contains db.serverStatus().queues (MongoDB 7.0+)
type QueuesDoc struct {
Execution ExecutionQueuesDoc `json:"execution" bson:"execution"`
}
// TransactionsDoc contains db.serverStatus().transactions
type TransactionsDoc struct {
CurrentActive uint64 `json:"currentActive" bson:"currentActive"`
CurrentInactive uint64 `json:"currentInactive" bson:"currentInactive"`
CurrentOpen uint64 `json:"currentOpen" bson:"currentOpen"`
TotalAborted uint64 `json:"totalAborted" bson:"totalAborted"`
TotalCommitted uint64 `json:"totalCommitted" bson:"totalCommitted"`
TotalStarted uint64 `json:"totalStarted" bson:"totalStarted"`
}
// TcmallocGenericDoc contains db.serverStatus().tcmalloc.generic
type TcmallocGenericDoc struct {
BytesInUseByApp uint64 `json:"bytes_in_use_by_app" bson:"bytes_in_use_by_app"`
CurrentAllocatedBytes uint64 `json:"current_allocated_bytes" bson:"current_allocated_bytes"`
HeapSize uint64 `json:"heap_size" bson:"heap_size"`
PhysicalMemoryUsed uint64 `json:"physical_memory_used" bson:"physical_memory_used"`
}
// TcmallocDoc contains db.serverStatus().tcmalloc
type TcmallocDoc struct {
Generic TcmallocGenericDoc `json:"generic" bson:"generic"`
}
// FlowControlDoc contains db.serverStatus().flowControl
type FlowControlDoc struct {
Enabled bool `json:"enabled" bson:"enabled"`
TargetRateLimit uint64 `json:"targetRateLimit" bson:"targetRateLimit"`
TimeAcquiringMicros uint64 `json:"timeAcquiringMicros" bson:"timeAcquiringMicros"`
IsLagged bool `json:"isLagged" bson:"isLagged"`
IsLaggedCount uint64 `json:"isLaggedCount" bson:"isLaggedCount"`
}
// ServerStatusDoc contains docs from db.serverStatus()
type ServerStatusDoc struct {
Connections ConnectionsDoc `json:"connections" bson:"connections"`
ExtraInfo ExtraInfoDoc `json:"extra_info" bson:"extra_info"`
FlowControl FlowControlDoc `json:"flowControl" bson:"flowControl"`
GlobalLock GlobalLockDoc `json:"globalLock" bson:"globalLock"`
Host string `json:"host" bson:"host"`
LocalTime time.Time `json:"localTime" bson:"localTime"`
Mem MemDoc `json:"mem" bson:"mem"`
Metrics MetricsDoc `json:"metrics" bson:"metrics"`
Network NetworkDoc `json:"network" bson:"network"`
OpCounters OpCountersDoc `json:"opcounters" bson:"opcounters"`
OpLatencies OpLatenciesDoc `json:"opLatencies" bson:"opLatencies"`
Process string `json:"process" bson:"process"`
Queues QueuesDoc `json:"queues" bson:"queues"`
Repl bson.M `json:"repl" bson:"repl"`
Sharding bson.M `json:"sharding" bson:"sharding"`
Tcmalloc TcmallocDoc `json:"tcmalloc" bson:"tcmalloc"`
Transactions TransactionsDoc `json:"transactions" bson:"transactions"`
Uptime uint64 `json:"uptime" bson:"uptime"`
Version string `json:"version" bson:"version"`
WiredTiger WiredTigerDoc `json:"wiredTiger" bson:"wiredTiger"`
}