Skip to content

Health Monitor

Demonstrates health monitoring for PythonEmbed instances and pools. Use ping() for liveness checks and health() for detailed runtime statistics (memory, reference count, GC status).

View source

Key Points

  • ping() — quick liveness check (returns boolean)
  • health() — detailed HealthInfo with RSS memory, ref count, GC status
  • HealthInfo.memoryRssKb() — resident memory in KB
  • HealthInfo.refCount() — number of active Python object handles
  • HealthInfo.gcEnabled() / gcCounts() — Python GC state
  • pool.healthCheck() — batch health check on all idle instances

Run It

./gradlew :python-embed-examples:health-monitor:run