Skip to content
Hoody.com

description: Monitor stats, active requests, script performance, and system health.

The Monitoring & Performance endpoints expose runtime telemetry for the exec service: process health, active and historical HTTP/WebSocket traffic, per-script performance, Prometheus exposition, and controlled restarts. Use them to power dashboards, set alerts, and drain traffic safely before a deploy.

Script paths in responses are display paths relative to the scripts root. A script for the default host on exec instance 1 named checkout.ts appears as default/1/checkout.ts, not as an absolute filesystem path.

Liveness probe. Returns the process status, a memory snapshot, the PID, the open file descriptor count, and the peer IP of the probing request.

This endpoint takes no parameters.

Terminal window
curl https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com/api/v1/exec/health
{
"status": "ok",
"service": "hoody-exec",
"built": "2026-01-12T08:30:00.000Z",
"started": "2026-01-15T14:22:01.000Z",
"memory": {
"rss": 134217728,
"heap": 67108864
},
"fds": 42,
"pid": 17,
"ip": "10.0.0.5",
"userAgent": "kube-probe/1.29"
}

Returns HTTP requests currently being executed by scripts, including the elapsed time per request and the originating script path.

This endpoint takes no parameters.

Terminal window
curl https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com/api/v1/exec/monitor/active-requests
{
"count": 2,
"active": [
{
"executionId": "01HMZ9C8R3K4QJ7WQX2N5TDPAB",
"scriptPath": "default/1/checkout.ts",
"hostname": "shop.example.com",
"clientIp": "203.0.113.41",
"method": "POST",
"url": "/api/v1/exec/run",
"startedAt": "2026-01-15T14:22:18.000Z",
"duration": 1284
},
{
"executionId": "01HMZ9C8R3K4QJ7WQX2N5TDPAC",
"scriptPath": "default/1/webhook.ts",
"hostname": "api.example.com",
"clientIp": "198.51.100.7",
"method": "POST",
"url": "/api/v1/exec/run",
"startedAt": "2026-01-15T14:22:21.000Z",
"duration": 412
}
]
}

Lists every tracked script with its HTTP and WebSocket counters, latency percentiles, active concurrency, and the most recent errors. Supports pagination and sorting.

NameInTypeRequiredDescription
limitqueryintegerNoMax number of scripts to return. Clamped to [1, 500]. Default 100.
sortquerystringNoSort key. lastActivity (default) sorts by most recent activity; other keys sort descending by the matching metric. Allowed values: lastActivity, requests, errors, p95, ws_active. Default lastActivity.
Terminal window
curl "https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com/api/v1/exec/monitor/scripts?limit=50&sort=p95"
{
"count": 2,
"total": 2,
"scripts": [
{
"scriptPath": "default/1/checkout.ts",
"hostname": "shop.example.com",
"vmCached": true,
"sharedStateBytes": 4096,
"activeHttp": 3,
"activeWs": 0,
"concurrentRunning": 1,
"http": {
"total": 1024,
"success": 1018,
"errors": 6,
"meanDurationMs": 12.4,
"p50DurationMs": 8,
"p95DurationMs": 42,
"maxDurationMs": 318
},
"ws": {
"opened": 0,
"closed": 0,
"normalCloses": 0,
"abnormalCloses": 0,
"meanSessionMs": 0,
"maxSessionMs": 0
},
"recentErrors": [
{
"timestamp": "2026-01-15T14:21:54.000Z",
"statusCode": 502,
"message": "Upstream fetch failed: connection reset",
"executionId": "01HMZ9C8R3K4QJ7WQX2N5TDPAA"
}
],
"firstSeenAt": "2026-01-15T13:00:00.000Z",
"lastActivityAt": "2026-01-15T14:22:18.000Z"
},
{
"scriptPath": "default/1/webhook.ts",
"hostname": "api.example.com",
"vmCached": true,
"sharedStateBytes": null,
"activeHttp": 1,
"activeWs": 2,
"concurrentRunning": 1,
"http": {
"total": 512,
"success": 510,
"errors": 2,
"meanDurationMs": 7.1,
"p50DurationMs": 5,
"p95DurationMs": 18,
"maxDurationMs": 122
},
"ws": {
"opened": 28,
"closed": 26,
"normalCloses": 25,
"abnormalCloses": 1,
"meanSessionMs": 14500,
"maxSessionMs": 88200
},
"recentErrors": [],
"firstSeenAt": "2026-01-15T12:00:00.000Z",
"lastActivityAt": "2026-01-15T14:22:21.000Z"
}
]
}

