/
metrics.go
69 lines (59 loc) · 2.69 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
package jetstream
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
// isbReadErrors is used to indicate the number of errors in the jetstream READ operations
var isbReadErrors = promauto.NewCounterVec(prometheus.CounterOpts{
Subsystem: "isb_jetstream",
Name: "read_error_total",
Help: "Total number of jetstream read errors",
}, []string{"buffer"})
// isbFullErrors is used to indicate the number of errors in the jetstream isFull check
var isbFullErrors = promauto.NewCounterVec(prometheus.CounterOpts{
Subsystem: "isb_jetstream",
Name: "isFull_error_total",
Help: "Total number of jetstream isFull errors",
}, []string{"buffer"})
// isbFull is used to indicate the counter for number of times buffer is full
var isbFull = promauto.NewCounterVec(prometheus.CounterOpts{
Subsystem: "isb_jetstream",
Name: "isFull_total",
Help: "Total number of IsFull",
}, []string{"buffer"})
// isbWriteErrors is used to indicate the number of errors in the jetstream write check
var isbWriteErrors = promauto.NewCounterVec(prometheus.CounterOpts{
Subsystem: "isb_jetstream",
Name: "write_error_total",
Help: "Total number of jetstream write errors",
}, []string{"buffer"})
// isbSoftUsage is used to indicate of buffer that is used up, it is calculated based on the messages in pending + ack pending
var isbSoftUsage = promauto.NewGaugeVec(prometheus.GaugeOpts{
Subsystem: "isb_jetstream",
Name: "buffer_soft_usage",
Help: "percentage of buffer soft usage",
}, []string{"buffer"})
// isbSolidUsage is used to indicate of buffer that is used up, it is calculated based on the messages remain in the stream (if it's not Limits retention policy)
var isbSolidUsage = promauto.NewGaugeVec(prometheus.GaugeOpts{
Subsystem: "isb_jetstream",
Name: "buffer_solid_usage",
Help: "percentage of buffer solid usage",
}, []string{"buffer"})
// isbPending is calculated based on the messages in pending
var isbPending = promauto.NewGaugeVec(prometheus.GaugeOpts{
Subsystem: "isb_jetstream",
Name: "buffer_pending",
Help: "number of pending messages",
}, []string{"buffer"})
// isbAckPending is calculated based on the messages that are pending ack
var isbAckPending = promauto.NewGaugeVec(prometheus.GaugeOpts{
Subsystem: "isb_jetstream",
Name: "buffer_ack_pending",
Help: "number of messages pending ack",
}, []string{"buffer"})
// isbWriteTimeout records how many times of writing timeout
var isbWriteTimeout = promauto.NewCounterVec(prometheus.CounterOpts{
Subsystem: "isb_jetstream",
Name: "write_timeout_total",
Help: "Total number of jetstream write timeouts",
}, []string{"buffer"})