Skip to content

enhancement: add scheduler health check endpoint #200

@CybotTM

Description

@CybotTM

Description

Production deployments need a way to check scheduler health for load balancers and monitoring.

Current Limitation

No built-in way to check if scheduler is healthy:

c := cron.New()
c.Start()
// No c.IsHealthy() or similar

Proposed API

type SchedulerHealth struct {
    Running           bool
    EntryCount        int
    LastJobStart      time.Time
    LastJobComplete   time.Time
    RunningJobCount   int
    OpenCircuits      []EntryID
    ErrorRate         float64  // Last 5 minutes
}

// Health check method
health := c.Health()
if !health.Running || health.ErrorRate > 0.5 {
    return errors.New("scheduler unhealthy")
}

// HTTP handler helper
http.HandleFunc("/health/cron", func(w http.ResponseWriter, r *http.Request) {
    health := c.Health()
    json.NewEncoder(w).Encode(health)
})

Use Cases

  • Kubernetes liveness/readiness probes
  • Load balancer health checks
  • Monitoring dashboards
  • Alerting systems

Severity

🟡 Medium - Production operations requirement

Found By

Pre-1.0 release code review with Zen/Gemini

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions