@@ -15,12 +15,13 @@ type Static struct {
15
15
}
16
16
17
17
type Pool struct {
18
- IdleLoad0 * prometheus.Desc
19
- IdleLoad1 * prometheus.Desc
20
- LoadFree0 * prometheus.Desc
21
- LoadFree1 * prometheus.Desc
22
- LoadUsed0 * prometheus.Desc
23
- LoadUsed1 * prometheus.Desc
18
+ IdleLoad0 * prometheus.Desc
19
+ IdleLoad1 * prometheus.Desc
20
+ LoadFree0 * prometheus.Desc
21
+ LoadFree1 * prometheus.Desc
22
+ LoadUsed0 * prometheus.Desc
23
+ LoadUsed1 * prometheus.Desc
24
+ ProcsCount * prometheus.Desc
24
25
25
26
Nodes []* PoolNode
26
27
}
@@ -62,6 +63,10 @@ func NewPool(nodesCount int) *Pool {
62
63
"used cores load, like 0-100 %" ,
63
64
nil , nil ,
64
65
)
66
+ ent .ProcsCount = prometheus .NewDesc ("pind_procs_count" ,
67
+ "process counter" ,
68
+ nil , nil ,
69
+ )
65
70
66
71
for i := 0 ; i < nodesCount ; i ++ {
67
72
node := & PoolNode {
@@ -137,6 +142,7 @@ func (x *Static) Collect(ch chan<- prometheus.Metric) {
137
142
m3 := prometheus .MustNewConstMetric (x .PoolCollector .LoadFree1 , prometheus .GaugeValue , x .State .Pool .LoadFree1 )
138
143
m4 := prometheus .MustNewConstMetric (x .PoolCollector .LoadUsed0 , prometheus .GaugeValue , x .State .Pool .LoadUsed0 )
139
144
m5 := prometheus .MustNewConstMetric (x .PoolCollector .LoadUsed1 , prometheus .GaugeValue , x .State .Pool .LoadUsed1 )
145
+ m6 := prometheus .MustNewConstMetric (x .PoolCollector .ProcsCount , prometheus .GaugeValue , float64 (len (x .State .Procs )))
140
146
141
147
t0 := x .State .Time
142
148
mt0 := prometheus .NewMetricWithTimestamp (t0 , m0 )
@@ -145,13 +151,15 @@ func (x *Static) Collect(ch chan<- prometheus.Metric) {
145
151
mt3 := prometheus .NewMetricWithTimestamp (t0 , m3 )
146
152
mt4 := prometheus .NewMetricWithTimestamp (t0 , m4 )
147
153
mt5 := prometheus .NewMetricWithTimestamp (t0 , m5 )
154
+ mt6 := prometheus .NewMetricWithTimestamp (t0 , m6 )
148
155
149
156
ch <- mt0
150
157
ch <- mt1
151
158
ch <- mt2
152
159
ch <- mt3
153
160
ch <- mt4
154
161
ch <- mt5
162
+ ch <- mt6
155
163
156
164
l0 := len (x .PoolCollector .Nodes )
157
165
for i := 0 ; i < l0 ; i ++ {
0 commit comments