mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-06 21:49:08 +02:00
Report FBU metrics as untracked for service-mode proxied sessions instead of as zero
This commit is contained in:
@@ -153,6 +153,7 @@ func (e *Engine) startVNCServer(authConfig *sshauth.Config) error {
|
||||
MaxFBURects: t.MaxFBURects,
|
||||
MaxWriteBytes: t.MaxWriteBytes,
|
||||
WriteNanos: t.WriteNanos,
|
||||
FBUsTracked: t.FBUsTracked,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user