Add complete TUI application for monitoring Kubernetes clusters and host systems. Features include: Core features: - Collector framework with concurrent scheduling - Host collectors: disk, memory, load, network - Kubernetes collectors: pods, nodes, workloads, events with informers - Issue deduplication, state management, and resolve-after logic - Bubble Tea TUI with table view, details pane, and filtering - JSON export functionality UX improvements: - Help overlay with keybindings - Priority/category filters with visual indicators - Direct priority jump (0/1/2/3) - Bulk acknowledge (Shift+A) - Clipboard copy (y) - Theme toggle (T) - Age format toggle (d) - Wide title toggle (t) - Vi-style navigation (j/k) - Home/End jump (g/G) - Rollup drill-down in details Robustness: - Grace period for unreachable clusters - Rollups for high-volume issues - Flap suppression - RBAC error handling Files: All core application code with tests for host collectors, engine, store, model, and export packages.
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package collectors
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"tower/internal/model"
|
|
)
|
|
|
|
type Health string
|
|
|
|
const (
|
|
HealthOK Health = "OK"
|
|
HealthDegraded Health = "DEGRADED"
|
|
HealthError Health = "ERROR"
|
|
)
|
|
|
|
// Status describes collector health for the current tick.
|
|
//
|
|
// Collectors should return Status even when returning an error,
|
|
// so the UI can show useful context.
|
|
//
|
|
// LastSuccess should be the collector's most recent successful collect time.
|
|
// When unknown, it may be the zero value.
|
|
//
|
|
// Message should be short and human-friendly.
|
|
type Status struct {
|
|
Health Health `json:"health"`
|
|
Message string `json:"message,omitempty"`
|
|
LastSuccess time.Time `json:"last_success,omitempty"`
|
|
}
|
|
|
|
func OKStatus() Status {
|
|
return Status{Health: HealthOK}
|
|
}
|
|
|
|
// Collector returns "currently true" issues for this tick.
|
|
//
|
|
// The store is responsible for dedupe, lifecycle, and resolve-after.
|
|
// Collectors must respect ctx cancellation.
|
|
type Collector interface {
|
|
Name() string
|
|
Interval() time.Duration
|
|
Collect(ctx context.Context) ([]model.Issue, Status, error)
|
|
}
|