Include reporter in endpoint health report

This commit is contained in:
2026-05-16 11:23:48 +03:00
parent 0124913919
commit 9c99899322
3 changed files with 17 additions and 12 deletions
@@ -499,12 +499,13 @@ func (s *vpnFabricEndpointObservationStore) Report(observedAt time.Time, maxEntr
snapshot := s.Snapshot() snapshot := s.Snapshot()
if len(snapshot) == 0 { if len(snapshot) == 0 {
return map[string]any{ return map[string]any{
"schema_version": "rap.vpn_fabric_endpoint_health_report.v1", "schema_version": "rap.vpn_fabric_endpoint_health_report.v1",
"observed_at": observedAt.UTC().Format(time.RFC3339Nano), "reporter_node_id": s.reporterNodeID,
"total": 0, "observed_at": observedAt.UTC().Format(time.RFC3339Nano),
"reported": 0, "total": 0,
"dropped": 0, "reported": 0,
"observations": []mesh.EndpointCandidateHealthObservation{}, "dropped": 0,
"observations": []mesh.EndpointCandidateHealthObservation{},
} }
} }
values := make([]mesh.EndpointCandidateHealthObservation, 0, len(snapshot)) values := make([]mesh.EndpointCandidateHealthObservation, 0, len(snapshot))
@@ -522,12 +523,13 @@ func (s *vpnFabricEndpointObservationStore) Report(observedAt time.Time, maxEntr
} }
reported := values[:maxEntries] reported := values[:maxEntries]
return map[string]any{ return map[string]any{
"schema_version": "rap.vpn_fabric_endpoint_health_report.v1", "schema_version": "rap.vpn_fabric_endpoint_health_report.v1",
"observed_at": observedAt.UTC().Format(time.RFC3339Nano), "reporter_node_id": s.reporterNodeID,
"total": len(values), "observed_at": observedAt.UTC().Format(time.RFC3339Nano),
"reported": len(reported), "total": len(values),
"dropped": len(values) - len(reported), "reported": len(reported),
"observations": reported, "dropped": len(values) - len(reported),
"observations": reported,
} }
} }
@@ -804,6 +804,7 @@ func TestVPNFabricEndpointObservationReportIsBoundedAndNewestFirst(t *testing.T)
} }
report := store.Report(base, 1) report := store.Report(base, 1)
if report["schema_version"] != "rap.vpn_fabric_endpoint_health_report.v1" || if report["schema_version"] != "rap.vpn_fabric_endpoint_health_report.v1" ||
report["reporter_node_id"] != "node-a" ||
report["total"] != 2 || report["total"] != 2 ||
report["reported"] != 1 || report["reported"] != 1 ||
report["dropped"] != 1 { report["dropped"] != 1 {
@@ -345,6 +345,8 @@ those remote health hints with local observations using the newest signal.
Endpoint health observations include source and reporter node fields so control Endpoint health observations include source and reporter node fields so control
plane can distinguish local dial feedback from aggregated or policy-generated plane can distinguish local dial feedback from aggregated or policy-generated
health hints. health hints.
The endpoint health heartbeat report also includes the reporter node id at the
report level for simpler multi-node ingestion and diagnostics.
Deliverables: Deliverables: