Report FBU metrics as untracked for service-mode proxied sessions instead of as zero

This commit is contained in:
Viktor Liu
2026-09-23 08:51:31 +02:00
parent e0fe7cccb7
commit adcd8e3ec5
6 changed files with 45 additions and 13 deletions
+1
View File
@@ -153,6 +153,7 @@ func (e *Engine) startVNCServer(authConfig *sshauth.Config) error {
MaxFBURects: t.MaxFBURects,
MaxWriteBytes: t.MaxWriteBytes,
WriteNanos: t.WriteNanos,
FBUsTracked: t.FBUsTracked,
})
}
}
+17 -11
View File
@@ -115,20 +115,26 @@ func (m *influxDBMetrics) RecordVNCSessionTick(_ context.Context, agentInfo Agen
m.mu.Lock()
defer m.mu.Unlock()
fields := map[string]float64{
"period_seconds": tick.Period.Seconds(),
"bytes_out": float64(tick.BytesOut),
"writes": float64(tick.Writes),
"max_write_bytes": float64(tick.MaxWriteBytes),
"write_time_seconds": float64(tick.WriteNanos) / 1e9,
}
// Left out rather than written as zero when they were not observed, so a
// service-mode session does not read as one that sent no updates.
if tick.FBUsTracked {
fields["fbus"] = float64(tick.FBUs)
fields["max_fbu_bytes"] = float64(tick.MaxFBUBytes)
fields["max_fbu_rects"] = float64(tick.MaxFBURects)
}
m.samples = append(m.samples, influxSample{
measurement: "netbird_vnc_traffic",
tags: tags,
fields: map[string]float64{
"period_seconds": tick.Period.Seconds(),
"bytes_out": float64(tick.BytesOut),
"writes": float64(tick.Writes),
"fbus": float64(tick.FBUs),
"max_fbu_bytes": float64(tick.MaxFBUBytes),
"max_fbu_rects": float64(tick.MaxFBURects),
"max_write_bytes": float64(tick.MaxWriteBytes),
"write_time_seconds": float64(tick.WriteNanos) / 1e9,
},
timestamp: time.Now(),
fields: fields,
timestamp: time.Now(),
})
m.trimLocked()
}
+3
View File
@@ -100,6 +100,9 @@ type VNCSessionTick struct {
MaxFBURects uint64
MaxWriteBytes uint64
WriteNanos uint64
// FBUsTracked is false when the FBU fields could not be observed (a
// service-mode proxy). They are then unknown rather than zero.
FBUsTracked bool
}
// ConnectionStageTimestamps holds timestamps for each connection stage