mapper: drop empty changes before fan-out

An empty change carries no work for any recipient, so it never becomes
a pending entry. Adds headscale_mapper_changes_dropped_total.

Updates #3417

(cherry picked from commit 286f1d5a12)
This commit is contained in:
Kristoffer Dalby
2026-09-09 14:44:06 +00:00
parent 4411264ef9
commit b8da1c2d6f
4 changed files with 112 additions and 3 deletions
+5
View File
@@ -177,6 +177,11 @@ func (r Change) IsFull() bool {
// This provides a bounded set of values suitable for Prometheus labels,
// unlike [Change.Reason] which is free-form text for logging.
func (r Change) Type() string {
// A suppressed update is a healthy outcome, not an unclassified one.
if r.IsEmpty() {
return "empty"
}
if r.IsFull() {
return "full"
}
+2 -2
View File
@@ -561,9 +561,9 @@ func TestChange_Type(t *testing.T) {
want: "ping",
},
{
name: "empty is unknown",
name: "empty",
response: Change{},
want: "unknown",
want: "empty",
},
}