forked from hyperledger-archives/burrow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
metrics.go
58 lines (46 loc) · 1.67 KB
/
metrics.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package metrics
import "github.com/prometheus/client_golang/prometheus"
var MetricDescriptions = make(map[string]*prometheus.Desc)
var (
Height = newDesc(
prometheus.BuildFQName("burrow", "chain", "block_height"),
"Current block height",
[]string{"chain_id", "moniker"})
TimePerBlock = newDesc(
prometheus.BuildFQName("burrow", "chain", "block_time"),
"Histogram metric of block duration",
[]string{"chain_id", "moniker"})
UnconfirmedTransactions = newDesc(
prometheus.BuildFQName("burrow", "transactions", "in_mempool"),
"Current depth of the mempool",
[]string{"chain_id", "moniker"})
TxPerBlock = newDesc(
prometheus.BuildFQName("burrow", "transactions", "per_block"),
"Histogram metric of transactions per block",
[]string{"chain_id", "moniker"})
TotalPeers = newDesc(
prometheus.BuildFQName("burrow", "peers", "total"),
"Current total peers",
[]string{"chain_id", "moniker"})
InboundPeers = newDesc(
prometheus.BuildFQName("burrow", "peers", "inbound"),
"Current inbound peers",
[]string{"chain_id", "moniker"})
OutboundPeers = newDesc(
prometheus.BuildFQName("burrow", "peers", "outbound"),
"Current outbound peers",
[]string{"chain_id", "moniker"})
Contracts = newDesc(
prometheus.BuildFQName("burrow", "accounts", "contracts"),
"Current contracts on the chain",
[]string{"chain_id", "moniker"})
Users = newDesc(
prometheus.BuildFQName("burrow", "accounts", "users"),
"Current users on the chain",
[]string{"chain_id", "moniker"})
)
func newDesc(fqName, help string, variableLabels []string) *prometheus.Desc {
desc := prometheus.NewDesc(fqName, help, variableLabels, nil)
MetricDescriptions[fqName] = desc
return desc
}