Include reporter in endpoint health report
This commit is contained in:
@@ -499,12 +499,13 @@ func (s *vpnFabricEndpointObservationStore) Report(observedAt time.Time, maxEntr
|
||||
snapshot := s.Snapshot()
|
||||
if len(snapshot) == 0 {
|
||||
return map[string]any{
|
||||
"schema_version": "rap.vpn_fabric_endpoint_health_report.v1",
|
||||
"observed_at": observedAt.UTC().Format(time.RFC3339Nano),
|
||||
"total": 0,
|
||||
"reported": 0,
|
||||
"dropped": 0,
|
||||
"observations": []mesh.EndpointCandidateHealthObservation{},
|
||||
"schema_version": "rap.vpn_fabric_endpoint_health_report.v1",
|
||||
"reporter_node_id": s.reporterNodeID,
|
||||
"observed_at": observedAt.UTC().Format(time.RFC3339Nano),
|
||||
"total": 0,
|
||||
"reported": 0,
|
||||
"dropped": 0,
|
||||
"observations": []mesh.EndpointCandidateHealthObservation{},
|
||||
}
|
||||
}
|
||||
values := make([]mesh.EndpointCandidateHealthObservation, 0, len(snapshot))
|
||||
@@ -522,12 +523,13 @@ func (s *vpnFabricEndpointObservationStore) Report(observedAt time.Time, maxEntr
|
||||
}
|
||||
reported := values[:maxEntries]
|
||||
return map[string]any{
|
||||
"schema_version": "rap.vpn_fabric_endpoint_health_report.v1",
|
||||
"observed_at": observedAt.UTC().Format(time.RFC3339Nano),
|
||||
"total": len(values),
|
||||
"reported": len(reported),
|
||||
"dropped": len(values) - len(reported),
|
||||
"observations": reported,
|
||||
"schema_version": "rap.vpn_fabric_endpoint_health_report.v1",
|
||||
"reporter_node_id": s.reporterNodeID,
|
||||
"observed_at": observedAt.UTC().Format(time.RFC3339Nano),
|
||||
"total": len(values),
|
||||
"reported": len(reported),
|
||||
"dropped": len(values) - len(reported),
|
||||
"observations": reported,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -804,6 +804,7 @@ func TestVPNFabricEndpointObservationReportIsBoundedAndNewestFirst(t *testing.T)
|
||||
}
|
||||
report := store.Report(base, 1)
|
||||
if report["schema_version"] != "rap.vpn_fabric_endpoint_health_report.v1" ||
|
||||
report["reporter_node_id"] != "node-a" ||
|
||||
report["total"] != 2 ||
|
||||
report["reported"] != 1 ||
|
||||
report["dropped"] != 1 {
|
||||
|
||||
Reference in New Issue
Block a user