pool_stats

Function pool_stats 

Source
pub async fn pool_stats(pool: Data<SharedPool>) -> impl Responder
Expand description

Get browser pool statistics.

Returns real-time metrics about the browser pool including available browsers, active browsers, and total count.

§Endpoint

GET /pool/stats

§Response (200 OK)

{
    "available": 3,
    "active": 2,
    "total": 5
}
FieldTypeDescription
availablenumberBrowsers ready to handle requests
activenumberBrowsers currently in use
totalnumberTotal browsers (available + active)

§Errors

StatusCodeDescription
500POOL_LOCK_FAILEDFailed to acquire pool lock

§Use Cases

  • Monitoring dashboards
  • Prometheus/Grafana metrics
  • Capacity planning
  • Debugging pool exhaustion

§Usage in App

App::new()
    .app_data(web::Data::new(pool.clone()))
    .route("/pool/stats", web::get().to(pool_stats))