-
Notifications
You must be signed in to change notification settings - Fork 210
/
metrics.go
78 lines (71 loc) · 1.75 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package txs
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/spacemeshos/go-spacemesh/metrics"
)
const (
namespace = "txs"
// labels for tx acceptance state by the cache.
duplicate = "dupe"
saved = "saved"
savedNoHdr = "savedNoHdr"
cantParse = "parse"
cantVerify = "verify"
rejectedBadNonce = "badNonce"
rejectedInternalErr = "err"
RawFromDB = "raw"
updated = "updated"
// label for tx acceptance state by the mempool.
mempool = "mempool"
balanceTooSmall = "balance"
tooManyNonce = "too_many"
accepted = "ok"
)
var (
gossipTxCount = metrics.NewCounter(
"gossip_txs",
namespace,
"number of gossip transactions",
[]string{"outcome"},
)
proposalTxCount = metrics.NewCounter(
"proposal_txs",
namespace,
"number of proposal transactions",
[]string{"outcome"},
)
blockTxCount = metrics.NewCounter(
"block_txs",
namespace,
"number of block transactions",
[]string{"outcome"},
)
RawTxCount = metrics.NewCounter(
"raw_txs",
namespace,
"number of unparsed/raw transactions",
[]string{"outcome"},
)
mempoolTxCount = metrics.NewCounter(
"mempool_txs",
namespace,
"number of transactions added to the mempool",
[]string{"outcome"},
)
)
var (
cacheApplyDuration = metrics.NewHistogramWithBuckets(
"cache_apply_duration",
namespace,
"Duration in ns to apply an layer in conservative cache",
[]string{},
prometheus.ExponentialBuckets(100_000_000, 2, 10),
).WithLabelValues()
acctResetDuration = metrics.NewHistogramWithBuckets(
"acct_reset_duration",
namespace,
"Duration in ns to apply an layer for an account",
[]string{},
prometheus.ExponentialBuckets(10_000_000, 2, 10),
).WithLabelValues()
)