-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathstats.go
42 lines (39 loc) · 1.42 KB
/
stats.go
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
package oplog
import "expvar"
// Stats stores all the statistics about the oplog
type Stats struct {
Status string
// Total number of events recieved on the UDP interface
EventsReceived *expvar.Int
// Total number of events sent thru the SSE interface
EventsSent *expvar.Int
// Total number of events ingested into MongoDB with success
EventsIngested *expvar.Int
// Total number of events received on the UDP interface with an invalid format
EventsError *expvar.Int
// Total number of events discarded because the queue was full
EventsDiscarded *expvar.Int
// Current number of events in the ingestion queue
QueueSize *expvar.Int
// Maximum number of events allowed in the ingestion queue before discarding events
QueueMaxSize *expvar.Int
// Number of clients connected to the SSE API
Clients *expvar.Int
// Total number of SSE connections
Connections *expvar.Int
}
// newStats create a new empty stats object
func newStats() Stats {
return Stats{
Status: "OK",
EventsReceived: expvar.NewInt("events_received"),
EventsSent: expvar.NewInt("events_sent"),
EventsIngested: expvar.NewInt("events_ingested"),
EventsError: expvar.NewInt("events_error"),
EventsDiscarded: expvar.NewInt("events_discarded"),
QueueSize: expvar.NewInt("queue_size"),
QueueMaxSize: expvar.NewInt("queue_max_size"),
Clients: expvar.NewInt("clients"),
Connections: expvar.NewInt("connections"),
}
}