Adopt documentation

This commit is contained in:
2026-02-04 12:30:33 +01:00
parent 39b8356683
commit 46fb52d67e

View File

@@ -14,7 +14,11 @@ import (
"github.com/ClusterCockpit/cc-lib/v2/schema" "github.com/ClusterCockpit/cc-lib/v2/schema"
) )
type HeathCheckResponse struct { // HealthCheckResponse represents the result of a health check operation.
//
// Status indicates the monitoring state (Full, Partial, Failed).
// Error contains any error encountered during the health check.
type HealthCheckResponse struct {
Status schema.MonitoringState Status schema.MonitoringState
Error error Error error
} }
@@ -176,7 +180,7 @@ func (m *MemoryStore) GetHealthyMetrics(selector []string, expectedMetrics []str
return missingList, degradedList, nil return missingList, degradedList, nil
} }
// HealthCheckAlt performs health checks on multiple nodes and returns their monitoring states. // HealthCheck performs health checks on multiple nodes and returns their monitoring states.
// //
// This routine provides a batch health check interface that evaluates multiple nodes // This routine provides a batch health check interface that evaluates multiple nodes
// against a specific set of expected metrics. For each node, it determines the overall // against a specific set of expected metrics. For each node, it determines the overall
@@ -201,7 +205,7 @@ func (m *MemoryStore) GetHealthyMetrics(selector []string, expectedMetrics []str
// cluster := "emmy" // cluster := "emmy"
// nodes := []string{"node001", "node002", "node003"} // nodes := []string{"node001", "node002", "node003"}
// expectedMetrics := []string{"load", "mem_used", "cpu_user", "cpu_system"} // expectedMetrics := []string{"load", "mem_used", "cpu_user", "cpu_system"}
// healthStates, err := ms.HealthCheckAlt(cluster, nodes, expectedMetrics) // healthStates, err := ms.HealthCheck(cluster, nodes, expectedMetrics)
// if err != nil { // if err != nil {
// return err // return err
// } // }
@@ -210,8 +214,7 @@ func (m *MemoryStore) GetHealthyMetrics(selector []string, expectedMetrics []str
// } // }
// //
// Note: This routine is optimized for batch operations where you need to check // Note: This routine is optimized for batch operations where you need to check
// the same set of metrics across multiple nodes. For single-node checks with // the same set of metrics across multiple nodes.
// all configured metrics, use HealthCheck() instead.
func (m *MemoryStore) HealthCheck(cluster string, func (m *MemoryStore) HealthCheck(cluster string,
nodes []string, expectedMetrics []string, nodes []string, expectedMetrics []string,
) (map[string]schema.MonitoringState, error) { ) (map[string]schema.MonitoringState, error) {
@@ -258,7 +261,5 @@ func (m *MemoryStore) HealthCheck(cluster string,
results[hostname] = status results[hostname] = status
} }
fmt.Printf("Results : %#v\n\n", results)
return results, nil return results, nil
} }