From 0d62a300e7dd9b3bd4c15a59250c6f1b073a293f Mon Sep 17 00:00:00 2001 From: Jan Eitzinger Date: Tue, 3 Feb 2026 18:35:17 +0100 Subject: [PATCH] Intermediate state of node Healthcheck TODOS: * Remove error handling from routine and simplify API call * Use map for hardware level metrics --- internal/api/node.go | 2 +- pkg/metricstore/healthcheck.go | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/internal/api/node.go b/internal/api/node.go index 853b23e1..ce8a263a 100644 --- a/internal/api/node.go +++ b/internal/api/node.go @@ -99,7 +99,7 @@ func (api *RestAPI) updateNodeStates(rw http.ResponseWriter, r *http.Request) { for _, node := range req.Nodes { state := determineState(node.States) - healthState := schema.MonitoringStateFull + healthState := schema.MonitoringStateFailed if hs, ok := healthStates[node.Hostname]; ok { healthState = hs } diff --git a/pkg/metricstore/healthcheck.go b/pkg/metricstore/healthcheck.go index 5ab26466..da5ccc7d 100644 --- a/pkg/metricstore/healthcheck.go +++ b/pkg/metricstore/healthcheck.go @@ -283,23 +283,20 @@ func (l *Level) getHealthyMetrics(m *MemoryStore) ([]string, []string, error) { for metricName, mc := range m.Metrics { b := l.metrics[mc.offset] if b.isBufferHealthy() { - // Buffer has recent data, now check for missing values - missingCount := b.countMissingValues() - if missingCount > int(MaxMissingDataPoints) { - degradedList = append(degradedList, metricName) - } else { - healthyList = append(healthyList, metricName) - } + healthyList = append(healthyList, metricName) + } else { + degradedList = append(degradedList, metricName) } } - // Phase 2: Recursively check child levels (hardware components) + // Phase 2: Recursively check child levels for _, lvl := range l.children { childHealthy, childDegraded, err := lvl.getHealthyMetrics(m) if err != nil { return nil, nil, err } + // FIXME: Use a map to collect core level metrics // Merge child metrics into flat lists healthyList = append(healthyList, childHealthy...) degradedList = append(degradedList, childDegraded...)