Skip to content

Metrics Endpoint

Thunder exposes runtime and per-function metrics as a JSON object on two endpoints.

MethodPathListener
GET/_internal/metricsAdmin (port 9000)
GET/metricsAdmin (port 9000, alias)

Both endpoints return the same JSON payload.

Metrics are cached in memory with a 15-second TTL.

  • Without ?fresh=1, the endpoint returns the cached snapshot if it is less than 15 seconds old.
  • With ?fresh=1, the endpoint recomputes immediately and refreshes the cache.
Terminal window
curl -s http://localhost:9000/metrics | jq
curl -s 'http://localhost:9000/metrics?fresh=1' | jq '.process_saturation'
curl -s 'http://localhost:9000/_internal/metrics?fresh=1' | jq '.routing'

If admin API key authentication is enabled, /_internal/* routes require the X-API-Key header. The /metrics alias does not use the /_internal prefix.


{
"function_count": 5,
"total_requests": 12340,
"total_errors": 12,
"total_cold_starts": 50,
"avg_cold_start_ms": 45,
"avg_cold_start_us": 45320,
"avg_cold_start_ms_precise": 45.32,
"avg_warm_start_ms": 2,
"avg_warm_start_us": 2150,
"avg_warm_start_ms_precise": 2.15,
"total_cold_start_time_us": 2266000,
"total_warm_start_time_us": 26531000,
"memory": { ... },
"process_saturation": { ... },
"routing": { ... },
"listener_connection_capacity": { ... },
"egress_connection_manager": { ... },
"top10": { ... },
"functions": [ ... ]
}
FieldTypeDescription
function_countintegerNumber of deployed functions
total_requestsintegerSum of all function requests
total_errorsintegerSum of all function errors
total_cold_startsintegerSum of all cold starts
avg_cold_start_msintegerAverage cold start time (ms, rounded down)
avg_cold_start_usintegerAverage cold start time (microseconds, rounded down)
avg_cold_start_ms_precisefloatAverage cold start time (ms, precise)
avg_warm_start_msintegerAverage warm request time (ms, rounded down)
avg_warm_start_usintegerAverage warm request time (microseconds, rounded down)
avg_warm_start_ms_precisefloatAverage warm request time (ms, precise)
total_cold_start_time_usintegerAggregate cold start elapsed time (microseconds)
total_warm_start_time_usintegerAggregate warm request elapsed time (microseconds)

Averages are 0 (or 0.0) when the divisor is zero.


Process and host memory snapshot.

FieldTypeUnitDescription
process_memory_mbfloatMBCurrent process memory from sysinfo
total_memory_mibfloatMiBHost total memory
available_memory_mibfloatMiBHost available memory (max of available and free)
estimated_per_function_mbfloatMBprocess_memory_mb / function_count (0.0 with no functions)

Global autoscaling signal derived from memory, CPU, pool, and file descriptor pressure.

FieldTypeDescription
scorefloatGlobal saturation score in [0.0, 1.0]
levelstringhealthy, warning, or critical
should_scale_outbooleantrue when score >= 0.75
active_signalsstring[]Components at or above 0.75
thresholdsobject{ warning: 0.75, critical: 0.90 }
componentsobjectNormalized component values
debugobjectRaw memory values for diagnostics
LevelCondition
healthyscore < 0.75
warning0.75 <= score < 0.90
criticalscore >= 0.90
ComponentFormula
memorymax(memory_process_raw, memory_host_raw * memory_process_raw)
cpuRatio of accumulated CPU time to warm request time
pool_isolatesrouting.total_isolates / sum(functions[*].pool.max)
pool_contextsrouting.saturated_contexts / routing.total_contexts
poolmax(pool_isolates, pool_contexts)
fdMax of runtime FD pressure and listener clamp pressure

The score is the maximum across all components.


Scheduler and capacity state snapshot.

FieldTypeDescription
total_contextsintegerLogical contexts currently tracked
total_isolatesintegerIsolate count from routing rollups
global_pool_total_isolatesintegerAlive isolates from global pool accounting
global_pool_max_isolatesintegerConfigured global isolate cap
isolate_accounting_gapintegerglobal_pool_total_isolates - total_isolates
total_active_requestsintegerActive requests across routing entries
saturated_rejectionsintegerTotal route-target capacity rejections
saturated_rejections_context_capacityintegerRejections caused by context saturation
saturated_rejections_scale_blockedintegerRejections where scale-up was blocked
saturated_rejections_scale_failedintegerRejections where scale-up failed
burst_scale_batch_lastintegerLast burst scale batch size
burst_scale_events_totalintegerCount of burst scale events
saturated_contextsintegerContexts at active-request cap
saturated_isolatesintegerFully saturated isolates

Process listener capacity considering the file descriptor budget.

FieldTypeDescription
configuredMaxConnectionsintegerConfigured max_connections value
effectiveMaxConnectionsintegerPost-clamp effective listener limit
softLimitintegerProcess RLIMIT_NOFILE soft limit
reservedFdintegerReserved FD headroom for system use
fdBudgetintegerFD budget available to listener capacity

Global outbound lease manager snapshot.

FieldTypeDescription
softLimitintegerProcess RLIMIT_NOFILE soft limit
openFdCountintegerObserved open FD count
reservedFdintegerReserved FD for non-egress use
outboundFdBudgetintegerEstimated FD budget for outbound leases
adaptiveActiveLimitintegerDynamic upper bound for active leases
activeLeasesintegerCurrently active leases
queuedWaitersintegerWaiters for lease acquisition
totalAcquiredintegerCumulative successful acquisitions
totalReleasedintegerCumulative releases
totalRejectedintegerCumulative rejections due to backpressure
totalTimeoutsintegerCumulative timed-out waits
totalReapedintegerCumulative stale leases reaped
knownTenantsintegerTenants currently tracked
topTenantsByActivearrayTop tenants by active leases (max 10)
tokenBucketobjectToken bucket state: tokens, capacity, refillPerSec
FieldTypeDescription
tenantstringTenant identifier
activeintegerActive lease count
FieldTypeDescription
tokensfloatCurrent token count
capacityfloatBucket capacity
refillPerSecfloatToken refill rate per second

Ranked views computed from current function data. Each array contains up to 10 entries.

FieldType
namestring
avg_cold_start_msfloat
cold_startsinteger
FieldType
namestring
avg_warm_request_msfloat
requestsinteger
FieldType
namestring
cpu_bound_ratiofloat
avg_cpu_time_ms_per_requestfloat
avg_warm_request_msfloat
FieldType
namestring
avg_cpu_time_ms_per_requestfloat
requestsinteger
FieldType
namestring
peak_heap_used_mbfloat
current_heap_used_mbfloat
peak_heap_used_bytesinteger
FieldType
namestring
total_cpu_time_msinteger
requestsinteger

Array of per-function objects.

FieldTypeDescription
namestringFunction slug
statusstringloading, running, error, shutting_down
bundle_formatstringeszip or snapshot
package_v8_versionstringV8 version in the deploy package
runtime_v8_versionstringV8 version in the runtime
snapshot_compatible_with_runtimebooleanV8 versions match
requires_snapshot_regenerationbooleanSnapshot format with V8 mismatch
stored_eszip_size_bytesintegerSize of stored ESZIP fallback
can_regenerate_snapshot_from_stored_eszipbooleanWhether ESZIP is available for rebuild
created_atstringRFC 3339 timestamp
updated_atstringRFC 3339 timestamp
last_errorstring or nullLast error message
poolobjectIsolate pool snapshot
metricsobjectFunction metrics
FieldTypeDescription
minintegerConfigured minimum isolates
maxintegerConfigured maximum isolates
currentintegerCurrently allocated isolates
FieldTypeUnit
total_requestsinteger
active_requestsinteger
total_errorsinteger
total_cpu_time_msintegerms
cold_startsinteger
avg_cold_start_msintegerms
total_cold_start_time_msintegerms
total_cold_start_time_usintegerus
avg_cold_start_usintegerus
avg_cold_start_ms_precisefloatms
total_warm_start_time_msintegerms
total_warm_start_time_usintegerus
avg_warm_request_msintegerms
avg_warm_request_usintegerus
avg_warm_request_ms_precisefloatms
current_heap_used_bytesintegerbytes
peak_heap_used_bytesintegerbytes
current_heap_used_mbfloatMB
peak_heap_used_mbfloatMB

  • The schema is generated in the runtime server router (build_metrics_body).
  • New fields may be added in minor runtime updates without notice.
  • Clients should tolerate unknown fields.
  • For strict integrations, pin the runtime version and validate expected keys.