-
Notifications
You must be signed in to change notification settings - Fork 219
Expand file tree
/
Copy pathstats.go
More file actions
61 lines (48 loc) · 1.24 KB
/
stats.go
File metadata and controls
61 lines (48 loc) · 1.24 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
/*
* Radon
*
* Copyright 2018 The Radon Authors.
* Code is licensed under the GPLv3.
*
*/
package backend
import (
"time"
"xbase/stats"
)
var (
// mysqlStats shows the time histogram for operations spent on mysql side.
mysqlStats = stats.NewTimings("MySQL")
// queryStats shows the time histogram for each type of queries.
queryStats = stats.NewTimings("Query")
// queryRates shows the qps of QueryStats. Sample every 5 seconds and keep samples for 1.
queryRates = stats.NewRates("QPS", queryStats, 1, 5*time.Second)
// for transactions.
txnCounters = stats.NewCounters("TxnCounters")
tz = NewTxnz()
qz = NewQueryz()
)
// Queryz returns the queryz.
func (scatter *Scatter) Queryz() *Queryz {
return qz
}
// Txnz returns the txnz.
func (scatter *Scatter) Txnz() *Txnz {
return tz
}
// MySQLStats returns the mysql stats.
func (scatter *Scatter) MySQLStats() *stats.Timings {
return mysqlStats
}
// QueryStats returns the query stats.
func (scatter *Scatter) QueryStats() *stats.Timings {
return queryStats
}
// QueryRates returns the query rates.
func (scatter *Scatter) QueryRates() *stats.Rates {
return queryRates
}
// TxnCounters returns the txn counters.
func (scatter *Scatter) TxnCounters() *stats.Counters {
return txnCounters
}