File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
internal/backend/concentratord Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,8 @@ func (b *Backend) SendDownlinkFrame(pl gw.DownlinkFrame) error {
146
146
147
147
b .downlinkTXAckChan <- ack
148
148
149
+ commandCounter ("down" ).Inc ()
150
+
149
151
return nil
150
152
}
151
153
@@ -227,6 +229,8 @@ func (b *Backend) eventLoop() {
227
229
"event" : string (msg .Frames [0 ]),
228
230
}).Error ("backend/concentratord: handle event error" )
229
231
}
232
+
233
+ eventCounter (string (msg .Frames [0 ])).Inc ()
230
234
}
231
235
}
232
236
Original file line number Diff line number Diff line change
1
+ package concentratord
2
+
3
+ import (
4
+ "github.com/prometheus/client_golang/prometheus"
5
+ "github.com/prometheus/client_golang/prometheus/promauto"
6
+ )
7
+
8
+ var (
9
+ ec = promauto .NewCounterVec (prometheus.CounterOpts {
10
+ Name : "backend_concentratord_event_count" ,
11
+ Help : "The number of received events (per type)" ,
12
+ }, []string {"event" })
13
+
14
+ cc = promauto .NewCounterVec (prometheus.CounterOpts {
15
+ Name : "backend_concentratord_command_count" ,
16
+ Help : "The number of received commands (per type)" ,
17
+ }, []string {"command" })
18
+ )
19
+
20
+ func eventCounter (typ string ) prometheus.Counter {
21
+ return ec .With (prometheus.Labels {"event" : typ })
22
+ }
23
+
24
+ func commandCounter (typ string ) prometheus.Counter {
25
+ return cc .With (prometheus.Labels {"command" : typ })
26
+ }
You can’t perform that action at this time.
0 commit comments