Returns process-wide counters: uptime, memory, per-script and per-VM cache sizes, request totals, rolling per-second rates, WebSocket counters, cron counters, and the count of dropped per-script metric entries.

This endpoint takes no parameters.

Terminal window
curl https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com/api/v1/exec/monitor/stats
{
"uptime": 7384,
"memory": {
"used": 67108864,
"total": 134217728,
"percentage": 50,
"rss": 134217728,
"external": 4194304
},
"cache": {
"scripts": 12,
"vms": 8,
"sharedStates": 6,
"activeWsHostnames": 3
},
"requests": {
"total": 1536,
"success": 1528,
"errors": 8,
"activeHttp": 4,
"perSecond": 0.21,
"per1m": 4.2,
"per5m": 3.9,
"per15m": 3.1
},
"websocket": {
"opened": 28,
"closed": 26,
"active": 2,
"normalCloses": 25,
"abnormalCloses": 1
},
"cron": {
"fires": 144,
"errors": 2,
"active": 0,
"wrapperActive": 0
},
"droppedScripts": 0,
"sinceMs": 1736950921000
}

POST /api/v1/exec/monitor/script-performance

Section titled “POST /api/v1/exec/monitor/script-performance”

Returns the full performance record for a single script, including HTTP and WebSocket counters, latency percentiles, recent durations, and active concurrency.

NameTypeRequiredDescription
scriptPathstringNoScript to report on, as /monitor/scripts lists it (relative to the scripts directory) or as an absolute path. An unknown script returns {"metrics": {}}; a non-string value is refused with a 400.
{
"scriptPath": "default/1/checkout.ts"
}
Terminal window
curl -X POST \
-H 'Content-Type: application/json' \
-d '{
"scriptPath": "default/1/checkout.ts"
}' \
https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com/api/v1/exec/monitor/script-performance
{
"metrics": {
"scriptPath": "default/1/checkout.ts",
"period": "lifetime",
"http": {
"total": 1024,
"success": 1018,
"errors": 6,
"meanDurationMs": 12.4,
"p50DurationMs": 8,
"p95DurationMs": 42,
"maxDurationMs": 318,
"recentDurationsMs": [11, 9, 14, 8, 12, 7, 22, 18]
},
"ws": {
"opened": 0,
"closed": 0,
"normalCloses": 0,
"abnormalCloses": 0,
"meanSessionMs": 0,
"maxSessionMs": 0
},
"activeHttp": 3,
"activeWs": 0,
"firstSeenAt": "2026-01-15T13:00:00.000Z",
"lastActivityAt": "2026-01-15T14:22:18.000Z"
}
}

Prometheus 0.0.4 text exposition. Includes per-script and aggregate HTTP counters and duration histograms, WebSocket connection and close counters, exporter error counters, and the standard process_start_time_seconds.

This endpoint takes no parameters.

