Documentation
¶
Index ¶
- type BrokerRegistry
- type BrokerRegistryHealthChecker
- type Check
- type Checker
- type ClusterCoordinator
- type ComponentHealthChecker
- type CoordinatorHealthChecker
- type CurrentAssignment
- type Handler
- type MetadataState
- type MetadataStore
- type MetadataStoreHealthChecker
- type PeriodicChecker
- type RaftNode
- type RaftNodeHealthChecker
- type RebalanceStats
- type Registry
- func (r *Registry) CheckAll(ctx context.Context) Response
- func (r *Registry) CheckOne(ctx context.Context, name string) (Check, error)
- func (r *Registry) ReadinessCheck(ctx context.Context) Check
- func (r *Registry) Register(checker Checker)
- func (r *Registry) SetTimeout(timeout time.Duration)
- func (r *Registry) Unregister(name string)
- type Response
- type Server
- type SimpleChecker
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BrokerRegistry ¶
BrokerRegistry interface for health checking
type BrokerRegistryHealthChecker ¶
type BrokerRegistryHealthChecker struct {
// contains filtered or unexported fields
}
BrokerRegistryHealthChecker checks broker registry health
func NewBrokerRegistryHealthChecker ¶
func NewBrokerRegistryHealthChecker(name string, registry BrokerRegistry) *BrokerRegistryHealthChecker
NewBrokerRegistryHealthChecker creates a health checker for broker registry
func (*BrokerRegistryHealthChecker) Check ¶
func (b *BrokerRegistryHealthChecker) Check(ctx context.Context) Check
Check performs the health check
func (*BrokerRegistryHealthChecker) Name ¶
func (b *BrokerRegistryHealthChecker) Name() string
Name returns the checker name
type Check ¶
type Check struct {
Name string `json:"name"`
Status Status `json:"status"`
Message string `json:"message,omitempty"`
Timestamp time.Time `json:"timestamp"`
Duration time.Duration `json:"duration_ms"`
Details map[string]interface{} `json:"details,omitempty"`
}
Check represents a health check result for a component
func LivenessCheck ¶
func LivenessCheck() Check
LivenessCheck returns a simple check that always succeeds (process is alive)
type Checker ¶
type Checker interface {
// Name returns the name of this health check
Name() string
// Check performs the health check and returns the result
Check(ctx context.Context) Check
}
Checker is the interface that health check providers must implement
type ClusterCoordinator ¶
type ClusterCoordinator interface {
GetRebalanceStats() RebalanceStats
GetCurrentAssignment() CurrentAssignment
}
ClusterCoordinator interface for health checking
type ComponentHealthChecker ¶
type ComponentHealthChecker struct {
// contains filtered or unexported fields
}
ComponentHealthChecker aggregates multiple health checks
func NewComponentHealthChecker ¶
func NewComponentHealthChecker(name string, checkers ...Checker) *ComponentHealthChecker
NewComponentHealthChecker creates a checker that aggregates multiple checks
func (*ComponentHealthChecker) Check ¶
func (c *ComponentHealthChecker) Check(ctx context.Context) Check
Check runs all component checks and aggregates the result
func (*ComponentHealthChecker) Name ¶
func (c *ComponentHealthChecker) Name() string
Name returns the checker name
type CoordinatorHealthChecker ¶
type CoordinatorHealthChecker struct {
// contains filtered or unexported fields
}
CoordinatorHealthChecker checks cluster coordinator health
func NewCoordinatorHealthChecker ¶
func NewCoordinatorHealthChecker(name string, coordinator ClusterCoordinator) *CoordinatorHealthChecker
NewCoordinatorHealthChecker creates a health checker for the coordinator
func (*CoordinatorHealthChecker) Check ¶
func (c *CoordinatorHealthChecker) Check(ctx context.Context) Check
Check performs the health check
func (*CoordinatorHealthChecker) Name ¶
func (c *CoordinatorHealthChecker) Name() string
Name returns the checker name
type CurrentAssignment ¶
type CurrentAssignment interface {
TotalPartitions() int
}
CurrentAssignment represents the current partition assignment
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler provides HTTP handlers for health check endpoints
func NewHandler ¶
NewHandler creates a new HTTP handler for health checks
func (*Handler) RegisterRoutes ¶
RegisterRoutes registers all health check routes on the given mux
type MetadataState ¶
MetadataState represents the metadata state
type MetadataStore ¶
type MetadataStore interface {
IsLeader() bool
GetState() MetadataState
}
MetadataStore interface for health checking
type MetadataStoreHealthChecker ¶
type MetadataStoreHealthChecker struct {
// contains filtered or unexported fields
}
MetadataStoreHealthChecker checks metadata store health
func NewMetadataStoreHealthChecker ¶
func NewMetadataStoreHealthChecker(name string, store MetadataStore) *MetadataStoreHealthChecker
NewMetadataStoreHealthChecker creates a health checker for metadata store
func (*MetadataStoreHealthChecker) Check ¶
func (m *MetadataStoreHealthChecker) Check(ctx context.Context) Check
Check performs the health check
func (*MetadataStoreHealthChecker) Name ¶
func (m *MetadataStoreHealthChecker) Name() string
Name returns the checker name
type PeriodicChecker ¶
type PeriodicChecker struct {
// contains filtered or unexported fields
}
PeriodicChecker runs health checks periodically and caches results
func NewPeriodicChecker ¶
func NewPeriodicChecker(checker Checker, interval time.Duration) *PeriodicChecker
NewPeriodicChecker creates a health checker that runs periodically
func (*PeriodicChecker) Check ¶
func (pc *PeriodicChecker) Check(ctx context.Context) Check
Check returns the last cached health check result
func (*PeriodicChecker) Name ¶
func (pc *PeriodicChecker) Name() string
Name returns the wrapped checker name
func (*PeriodicChecker) Start ¶
func (pc *PeriodicChecker) Start()
Start begins periodic health checking
func (*PeriodicChecker) Stop ¶
func (pc *PeriodicChecker) Stop()
Stop stops periodic health checking
type RaftNodeHealthChecker ¶
type RaftNodeHealthChecker struct {
// contains filtered or unexported fields
}
RaftNodeHealthChecker checks the health of a Raft consensus node
func NewRaftNodeHealthChecker ¶
func NewRaftNodeHealthChecker(name string, node RaftNode) *RaftNodeHealthChecker
NewRaftNodeHealthChecker creates a health checker for a Raft node
func (*RaftNodeHealthChecker) Check ¶
func (r *RaftNodeHealthChecker) Check(ctx context.Context) Check
Check performs the health check
func (*RaftNodeHealthChecker) Name ¶
func (r *RaftNodeHealthChecker) Name() string
Name returns the checker name
type RebalanceStats ¶
type RebalanceStats interface {
IsRebalancing() bool
GetLastRebalanceTime() time.Time
GetRebalanceCount() int64
GetFailedRebalances() int64
}
RebalanceStats represents rebalancing statistics
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages health checks
func (*Registry) CheckAll ¶
CheckAll runs all registered health checks and returns aggregated results
func (*Registry) ReadinessCheck ¶
ReadinessCheck returns the aggregated status for readiness A system is ready if all critical components are healthy or degraded (not unhealthy)
func (*Registry) SetTimeout ¶
SetTimeout sets the timeout for health checks
func (*Registry) Unregister ¶
Unregister removes a health checker from the registry
type Response ¶
type Response struct {
Status Status `json:"status"`
Timestamp time.Time `json:"timestamp"`
Checks map[string]Check `json:"checks"`
}
Response represents the aggregated health check response
func (*Response) MarshalJSON ¶
MarshalJSON customizes JSON marshaling for Response
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wraps an HTTP server for health checks
type SimpleChecker ¶
type SimpleChecker struct {
// contains filtered or unexported fields
}
SimpleChecker is a basic implementation of Checker using a function
func NewSimpleChecker ¶
func NewSimpleChecker(name string, fn func(ctx context.Context) Check) *SimpleChecker
NewSimpleChecker creates a new simple health checker
type Status ¶
type Status string
Status represents the health status of a component
const ( // StatusHealthy indicates the component is healthy StatusHealthy Status = "healthy" // StatusDegraded indicates the component is working but not optimally StatusDegraded Status = "degraded" // StatusUnhealthy indicates the component is not working StatusUnhealthy Status = "unhealthy" // StatusUnknown indicates the health status is unknown StatusUnknown Status = "unknown" )