Documentation
¶
Index ¶
- type Config
- type HealthCheckFunc
- type HealthStatus
- type Option
- func WithDependencies(deps ...string) Option
- func WithHealthCheck(fn HealthCheckFunc) Option
- func WithOptionalDeps(optional bool) Option
- func WithResourceLimits(cpuCores float64, memoryBytes uint64) Option
- func WithRestartPolicy(maxRestarts int, window time.Duration) Option
- func WithWorkerScaling(min, max int) Option
- type Supervisor
- type SupervisorOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// ShutdownTimeout is max time to wait for all observers to exit
ShutdownTimeout time.Duration
// HealthCheckInterval is how often to check observer health
// Reserved for Phase 2 - not yet enforced
// Default: 5 seconds
HealthCheckInterval time.Duration
// ResourceCheckInterval is how often to check resource usage
// Reserved for Phase 2 - not yet enforced
// Default: 1 second
ResourceCheckInterval time.Duration
}
Config configures supervisor behavior
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns default supervisor configuration
type HealthCheckFunc ¶
type HealthCheckFunc func(ctx context.Context) HealthStatus
HealthCheckFunc checks if observer is healthy
type HealthStatus ¶
type HealthStatus string
HealthStatus represents observer health state
const ( HealthStatusHealthy HealthStatus = "healthy" // All good HealthStatusDegraded HealthStatus = "degraded" // Slow but working HealthStatusUnhealthy HealthStatus = "unhealthy" // Needs restart )
type Option ¶
type Option func(*observerConfig)
Option is a functional option for configuring observer supervision
func WithDependencies ¶
WithDependencies configures observer dependencies Reserved for Phase 2 - not yet enforced
func WithHealthCheck ¶
func WithHealthCheck(fn HealthCheckFunc) Option
WithHealthCheck configures observer health check function Reserved for Phase 2 - not yet enforced
func WithOptionalDeps ¶
WithOptionalDeps marks dependencies as optional (can run in degraded mode) Reserved for Phase 2 - not yet enforced
func WithResourceLimits ¶
WithResourceLimits configures CPU and memory limits Reserved for Phase 2 - not yet enforced
func WithRestartPolicy ¶
WithRestartPolicy configures auto-restart behavior
func WithWorkerScaling ¶
WithWorkerScaling configures worker pool scaling Reserved for Phase 2 - not yet enforced
type Supervisor ¶
type Supervisor struct {
// contains filtered or unexported fields
}
Supervisor manages lifecycle of multiple observers
func New ¶
func New(cfg Config, opts ...SupervisorOption) *Supervisor
New creates a new supervisor with given configuration
func (*Supervisor) ObserverNames ¶
func (s *Supervisor) ObserverNames() []string
ObserverNames returns list of registered observer names
func (*Supervisor) Run ¶
func (s *Supervisor) Run(ctx context.Context) error
Run starts supervising all observers and blocks until context is cancelled
func (*Supervisor) SuperviseFunc ¶
SuperviseFunc adds an observer function to be supervised
type SupervisorOption ¶
type SupervisorOption func(*Supervisor)
SupervisorOption configures supervisor-level settings
func WithMeter ¶
func WithMeter(meter metric.Meter) SupervisorOption
WithMeter configures OTEL metrics collection