Observability

The ops port

Every role serves a separate plain-HTTP port, [ops] port (8090), with three endpoints only: health checks and metrics, with no DAG data or actions. Probes and Prometheus need no TLS certificate or credentials to use it. The ops port starts first, before the database, so probes get an answer while a role starts. schedr standalone serves one ops port for all its parts.

Endpoint

Answers 200 when

Otherwise

/healthz (liveness)

every loop the role watches has turned within the loop stall limit (2 min)

503, “the scheduling loop hasn’t turned for 150 s (limit 120 s)”

/readyz (readiness)

every part of the role has started and the master leads

503, “starting: master”

/metrics

always

Liveness never asks another component. If it failed whenever the database or the master was down, Kubernetes would restart the master or every worker in a loop, killing running tasks for nothing. So it checks only the role’s own loops: the master’s scheduling loop and the worker agent’s event loop. Each beats on a monotonic clock, at every turn and at least every 5 s while it waits. A wall clock that steps can’t make a loop look stuck. The webserver and the web UI have no loop, so each is alive while it answers.

Readiness waits for each part to start. The master is ready after its schema check, registry restore and gRPC listener. The worker is marked ready before its agent begins journal recovery and connects to the master; readiness does not mean it has registered. The webserver waits for a usable schema and its listener; the web UI waits for its listener.

A standby or paused master returns 503 (“starting: master”). A control stream reaching it is refused with UNAVAILABLE (“not leading”). A master that discovers another has taken over exits. These checks direct traffic to the leader through the Service. The web UI has no database.

Metrics

/metrics serves Prometheus metrics in the OpenMetrics text format. The metrics reference lists every metric, generated from the code. Roughly:

  • master: round durations (schedr_master_tick_duration_seconds), busy, quiet and held DAGs (schedr_master_dags{state}), quiet DAGs woken (schedr_master_dag_wakes_total{reason}), runs, tasks and workers by state, tasks waiting by reason, assignments, rejections, attempts ended, parse jobs, trigger state and events, back-pressure stops and idle restarts, commands and how long they waited for a decision, how long the core lock was waited for and how long each part of a worker’s turn held it;

  • worker: slots and slots used, attempts by status, how long a Python task took to start (schedr_worker_task_start_seconds{method,phase}), from an assignment to its Started, journal writes by record, fork servers (schedr_worker_fork_servers{interpreter,kind,state}), Python tasks and parse jobs a fork server didn’t fork (schedr_worker_fork_fallbacks_total{interpreter,reason}), watchdog kills, watcher hosts and wait steps, journal records, log disk usage;

  • webserver: requests by route and status, log proxy errors by kind;

  • web UI: none of its own;

  • every role: process memory, CPU, open files, start time (absent without /proc, so on macOS), and the build version. The web UI serves only these.

schedr_master_tick_duration_seconds has 29 buckets, each √2 times the last, from 1 ms to about 16 s. A round’s p99 one bucket worse is about 1.4 times the previous bucket, so scenario 14 can tell that from a doubling. schedr_master_dags counts DAGs that can run by state, as of the last scheduler round: busy (that round visited it), quiet (it didn’t: nothing was due), or held (the file that defines it fails to import, so it gets no runs until the file does). An idle deployment shows none busy between fire times. A held DAG is also counted as busy or quiet, so adding the three series counts it twice. A held DAG is when that series moves. schedr_master_dag_wakes_total counts the DAGs visited after a term’s first round, by reason: timer (its stored next fire time came), unknown (its next fire time wasn’t known: a new version, a pause or unpause), command, run_queued, run_ended, new_version. See Busy and quiet DAGs.

schedr_master_triggers{state} counts triggers of DAGs that want them running: running, waiting, stopped (back-pressure or a returned generator), or failing after [triggers] failing_after consecutive errors (default 5). schedr_master_trigger_events_total{result} counts new and repeated events. schedr_master_trigger_back_pressure_stops_total counts stops at the queued-event limit, and schedr_master_trigger_idle_restarts_total counts restarts after restart_if_idle.

schedr_runs_late_failed_total{dag_id,reason} counts runs that ended success and later learned of a failure. The reason is late_cleanup_failed for now. Alert on an increase, for example sum by (dag_id, reason) (increase(schedr_runs_late_failed_total[5m])) > 0. A yellow success asks for attention: the master also logs an error and handles may be left behind. See Life of a run.

