fix: remove age==0 guard that silently dropped all rogue AP metrics (#972)

save_rogue = true collected data from the controller but never wrote
any of it to the output backends. All three exporters (InfluxDB, Datadog,
Prometheus) had the same guard:

    if s.Age.Val == 0 { return }

The intent was to drop stale entries, but the logic is inverted: Age==0
means brand-new or (more commonly) that the UniFi controller did not
include an "age" field in the JSON response, causing FlexInt to default
to 0. This silently discarded every rogue AP record.

Remove the guard entirely. The data was just fetched on-demand from the
controller; if the user opted in to save_rogue, they want all of it.

Fixes #405

Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cody Lee
2026-03-23 14:53:07 -05:00
committed by GitHub
parent dcdbef6687
commit 8c7f1cb854
3 changed files with 0 additions and 12 deletions

View File

@@ -11,10 +11,6 @@ const uapT = item("UAP")
// batchRogueAP generates metric points for neighboring access points.
func (u *DatadogUnifi) batchRogueAP(r report, s *unifi.RogueAP) {
if s.Age.Val == 0 {
return // only keep metrics for things that are recent.
}
tags := cleanTags(map[string]string{
"security": s.Security,
"oui": s.Oui,

View File

@@ -11,10 +11,6 @@ const uapT = item("UAP")
// batchRogueAP generates metric points for neighboring access points.
func (u *InfluxUnifi) batchRogueAP(r report, s *unifi.RogueAP) {
if s.Age.Val == 0 {
return // only keep metrics for things that are recent.
}
r.send(&metric{
Table: "uap_rogue",
Tags: map[string]string{

View File

@@ -193,10 +193,6 @@ func descUAP(ns string) *uap { // nolint: funlen
}
func (u *promUnifi) exportRogueAP(r report, d *unifi.RogueAP) {
if d.Age.Val == 0 {
return // only keep things that are recent.
}
labels := []string{
d.Security, d.Oui, d.Band, d.Bssid, d.ApMac, d.Radio, d.RadioName, d.SiteName, d.Essid, d.SourceName,
}