Terminal window
curl https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com/api/v1/exec/monitor/metrics
# HELP hoody_exec_http_requests_total Total HTTP requests handled by scripts
# TYPE hoody_exec_http_requests_total counter
hoody_exec_http_requests_total{script="default/1/checkout.ts",method="POST",status="200"} 1018
hoody_exec_http_requests_total{script="default/1/checkout.ts",method="POST",status="502"} 6
hoody_exec_http_requests_total{script="default/1/webhook.ts",method="GET",status="200"} 510
# HELP hoody_exec_http_errors_total Total HTTP errors (status >= 400) handled by scripts
# TYPE hoody_exec_http_errors_total counter
hoody_exec_http_errors_total{script="default/1/checkout.ts",method="POST",status="502"} 6
# HELP hoody_exec_http_duration_ms Script HTTP request duration in milliseconds (per-script)
# TYPE hoody_exec_http_duration_ms histogram
hoody_exec_http_duration_ms_bucket{script="default/1/checkout.ts",le="10"} 612
hoody_exec_http_duration_ms_bucket{script="default/1/checkout.ts",le="50"} 988
hoody_exec_http_duration_ms_bucket{script="default/1/checkout.ts",le="100"} 1015
hoody_exec_http_duration_ms_bucket{script="default/1/checkout.ts",le="+Inf"} 1024
hoody_exec_http_duration_ms_sum{script="default/1/checkout.ts"} 12697.6
hoody_exec_http_duration_ms_count{script="default/1/checkout.ts"} 1024
# HELP hoody_exec_http_duration_ms_global Script HTTP request duration in milliseconds (aggregate across all scripts)
# TYPE hoody_exec_http_duration_ms_global histogram
hoody_exec_http_duration_ms_global_bucket{le="10"} 920
hoody_exec_http_duration_ms_global_bucket{le="50"} 1500
hoody_exec_http_duration_ms_global_bucket{le="100"} 1530
hoody_exec_http_duration_ms_global_bucket{le="+Inf"} 1536
hoody_exec_http_duration_ms_global_sum 16301.6
hoody_exec_http_duration_ms_global_count 1536
# HELP hoody_exec_ws_connections_active Active WebSocket connections per hostname
# TYPE hoody_exec_ws_connections_active gauge
hoody_exec_ws_connections_active{hostname="api.example.com"} 2
# HELP hoody_exec_ws_closes_total Total WebSocket close events
# TYPE hoody_exec_ws_closes_total counter
hoody_exec_ws_closes_total{hostname="api.example.com",reason="normal"} 25
hoody_exec_ws_closes_total{hostname="api.example.com",reason="abnormal"} 1
# HELP hoody_exec_metrics_errors_total Total errors emitted by the metrics exporter
# TYPE hoody_exec_metrics_errors_total counter
hoody_exec_metrics_errors_total 0
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1736950921

Reports whether the server can be restarted right now, the current uptime, the count of in-flight requests, and the list of in-flight management requests. Poll this endpoint before issuing a restart to confirm restartReady is true.

This endpoint takes no parameters.

Terminal window
curl https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com/api/v1/exec/system/restart-status
{
"canRestart": true,
"uptime": 7384,
"uptimeFormatted": "2h 3m 4s",
"activeRequests": 4,
"managementRequests": 0,
"active": [],
"restartReady": true
}

Triggers a server restart. A graceful restart drains in-flight requests up to drainTimeoutMs before exiting; a non-graceful restart exits immediately. The endpoint returns 202 Accepted once the restart sequence has been accepted.

NameTypeRequiredDefaultDescription
gracefulbooleanNotrueWhen true, drain in-flight requests before restarting.
drainTimeoutMsintegerNo5000Maximum time in ms to wait for in-flight requests to drain before forcing exit. Zero when the restart is not graceful.
reasonstringNo"API restart request"Free-form reason recorded in the restart log.
{
"graceful": true,
"drainTimeoutMs": 5000,
"reason": "Deploy v1.42.0"
}
Terminal window
curl -X POST \
-H 'Content-Type: application/json' \
-d '{
"graceful": true,
"drainTimeoutMs": 5000,
"reason": "Deploy v1.42.0"
}' \
https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com/api/v1/exec/system/restart
{
"status": "restarting",
"graceful": true,
"drainTimeoutMs": 5000,
"activeRequests": 4,
"reason": "Deploy v1.42.0",
"message": "Restart accepted, draining in-flight requests."
}