XYLEX Group

Monitoring

Telemetry, logging, and metrics

Monitoring

Metrics

Worlds Engine collects comprehensive metrics about system health and performance.

Metrics Structure

{
  uptime: 12345,
  workers: {
    total: 5,
    idle: 2,
    busy: 3
  },
  workflows: {
    queued: 10,
    running: 15,
    completed: 100,
    failed: 2
  },
  throughput: {
    perMinute: 45,
    perHour: 2500
  },
  workload: 0.6
}

Prometheus Integration

app.get('/metrics', (req, res) => {
  const metrics = world.getMetrics();
  res.send(convertToPrometheusFormat(metrics));
});

Logging

Logs are written to console and .worlds-engine/logs directory with daily rotation.

Log Levels: debug, info, warn, error

Categories: world, worker, workflow, activity, system

Log Entry:

{
  "timestamp": 1678901234567,
  "level": "info",
  "category": "workflow",
  "message": "Workflow started",
  "metadata": { "workflowId": "abc-123" }
}

Heartbeat Monitoring

Tracks liveness of workers and activities.

  • Workers: Send heartbeat every 5s. Dead workers are removed and replaced.
  • Activities: Can send custom heartbeats. Dead activities are timed out and retried.

Timeout detection compares current time to last heartbeat. Entities exceeding heartbeatTimeout (default 30s) are considered dead.