The system includes multiple background recovery mechanisms and workflow engines to ensure data consistency under abnormal conditions. These logs help monitor the health status of background tasks.
When the service restarts or Turn execution is abnormally interrupted, the system automatically scans and recovers stale Turns.
Event Trigger Key Fields [Server] recoverStaleTurns: found stale turnsStale Turns discovered count[Server] recoverStaleTurns: published submitRecovery submission published turn[Server] recoverStaleTurns: skip closed sessionSkip closed Session session[Server] recoverStaleTurns: skip already-interrupted turnSkip already interrupted Turn turn[Server] recoverStaleTurns: requeued ghost workRe-queued ghost task work_id[Server] recoverStaleTurns: released session lockSession lock released session[Server] recoverStaleTurns: skip lock release -- worker aliveSkip lock release (Worker still alive) session[Server] periodicRecoverStaleTurns: found stale turnsPeriodic scan found stale Turns count[Server] periodicRecoverStaleTurns: checkpoint expiredCheckpoint expired turn[Server] periodicRecoverStaleTurns: recovering stale running/interrupted turnRecovering running/interrupted Turn turn[Server] publishRecoveryWorkItem: publishedRecovery work item published session, turn
Event Trigger Key Fields [loop.Recovery] startedRecovery scan started interval[loop.Recovery] cancelled expired loopCancelled expired Loop loop_id[loop.Recovery] re-enqueued stale loopRe-enqueued stalled Loop loop_id[loop.Cleanup] cancelled active loopCleaned up active Loop loop_id[loop.Cleanup] cancelled active goalCleaned up active Goal goal_id
Event Trigger Key Fields [turnagent] createLoop.completedLoop creation completed loop_id, session_id[turnagent] createGoal.completedGoal creation completed goal_id, session_id[turnagent] pauseLoop.completedLoop paused loop_id, session_id[turnagent] resumeLoop.completedLoop resumed loop_id, session_id[turnagent] listLoops.completedLoop list query session_id, count[turnagent] loopWorkflow.loop_exhaustedLoop reached maximum iterations loop_id, session_id[turnagent] loopWorkflow.loop_extendedLoop iteration extended loop_id, session_id, iteration[turnagent] loopWorkflow.scheduled_nextNext execution scheduled loop_id, task_id[turnagent] goalWorkflow.goal_exhaustedGoal reached maximum iterations goal_id, session_id[turnagent] goalWorkflow.goal_extendedGoal iteration extended goal_id, session_id, iteration
Event Trigger Key Fields [lifecycle.Manager] component startedComponent started successfully component[lifecycle.Manager] component stoppedComponent stopped successfully component[lifecycle.Manager] start component failedComponent start failed component, error[lifecycle.Manager] stop component failedComponent stop failed component, error[lifecycle.Manager] shutdown timeoutShutdown timeout - [lifecycle.Manager] goroutine panicComponent Goroutine exception component, panic, stack
Event Trigger Key Fields Starting RTC Agent server...Server starting - HTTP server listeningHTTP server ready addrLLM initializedLLM initialization completed provider, modelTracing enabledTracing enabled endpoint, sample_rateShutting down server...Server shutting down - Server failedServer startup failed errorDatabase migration completed successfullyDatabase migration completed -
Event Trigger Key Fields goroutine leak threshold exceededGoroutine count exceeds threshold count, threshold
{service="server"} | json | msg=~"\\[Server\\] (recoverStaleTurns|periodicRecoverStaleTurns|publishRecoveryWorkItem)"
{service="server"} | json count="count" | msg=~"\\[Server\\] (recoverStaleTurns|periodicRecoverStaleTurns): found stale turns"
{service="server"} | json turn="turn" | msg=~"\\[Server\\] (recoverStaleTurns|periodicRecoverStaleTurns)" | turn="turn-123"
{service="server"} | json | msg=~"\\[Server\\] (recoverStaleTurns|periodicRecoverStaleTurns).*(failed|error)"
{service="server"} | json | msg=~"\\[loop\\.(Recovery|Cleanup)\\]"
{service="server"} | json | msg=~"\\[turnagent\\] (createLoop|createGoal|pauseLoop|resumeLoop|loopWorkflow|goalWorkflow)"
{service="server"} | json loop_id="loop_id" | msg=~"\\[turnagent\\] (createLoop|pauseLoop|resumeLoop|loopWorkflow|listLoops)" | loop_id="loop-abc"
{service="server"} | json | msg="[turnagent] loopWorkflow.loop_exhausted"
{service="server"} | json | msg="[turnagent] goalWorkflow.goal_exhausted"
{service="server"} | json component="component", error="error" | msg="[lifecycle.Manager] start component failed"
{service="server"} | json component="component", error="error" | msg="[lifecycle.Manager] stop component failed"
{service="server"} | json count="count", threshold="threshold" | msg="goroutine leak threshold exceeded"
{service="server"} | json | msg=~"Starting RTC Agent server|HTTP server listening|LLM initialized|Tracing enabled"
{service="server"} | json | msg=~"Shutting down server|centrifuge node shutdown|broker close|Server shutdown"
{service="server"} | json | msg=~"Running database migration|Database migration completed"
{service="server"} | msg="[lifecycle.Manager] shutdown timeout, goroutines still running"
{service="server"} | json panic="panic", stack="stack" | msg=~"panic recovered|panic|\\[Centrifuge\\] OnConnect panic"
Metric Type Labels Purpose rtc_stale_turns_recovered_totalCounter statusStale Turn recovery statistics rtc_checkpoint_operations_totalCounter operation, statusCheckpoint operation statistics rtc_checkpoint_data_bytesHistogram operationCheckpoint data size
# Stale Turns recovered per minute
sum(rate(rtc_stale_turns_recovered_total[5m])) by (status)
# Checkpoint operation rate
sum(rate(rtc_checkpoint_operations_total[5m])) by (operation, status)
Alert Condition Description Frequent Stale Turn recovery Recovery > 30 per minute Service may be restarting frequently or Turn execution is unstable Goroutine leak Goroutine count exceeds threshold Goroutine leak detected Component start failure Consecutive start failures Dependency service unavailable Shutdown timeout Shutdown timeout appears Check for blocked Goroutines Frequent Loop recovery Recovery > 10 per minute Task queue may have issues
View recovery logs: {service="server"} | msg=~"recoverStaleTurns" | json
Check if the service is restarting frequently: {service="server"} | msg="Starting RTC Agent server"
Check if Workers are alive: {service="server"} | msg="skip lock release -- worker alive"
If the service is healthy, check if Turn execution is timing out
View workflow logs: {service="server"} | msg=~"loopWorkflow|goalWorkflow" | json
Check Loop status: are there loop_exhausted events
View recovery logs: {service="server"} | msg=~"\\[loop\\.(Recovery|Cleanup)\\]"
Check if asynq tasks are executing normally
View shutdown logs: {service="server"} | msg=~"Shutting down|stopped|shutdown"
Check for timeouts: {service="server"} | msg="shutdown timeout"
View Goroutine count: {service="server"} | msg="goroutine leak threshold exceeded"
Export pprof: GET /debug/pprof/goroutine