Преглед изворни кода

Add warning when pihole doesn't return expected data points

Svilen Markov пре 10 месеци
родитељ
комит
adef35049f
1 измењених фајлова са 6 додато и 0 уклоњено
  1. 6 0
      internal/feed/pihole.go

+ 6 - 0
internal/feed/pihole.go

@@ -2,6 +2,7 @@ package feed
 
 
 import (
 import (
 	"errors"
 	"errors"
+	"log/slog"
 	"net/http"
 	"net/http"
 	"sort"
 	"sort"
 	"strings"
 	"strings"
@@ -63,6 +64,11 @@ func FetchPiholeStats(instanceURL, token string) (*DNSStats, error) {
 
 
 	// Pihole _should_ return data for the last 24 hours in a 10 minute interval, 6*24 = 144
 	// Pihole _should_ return data for the last 24 hours in a 10 minute interval, 6*24 = 144
 	if len(responseJson.QueriesSeries) != 144 || len(responseJson.BlockedSeries) != 144 {
 	if len(responseJson.QueriesSeries) != 144 || len(responseJson.BlockedSeries) != 144 {
+		slog.Warn(
+			"DNS stats for pihole: did not get expected 144 data points",
+			"len(queries)", len(responseJson.QueriesSeries),
+			"len(blocked)", len(responseJson.BlockedSeries),
+		)
 		return stats, nil
 		return stats, nil
 	}
 	}