Update prometheus metrics to use new EventOnProxyStats

This commit is contained in:
Cecylia Bocovich 2023-10-31 12:20:53 -04:00
parent caa2b36463
commit 22d9381d9d
No known key found for this signature in database
GPG key ID: 009DE379FD9B7B90
2 changed files with 5 additions and 4 deletions

View file

@ -46,7 +46,7 @@ func (p *periodicProxyStats) OnNewSnowflakeEvent(e event.SnowflakeEvent) {
func (p *periodicProxyStats) logTick() error {
inboundSum, outboundSum := p.bytesLogger.GetStat()
e := &event.EventOnProxyStats{
e := event.EventOnProxyStats{
SummaryInterval: p.logPeriod,
ConnectionCount: p.connectionCount,
}

View file

@ -20,10 +20,11 @@ func NewEventMetrics(collector EventCollector) *EventMetrics {
func (em *EventMetrics) OnNewSnowflakeEvent(e event.SnowflakeEvent) {
switch e.(type) {
case event.EventOnProxyStats:
e := e.(event.EventOnProxyStats)
em.collector.TrackInBoundTraffic(e.InboundBytes)
em.collector.TrackOutBoundTraffic(e.OutboundBytes)
case event.EventOnProxyConnectionOver:
e := e.(event.EventOnProxyConnectionOver)
em.collector.TrackInBoundTraffic(e.InboundTraffic)
em.collector.TrackOutBoundTraffic(e.OutboundTraffic)
em.collector.TrackNewConnection()
}
}