schedr_worker_task_start_seconds has buckets from 10 ms to about 40 s. Use it to compare spawned and forked tasks, and to measure whether a preload list reduces startup time. method is spawn (a new process) or fork (a process from the fork server). A Linux worker with fork_server = true on its DAG interpreter records fork when a fork server forked the task and the runner said hello (see The fork server). phase is runner (from starting the process to the runner’s hello: the interpreter and schedr) or import (from sending the task to the runner’s task_imported: the DAG file imported and the arguments built). The import phase is left out when that fails. The agent times both on its own clock; the runner only sends the message. A command task is not in the histogram.

Where a start’s time goes

Both the worker and master measure parts of a task’s start. The stress guide reads them to find where a slow start’s time went.

On the worker, schedr_worker_assign_to_started_seconds runs from the agent’s loop taking an AssignTask to its Started sent: the plan, the inputs and the journal record. An assignment the worker rejects isn’t counted. schedr_worker_journal_write_seconds{record} times each write that kept records on disk before the agent went on (a failed write isn’t counted): start (the records of attempts before their Starteds), process (their processes’ identities, once started) and results. Each is written as a group: the assignments, started processes or results already waiting, up to 32, their files flushed together and the directory once, so a burst of 500 starts takes tens of writes, not 500. An assignment whose inputs the agent must fetch from the master first ends the group: those before it are started without waiting on that fetch. The agent sets the slot gauges (schedr_worker_slots_used, schedr_worker_watcher_slots_used) as each attempt starts or ends, not only at its alive tick.

On the master, one lock guards the core: the round takes it, and so does each worker’s turn of messages, a registration, a parse result, a stream’s end. schedr_master_core_lock_wait_seconds{by} is how long each waited for it: turn, round, register, upload, stream or restore. schedr_master_turn_part_seconds{part} is how long each part of a turn held it, and schedr_master_turn_messages{part} how many messages that part had: started (the turn’s Starteds, stored together), finished (its Finisheds) and rest (heartbeats, warnings and the other messages). A task’s started_at is when its worker started it: the worker sends its start in the master’s time as it estimates it (within half a round trip), and the master records that, never before the assignment nor after the message arrived. schedr_master_start_recorded_seconds is how long after the start the master recorded it, the wait for the lock included. A 1.0.0 worker sends no start time: its tasks’ started_at is when the master handled their Started.

schedr_worker_fork_servers is a gauge: one series per interpreter, kind and state. kind is preloaded or bare. state is up, down or disabled. The current state is 1 and the other two are 0. The three series exist from the moment the worker starts that server, so a server that is still starting is down. interpreter is the name in [dags] interpreter. With fork_server off, and on macOS, there are no series. A server in state disabled is also a warning on that worker, shown in the API and by schedr workers list (see The fork server).

schedr_worker_fork_fallbacks_total counts each time a fork server did not fork a Python task or a parse job. reason is disabled (the server is disabled), down (it isn’t taking requests), fork_failed (it refused the fork) or shim_died (the shim ended before process_started). The next server, or a spawned process, runs it. A Python task or parse job the first server forks does not add to the counter. A server a task skips with preload false does not add to the counter either: the task did not ask it.

For sensors, watch schedr_worker_watcher_hosts_lost_total{code} for repeated host crashes, memory kills or hosts that stop answering, by code set. Each loss uses a retry for the wait steps on that host. schedr_worker_watcher_blocked_kills_total counts hosts killed for a blocked loop, a stuck thread or an ignored cancellation, and schedr_worker_watcher_thread_stops_total counts to_thread calls stopped at their step’s end; a stop can leave shared state half updated. The schedr_worker_watcher_loop_lag_seconds histogram shows how long a host’s event loop took to get to a call, including delays short of the block limit. Slots, hosts, tied and untied threads, memory and restarted wait steps are also measured. See The watcher host.

Counters and histograms are updated where things happen. The gauges that need the database (runs, tasks and workers by state) are refreshed by the master’s loop every 15 s, with one read-only query. A scrape never queries the database or takes the master’s lock. It reads component metrics from memory and process metrics from /proc on each scrape. Labels include states, kinds, reasons, dag_id, code sets, the interpreter’s name, and method / phase on the start histogram, never a run, task or attempt ID.

schedr_retention_deleted_total{kind} counts retention deletions by kind: runs, outputs, events, commands, dags or versions. For outputs it counts runs whose outputs were removed. See Retention.

schedr_notifications_sent_total and schedr_notifications_failed_total count delivered and dropped notifications by channel. See Notifications.

schedr’s own logs

Each role logs to stderr. [log] format is auto (JSON when stdout isn’t a terminal, as in a pod; readable text in a terminal), json or text. [log] level takes RUST_LOG-style filters. These are separate from task logs, which are files on the worker (see Workers).