Skip to content

[Feature Request] Add Health Check Endpoint #36

@vincentkoc

Description

@vincentkoc

Description

Add comprehensive health check endpoints for monitoring and load balancing.

Endpoints to Add

  1. /health - Basic health check (existing, enhance)
  2. /health/ready - Readiness probe
  3. /health/live - Liveness probe

Health Checks

Each endpoint should check:

  • API connectivity to Opik
  • Authentication status
  • Resource availability
  • Transport status

Implementation

app.get('/health', (req, res) => {
  res.json({ status: 'ok', timestamp: Date.now() });
});

app.get('/health/ready', async (req, res) => {
  const checks = {
    api: await checkApiConnectivity(),
    auth: await checkAuthentication(),
    transport: checkTransportStatus()
  };
  
  const ready = Object.values(checks).every(c => c.status === 'ok');
  res.status(ready ? 200 : 503).json({
    ready,
    checks,
    timestamp: Date.now()
  });
});

app.get('/health/live', (req, res) => {
  res.json({ alive: true, uptime: process.uptime() });
});

Tasks

  • Enhance existing /health endpoint
  • Add /health/ready endpoint
  • Add /health/live endpoint
  • Implement API connectivity check
  • Implement authentication check
  • Add detailed status information
  • Add tests
  • Document endpoints

Use Cases

  • Kubernetes liveness/readiness probes
  • Load balancer health checks
  • Monitoring systems
  • Debugging connectivity issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions