Technologies/Prefect/prefect.server.api.request.duration
PrefectPrefectMetric

prefect.server.api.request.duration

API request duration
Dimensions:None
Available on:PrometheusPrometheus (1)
Interface Metrics (1)
PrometheusPrometheus
Duration of API requests to the Prefect server in seconds
Dimensions:None

Technical Annotations (49)

Configuration Parameters (6)
server.database.sqlalchemy.pool_sizerecommended: 60 (current, may need increase)
Maximum connections in the pool; version 3.x may require more than 2.x
server.database.sqlalchemy.max_overflowrecommended: 10 (current, may need increase)
Additional connections beyond pool_size during bursts
server.database.sqlalchemy.pool_timeoutrecommended: 30
Seconds to wait for connection from pool before timeout
PREFECT_API_REQUEST_TIMEOUTrecommended: 60
Client-side timeout for API requests; default increased to 60s to prevent timeout during flow run submission
PREFECT_API_URL
Must be set to correct external Prefect server URL for client connectivity
autovacuum_analyze_scale_factorrecommended: 0.02 for high-volume tables
Keeps table statistics current for optimal query planning
Error Signatures (13)
Invalid input ConnectionInputs.SEND_HEADERS in state ConnectionState.CLOSEDexception
h2.exceptions.ProtocolErrorexception
httpcore.LocalProtocolErrorexception
httpx.LocalProtocolErrorexception
Agent stopped!log pattern
Failed the last 3 attemptslog pattern
ConnectionResetError: [Errno 104] Connection reset by peerexception
httpx.ReadErrorexception
anyio.BrokenResourceErrorexception
BrokenPipeError: [Errno 32] Broken pipeexception
Server sent an abort signal: This run is in a PENDING state and cannot transition to a PENDING statelog pattern
httpx.ReadTimeoutexception
ssl.SSLWantReadError: The operation did not complete (read)exception
CLI Commands (5)
prefect agent start --pool default-agent-pool --work-queue defaultdiagnostic
flow.run()remediation
prefect work-pool lsdiagnostic
ANALYZE;remediation
SELECT schemaname, relname AS tablename, indexrelname AS indexname, pg_size_pretty(pg_relation_size(indexrelid)) AS index_size, idx_scan AS index_scans, idx_tup_read AS tuples_read, idx_tup_fetch AS tuples_fetched FROM pg_stat_user_indexes WHERE schemaname = 'public' ORDER BY pg_relation_size(indexrelid) DESC LIMIT 20;diagnostic
Technical References (25)
flow_runcomponentdatabase locksconceptapi/task_runs/countcomponentissue #16299conceptissue #19347conceptKubernetes work poolcomponentworker podscomponenttask podscomponenth2componenthttpcorecomponenthttpxcomponentHTTP/2protocolcritical_service_loopcomponentcheck_for_cancelled_flow_runscomponentget_and_submit_flow_runscomponentget_runs_in_work_queuecomponentprefect.agentcomponentorioncomponentPENDING stateconcept/set_state/componentPrefect Cloud APIcomponentread_work_poolcomponentwork_poolcomponentpg_stat_user_tablescomponentpg_stat_user_indexescomponent
Related Insights (11)
Database connection pool exhaustion causes severe API slowdown after Prefect 3.x upgradecritical
task_runs/count API endpoint timeout prevents UI renderingwarning
Runs page load time increases to 10+ seconds after Prefect 3 upgradewarning
Worker pods incur orchestration overhead in Kubernetes work poolsinfo
API server overload at high scale causes HTTP 500 errorswarning
HTTP/2 protocol error causes agent to stop after failed retriescritical
Connection reset errors in self-hosted Prefect agent-server communicationwarning
Client timeout during flow run submission causes PENDING state deadlockcritical
API outage prevents task state confirmation and flow completionwarning
Deployment command hangs on read_work_pool during first production deploycritical
Query performance degrading over time due to stale statisticswarning