proxy: add country to prometheus metrics

This commit is contained in:
meskio 2024-12-22 10:53:11 +01:00
parent b3c734ed63
commit e345c3bac9
No known key found for this signature in database
GPG key ID: 52B8F5AC97A2DA86
6 changed files with 45 additions and 13 deletions

View file

@ -7,7 +7,7 @@ import (
type EventCollector interface {
TrackInBoundTraffic(value int64)
TrackOutBoundTraffic(value int64)
TrackNewConnection()
TrackNewConnection(country string)
}
type EventMetrics struct {
@ -25,6 +25,7 @@ func (em *EventMetrics) OnNewSnowflakeEvent(e event.SnowflakeEvent) {
em.collector.TrackInBoundTraffic(e.InboundBytes)
em.collector.TrackOutBoundTraffic(e.OutboundBytes)
case event.EventOnProxyConnectionOver:
em.collector.TrackNewConnection()
e := e.(event.EventOnProxyConnectionOver)
em.collector.TrackNewConnection(e.Country)
}
}