Skip to content

Commit

Permalink
Enable remote_ip dimension in rtr_clients
Browse files Browse the repository at this point in the history
This makes the rtr_clients track the number of connections per
remote IP, enabling us to see if a client flaps, and what client it is.
  • Loading branch information
netixx committed Mar 11, 2024
1 parent febec67 commit 237da11
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/stayrtr/stayrtr.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ var (
Name: "rtr_clients",
Help: "Number of clients connected.",
},
[]string{"bind"},
[]string{"bind", "remote_ip"},
)
PDUsRecv = prometheus.NewCounterVec(
prometheus.CounterOpts{
Expand Down Expand Up @@ -693,11 +693,11 @@ type metricsEvent struct {
}

func (m *metricsEvent) ClientConnected(c *rtr.Client) {
ClientsMetric.WithLabelValues(c.GetLocalAddress().String()).Inc()
ClientsMetric.WithLabelValues(c.GetLocalAddress().String(), c.GetRemoteAddress().String()).Inc()
}

func (m *metricsEvent) ClientDisconnected(c *rtr.Client) {
ClientsMetric.WithLabelValues(c.GetLocalAddress().String()).Dec()
ClientsMetric.WithLabelValues(c.GetLocalAddress().String(), c.GetRemoteAddress().String()).Dec()
}

func (m *metricsEvent) HandlePDU(c *rtr.Client, pdu rtr.PDU) {
Expand Down

0 comments on commit 237da11

Please sign in to comment.