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) }