REST API reference
The :runtime module starts a built-in HTTP server that exposes operational, introspection, and admin endpoints. This page enumerates every endpoint: its path, method, purpose, the high-level shape of the response, and any configuration that gates it. For how-to guidance see Runtime → REST API, Health checks, and Metrics.
Server basics
The HTTP server is configured under runtime.http.* (see the Configuration reference).
| Aspect | Value |
|---|---|
| Default bind | 0.0.0.0:8080 |
| Enabled by | runtime.http.enabled (default true); the entire server — and all endpoints below — is absent when disabled |
| JSON content type | application/json; charset=utf-8 |
| Text content type | text/plain; charset=utf-8 |
| Error body | {"error":"<message>"} (JSON) for non-2xx responses |
| Wrong method | 405 Method Not Allowed with an Allow header listing the accepted method(s) |
Each endpoint accepts exactly one HTTP method. A request with any other method returns 405.
Endpoint summary
| Path | Method | Purpose | Gating |
|---|---|---|---|
/health/live | GET | Liveness probe | always |
/health/ready | GET | Readiness probe | always |
/metrics | GET | Prometheus scrape | runtime.metrics.enabled |
/info | GET | Application metadata + available endpoints | always |
/licence | GET | Runtime licence state | always (in-cluster exposure only) |
/licence/usage | GET | Licence usage report (stoatflow-usage/1) | always (in-cluster exposure only) |
/config | GET | Merged config — StoatFlow's sections and the application's bound sections — sensitive values masked | runtime.endpoints.config.enabled |
/state | GET | Application state + transition history | always |
/topology | GET | StoatFlow-native topology | always |
/topology/ks | GET | Kafka Streams-compatible topology | always |
/topology/compiled | GET | Compiled (internal) topology | always |
/watermarks | GET | Global + per-partition watermarks | always |
/offsets | GET | Source + changelog offsets and lag | always |
/consumer | GET | Consumer group + partition buffer state | always |
/memory | GET | The memory report: plan, verdicts, the limit that fits | always |
/memory/what-if | GET | The memory plan at another limit, cache or heap | always |
/pause | POST | Pause processing | always |
/unpause | POST | Resume processing | always |
/ha/status | GET | Hot-standby cluster view | ha.mode != off |
/ha/switch | POST | Swap active/standby roles | ha.mode != off |
/ha/promote | POST | Promote a standby (?pod=<id>) | ha.mode != off |
/ha/demote | POST | Demote an active (?pod=<id>) | ha.mode != off |
/debug/threads | GET | Engine thread snapshot (freeze diagnostics) | runtime.http.debug.enabled |
/debug/barriers | GET | Commit-pipeline state (freeze diagnostics) | runtime.http.debug.enabled |
Health
GET /health/live
Kubernetes liveness probe. Aggregates all liveness indicators. Returns 200 with status: "UP" when all are healthy, otherwise 503 with status: "DOWN". Liveness stays UP during transient states (startup, shutdown) so the orchestrator does not restart the process unnecessarily.
{
"status": "UP",
"components": [
{ "name": "stoatflow", "status": "UP", "details": { "state": "RUNNING" } }
]
}
GET /health/ready
Kubernetes readiness probe. Aggregates all readiness indicators. Returns 200/UP when ready to serve, otherwise 503/DOWN. Readiness reports DOWN during startup, state restoration, and shutdown. The response body has the same shape as /health/live.
The set of indicators (StoatFlow app state, Kafka broker, licence, Schema Registry when configured, plus any custom indicators) is documented under Health checks.
Metrics
GET /metrics
Prometheus scrape endpoint. Returns metrics in Prometheus text exposition format with content type text/plain; version=0.0.4; charset=utf-8. Returns 503 if metrics are not enabled.
# HELP jvm_memory_used_bytes The amount of used memory
# TYPE jvm_memory_used_bytes gauge
jvm_memory_used_bytes{application="my-app",area="heap",id="G1 Eden Space"} 1.048576E7
Gated by runtime.metrics.enabled; when disabled the handler is not registered. The exported meters are catalogued under Metrics.
Introspection
GET /info
Application metadata: application id, the lane count the engine runs with (app.lanes — stoatflow.lanes.count, else max(2, CPU cores / 4)) and its record lanes' thread type (app.laneThreadType — stoatflow.lanes.thread-type, else PLATFORM; /config shows count: null and thread-type: null when they are unset; under DIRECT dispatch — topology.dispatchMode — no record lanes run), JVM information, Kafka configuration, uptime, current state, and the list of registered endpoints. Optional sections (watermark, offsets, consumer, topology traits) are included when available and enabled. Always returns 200 once the server is up.
{
"app": { "applicationId": "my-app", "lanes": 2, "laneThreadType": "PLATFORM" },
"java": { "version": "25", "vendor": "...", "runtime": "..." },
"kafka": { "bootstrapServers": "localhost:9092", "applicationId": "my-app" },
"uptime": { "startTime": "2026-01-19T10:00:00Z", "uptime": "PT1H30M" },
"state": { "current": "RUNNING", "since": "2026-01-19T10:00:05Z" },
"endpoints": ["/health/live", "/health/ready", "/info", "/metrics", "/topology"]
}
GET /licence
Current runtime licence state.
licenceId, licensee, customer). Expose only /health/live and /health/ready via internet ingress; keep /licence, /info, and /topology on the in-cluster Service.{
"status": "VALID",
"licenceId": "lic_7Q2…",
"sequence": 3,
"licensee": "ACME Corp",
"customer": "acme",
"tier": "production",
"scope": null,
"expiresAt": "2027-10-01T00:00:00Z",
"daysRemaining": 211,
"restartGraceEndsAt": null,
"environmentClass": "production",
"environment": "prd-eu",
"service": "orders",
"applicationId": "orders",
"haMode": "ACTIVE_STANDBY",
"haRole": "ACTIVE",
"clusterId": "<Kafka cluster id>",
"allowances": {
"production": { "licensed": 25, "cap": 25, "registered": 23, "starting": 0, "standbysRunning": 3, "standbysCounted": 0, "free": false },
"staging": { "licensed": null, "cap": null, "registered": 22, "starting": 1, "standbysRunning": 0, "standbysCounted": 0, "free": true }
},
"services": [
{ "service": "orders", "environment": "prd-eu", "class": "production", "applicationIds": ["orders-blue", "orders-green"], "counts": 1 }
],
"registry": { "available": true, "topic": "__stoatflow_licence", "historyTopic": "__stoatflow_licence_history", "brokerClock": true, "clockSkewMs": 120 },
"reporting": { "enabled": false, "required": false, "lastSent": null, "lastResult": null }
}
statusisVALID,UNVERIFIED(a paid licence whose registry is unavailable: verified and enforced for expiry, but the service count is not checked),EXPIREDorNO_KEY.restartGraceEndsAtis set once a paid licence has expired: restarts are allowed (with an error in the log) until then, and no instance starts after it.environmentClass,environment,serviceandapplicationIddescribe this deployment (see Licence configuration).haModeandhaRoleare this instance's high-availability mode and role.clusterIdis the Kafka cluster id; a licence bound to other clusters refuses to start here.allowanceshas one entry per environment class (production,staging,development,other):licensedandcap(the licensed count, and the licensed count with the burst) arenullwhen the class is unlimited or free,registeredis what the licence counts in the class (its services, merges applied, plus the standbys the licence counts),startingother instances still starting (shown, never counted),standbysRunningandstandbysCountedthe HA standbys running and the ones the licence counts, andfreeistruefor a class the licence does not list.serviceslists every counted service: its environment and class, the application ids behind it andcounts, what it adds to its class's count (two application ids count once, as a blue/green or migration merge; each further id counts one more).registryis the licence registry:available, the registry and history topic names,brokerClock(falsewhen the registry topic usesCreateTimeand host clocks are used) andclockSkewMs, how far the brokers' clock is ahead of this host's (negative when behind). It isnulluntil the instance has started.reportingis automated usage reporting:enabled(stoatflow.licence.reporting.enabled; on by default for a trial),required(the licence asks for it),lastSent(the last UTC day reported from this cluster) andlastResult(sent,duplicateorfailed). It isnulluntil the instance has started.- With
NO_KEY,expiresAtanddaysRemainingarenull.
GET /licence/usage
The usage report of this application's licence on its Kafka cluster (format stoatflow-usage/1), read from the licence history topic by time window — the same JSON as stoatflow-licence-tool report (the licence tool shows a full example).
| Parameter | Default | Meaning |
|---|---|---|
from | 29 days before to | first UTC day, YYYY-MM-DD |
to | today (UTC) | last UTC day, YYYY-MM-DD |
include-app-names | false | add application ids and service names in clear (hashed otherwise) |
- 200 with the report; 400 for a malformed date, a day outside
1970-01-01…9999-12-31,tobeforefrom, or a period longer than 400 days (the history's retention); 503 when the application has not started under a licence or the history cannot be read; 500 for an unexpected failure. classesgives per environment class the peak concurrent count and the distinct services, and for a licensed classp95DailyPeak,avgDailyPeak,daysOverLicensedandstandbys(peakRunning,peakCounted);environments,services,dailyandengineVersionsfollow;registrycarriesbrokerClock,unverifiedHoursandhistoryGapHours.
In-cluster exposure only, like /licence: the report names the licensee and the deployments.
GET /config
The merged runtime configuration: StoatFlow's sections (stoatflow, runtime, logging), then every section the application or a plugin bound through the runtime's configuration (Custom configuration). Sensitive values are masked as ****** — a field declared Secret; a value from ${secret:…} or another sensitive placeholder resolver under any key (in StoatFlow's own sections when the runtime was started from a configuration, fromConfig); and a key whose name contains password, pwd, secret, credential, token, auth, api-key, private-key or access-key in any spelling (so oauth-issuer and tokenizer match too), whose whole value is masked, a list or map included; a section of the application's named that way is masked whole. A URL's user:password@ is stripped. Supports content negotiation:
Accept header | Response |
|---|---|
application/json | JSON (application/json; charset=utf-8) |
text/yaml, application/yaml, application/x-yaml | YAML (text/yaml; charset=utf-8) |
text/html (browsers) or unset | YAML (default — more readable) |
stoatflow:
application-id: my-app
bootstrap-servers: localhost:9092
kafka:
consumer:
sasl.password: "******"
runtime:
http:
port: 8080
payments-db:
url: jdbc:postgresql://db:5432/payments
user: payments
password: "******"
max-pool-size: 10
Gated by runtime.endpoints.config.enabled; when disabled the handler is not registered.
GET /state
Current application state, when it was entered, and the full state-transition history (newest first; history size is bounded by stoatflow.processing.state-transition-history-size, default 20). Returns 503 if the engine is not yet initialized.
{
"current": "RUNNING",
"since": "2026-01-19T10:00:05+01:00",
"history": [
{ "state": "RUNNING", "from": "STARTING", "at": "2026-01-19T10:00:05+01:00" },
{ "state": "STARTING", "from": "CREATED", "at": "2026-01-19T10:00:00+01:00" }
]
}
Topology
All three topology endpoints support content negotiation: Accept: application/json returns JSON; otherwise a human-readable text description. Each returns 503 if the engine is not yet initialized.
GET /topology
The StoatFlow-native topology with richer metadata than the Kafka Streams view — scheduled sources with their scheduling configuration, processor state-store names, and the full sub-topology structure.
{ "scheduledSources": [], "subtopologies": [] }
GET /topology/ks
The same topology rendered in a format compatible with Kafka Streams' Topology#describe() output, for tools that expect the standard Kafka Streams shape. With Accept: application/json it returns the subtopology/node/edge model as JSON. This is also the pull equivalent of Kafka Streams 4.4's topology-description push (KIP-1331), which needs the streams group protocol StoatFlow does not use — see Runtime REST API.
Topologies:
Sub-topology: 0
Source: source1 (topics: [input-topic])
--> processor1
Processor: processor1 (stores: [])
--> sink1
<-- source1
GET /topology/compiled
The compiled topology — the internal representation produced by the topology compiler, including per-source processor DAGs, sub-topology boundaries, timer-aware processors, and scheduled sources. Useful for verifying how the DSL was compiled into execution units — including where the sub-topology boundaries landed under the configured topology.sub-topology-split mode. Returns 503 until the application has started (the compiled form is only available after start). The exact JSON structure is an internal representation and may change between releases; treat it as a diagnostic view, not a stable contract.
Runtime state
GET /watermarks
Global and per-partition watermark state. Returns 503 if the engine is not initialized or no partitions are registered yet.
globalMs/globalIso— the application's watermark.rawGlobalMs/rawGlobalIso— where event time stands without the timer cache's hold: equal toglobalMsunless the hold binds, then ahead of it.timerFrontierMs— the first stored event-time timer not yet loaded into the timer cache, ornullwhen every one is loaded (or there is no timer store).globalMsnever passes it. It moves back when a timer registers below it;globalMsnever moves back.timerHeld/timerHeldSinceMs— whether event time is held at the frontier now, and since when (epoch ms,nullwhen not held).alignmentGroupMins— per watermark-alignment group, the group's minimum watermark; empty when no source uses alignment.alignmentBinding— the watermark-alignment hold that currently stops all dispatch, ornull:group, the heldpartition(whose next record is the oldest buffered one),emptyLaggards(the partitions of its group it waits for — behind it by more than the drift, with nothing buffered) andsinceMs(epoch ms, when the hold began). At most one hold waits at a time. It is alsonullwhile something else — a pause, backpressure — is what stops dispatch; the hold reappears with itssinceMsunchanged.- Per partition (
topic:partition): its own watermark (watermarkMs/watermarkIso), theidleflag, the last event time,idlenessTimeoutMs(the timeout in force for this partition — its source'swithIdleness, else the application default;0= idleness off), and the alignment fields. While a watermark-alignment hold waits (alignmentBinding), a partition with records buffered does not count the wait toward idleness, so it can showidle: falsewith a last event time older than its timeout: its records are waiting, not silent. Once the hold ends, the last event time is moved forward by the time it waited, so it can read later than the partition's real last event. The alignment fields arealignmentGroup(nullwithout alignment),alignmentHeld(whether alignment currently holds the partition) anddriftFromGroupMinMs. previewWatermarkMs/previewWatermarkIso/headHeldSinceMs— present only while the partition's next record is held behind older records: the watermark the partition counts with in the global value instead of its ownwatermarkMs(shown only while it is higher), and since when (epoch ms) it has been held.timerFrontierHeld— whether the partition's next record waits at the timer frontier (it would move event time past a timer not yet loaded). While it does,timerFrontierHeadMsis that record's event time andtimerFrontierContributionMsthe watermark the partition counts with in the global value — its record's, capped at the frontier, so it moves back when the frontier does. A held partition does not count the wait toward idleness.
{
"globalMs": 1706889600000,
"globalIso": "2026-02-02T12:00:00+01:00",
"rawGlobalMs": 1706889600000,
"rawGlobalIso": "2026-02-02T12:00:00+01:00",
"timerFrontierMs": null,
"timerHeld": false,
"timerHeldSinceMs": null,
"alignmentGroupMins": {},
"alignmentBinding": null,
"partitions": {
"input-topic:0": {
"watermarkMs": 1706889600000,
"watermarkIso": "2026-02-02T12:00:00+01:00",
"idle": false,
"lastEventTimeMs": 1706889650000,
"lastEventTimeIso": "2026-02-02T12:00:50+01:00",
"alignmentGroup": null,
"alignmentHeld": false,
"driftFromGroupMinMs": 0,
"idlenessTimeoutMs": 300000,
"timerFrontierHeld": false
},
"input-topic:1": {
"watermarkMs": 1706889500000,
"watermarkIso": "2026-02-02T11:58:20+01:00",
"idle": false,
"lastEventTimeMs": 1706889500000,
"lastEventTimeIso": "2026-02-02T11:58:20+01:00",
"alignmentGroup": null,
"alignmentHeld": false,
"driftFromGroupMinMs": 0,
"idlenessTimeoutMs": 300000,
"previewWatermarkMs": 1706893200000,
"previewWatermarkIso": "2026-02-02T13:00:00+01:00",
"headHeldSinceMs": 1706889652000,
"timerFrontierHeld": false
}
}
}
GET /offsets
Per-partition committed offsets and lag for source topics, plus committed offsets for state-store changelog topics. All values are read from locally cached state (no Kafka RPCs). Returns 503 if the engine is not initialized.
{
"totalLag": 79,
"sources": [
{
"topic": "orders",
"totalLag": 79,
"partitions": [
{ "partition": 0, "committedOffset": 12345, "logEndOffset": 12400, "lag": 55 }
]
}
],
"changelogs": [
{
"topic": "my-app-order-counts-changelog",
"store": "order-counts",
"partitions": [ { "partition": 0, "committedOffset": 5432 } ]
}
]
}
GET /consumer
Consumer group metadata, source subscription, last commit time, and per-partition buffer utilization with pause state. Returns 503 if the engine is not initialized or the consumer has not yet been assigned partitions.
bufferCapacity is the pause threshold (buffered-records-per-partition), not a hard limit: a partition is paused once it holds that many records, and buffered can exceed it by up to one poll (max.poll.records − 1).
paused is true while the consumer is not fetching the partition, for any reason: its buffer is full, the application is paused (POST /pause), or state stores are still restoring at start-up. Watermark alignment never pauses a partition — a held one keeps being fetched; see alignmentHeld on /watermarks.
{
"group": {
"groupId": "my-app",
"memberId": "consumer-my-app-1-abc123",
"generationId": 3,
"groupInstanceId": null
},
"subscription": ["orders", "payments"],
"lastCommitMs": 1706889700000,
"lastCommitIso": "2026-02-02T12:01:40+01:00",
"assignment": {
"orders:0": { "buffered": 42, "bufferCapacity": 10000, "paused": false },
"payments:0": { "buffered": 8500, "bufferCapacity": 10000, "paused": true }
}
}
Memory
GET /memory
The memory report: the memory plan the engine runs on, what each pool used over the last window, a verdict per pool, and how much memory would be enough. Returns 503 if the engine is not initialized; before the first sample, the plan alone (verdicts and signals empty, fitsMib null, sampledAtMs 0). See Tuning → Sizing memory.
{
"profile": "balanced",
"limitSource": "cgroup-v2",
"limitMib": 16384,
"poolMode": "planned",
"plan": {
"jvm": 512, "heap": 3277, "headroom": 819, "rocksdb": 11776,
"block-cache": 10360, "memtables": 480, "native-reserve": 380,
"epoch-batches": 256, "databases": 60, "background-jobs": 64, "allocator-slack": 1036
},
"verdicts": {
"heap": "oversized", "block-cache": "comfortable", "memtables": "comfortable",
"native-residue": "comfortable", "container": "comfortable"
},
"fitsMib": 9216,
"slackMib": 7168,
"hint": null,
"valve": { "active": false, "steps": 0 },
"simulated": [],
"signals": {
"heap.after-gc.peak.bytes": 612368384,
"block-cache.data.hit.ratio": 0.97,
"working-set.bytes": 4123456789,
"native.unaccounted.bytes": 251658240,
"container.anon.bytes": 9663676416
},
"warnings": [],
"sampledAtMs": 1764090000000,
"planLine": "Memory plan: container 16384 MiB (cgroup-v2), heap ceiling 3277 MiB (balanced), RocksDB 11776 MiB → block cache 10360 MiB (memtables ≤ 480 inside it: 15 column families), native reserve 380 MiB (epoch batches 256, 15 databases 60, 2 jobs 64), allocator slack 1036 MiB; 2 background jobs (4 CPUs); open files unlimited (nofile 1048576)"
}
| Field | Meaning |
|---|---|
profile | The memory profile the heap was sized with (STOATFLOW_MEMORY_PROFILE; reported only). |
limitSource | Where the container limit came from: cgroup-v2, cgroup-v1 or none. |
limitMib | The container's memory limit; null without a cgroup limit. |
poolMode | How the RocksDB pool was sized: planned, absolute (stoatflow.rocks-db.memory-mb), no-limit (one 256 MiB cache), second-engine (another engine in this JVM holds the plan) or no-rocksdb. |
plan | The split in MiB: jvm, heap (the heap ceiling), headroom, rocksdb (the pool), block-cache, memtables (Σ, accounted inside the block cache), native-reserve and its terms epoch-batches, databases, background-jobs and, with the simulated cache points on, simulated-cache, and allocator-slack. |
verdicts | Per pool — heap, block-cache, memtables, native-residue, container — one of oversized, comfortable, tight, starved or unknown. |
fitsMib | The smallest container limit at which every pool holds what it uses; null until measured. |
slackMib | limitMib − fitsMib. |
hint | A profile hint when the split rather than the size is wrong; otherwise null. |
valve | The pressure valve: active (the block cache is held below its planned capacity) and steps since the engine started. |
simulated | The simulated cache points when stoatflow.rocks-db.simulated-cache.enabled is on: [{"capacityBytes": …, "dataHitRatio": …}]; empty otherwise. |
signals | What the engine measured over the last window, in bytes or ratios — the heap's ceiling, after-GC peak and GC time share, the block cache's capacity, usage and data hit ratio, the memtables against Σ, write stalls and the most L0 files, the working set, table readers, the native residue and its peak against the reserve, and the container's limit, anonymous memory, file memory, peak and memory.events. A signal that could not be read is left out. |
warnings | The plan's start-up WARNs. |
sampledAtMs | When the window ended (epoch millis); 0 before the first sample. |
planLine | The engine's start-up Memory plan: … line. |
GET /memory/what-if
The memory plan's own function — the one the engine ran at start, with this topology's databases, memtable bound, background jobs and epoch batches — on another input. Read-only.
| Parameter | Meaning |
|---|---|
limit | MiB: the split at this container limit. |
cache | MiB: the smallest limit whose plan gives at least this block cache, and the split there. |
heap | MiB: the smallest limit whose brackets give at least this heap. |
profile | balanced, state-heavy, heap-heavy or lean: answer under this memory profile. |
At most one of limit, cache and heap; with none, the answer is the plan the engine runs on — GET /memory's, its heap the one the JVM was given — also in a container with no limit (another profile then needs a size). 200 with the answer; 400 for an unknown parameter, a size that is not a positive number of MiB, more than one size, an unknown profile, a profile with no size and no container limit, or a cache or heap no limit up to 4 TiB gives (the body names the problem in error); 503 if the engine is not initialized or the application has not started.
{
"question": "cache=2048",
"profile": "balanced",
"limitMib": 4955,
"plan": {
"jvm": 512, "heap": 1562, "headroom": 248, "rocksdb": 2633,
"block-cache": 2048, "memtables": 480, "native-reserve": 380,
"epoch-batches": 256, "databases": 60, "background-jobs": 64, "allocator-slack": 205
},
"measured": { "block-cache.data.hit.ratio": 0.97, "native.unaccounted.peak.bytes": 264241152 },
"warnings": [],
"error": null
}
limitMib is the limit the answer is for — the one asked, or the smallest that gives the asked cache or heap; null, with the 400, when no limit up to 4 TiB does. measured carries what the engine has measured that bears on the answer: the data hit ratio and capacity of the current cache, the simulated point nearest the asked cache (simulated.capacity.bytes, simulated.data.hit.ratio), the native residue's peak. warnings are the WARNs a plan at that limit would raise.
Admin
POST /pause
Pauses processing: transitions the application toward PAUSED, draining in-flight work first. Returns 503 if the engine is not initialized, or 400 if the current state cannot be paused (the error body explains why).
{ "status": "pausing", "state": "DRAINING" }
POST /unpause
Resumes processing: transitions from PAUSED / DRAINING back to RUNNING. Returns 503 if the engine is not initialized, or 400 if the current state cannot be unpaused.
{ "status": "resumed", "state": "RUNNING" }
See Pause / unpause for the operational guide.
High availability
These endpoints are registered only when ha.mode != off. They return 404 when HA is disabled and 503 before the engine is initialized. See High availability for the operational guide.
GET /ha/status
This pod's view of the hot-standby cluster: its own role, replication lag, coordinator-tail freshness, ready-standby count vs ha.desired-standbys, promotion-token epoch/holder, restart-required reason (or null), whether it is restarting its engine in place, and the peers it observes.
{
"selfPodId": "my-stream-app-0",
"selfRole": "ACTIVE",
"selfState": "ACTIVE",
"selfRestarting": false,
"replicationLagRecords": 0,
"replicationLagMs": 0,
"tailFreshnessMs": 120,
"tailCaughtUp": true,
"readyStandbyCount": 1,
"desiredStandbys": 1,
"redundancyBelowDesired": false,
"tokenEpoch": 7,
"tokenHolder": "my-stream-app-0",
"restartRequired": null,
"peers": [
{ "podId": "my-stream-app-1", "role": "STANDBY", "state": "READY_STANDBY",
"replicationLagRecords": 1240, "replicationLagMs": 85, "generation": 7,
"freshnessMs": 420, "failoverPriority": 0, "restarting": false }
]
}
selfRestarting (and a peer's restarting) is true for the duration of an in-place engine restart — the pod is absorbing a processing fault by rebuilding its engine. It stays ACTIVE throughout, so selfRole does not move; this field is what distinguishes "absorbing a fault" from "healthy", and it is the field to poll after a 409 from a command endpoint. The same signal is exported as the stoatflow.ha.restarting gauge.
role or state published by a newer build that this pod does not recognise is reported as UNKNOWN. The peer still counts as alive, but takes part in no promotion decision on this pod. Seeing UNKNOWN means finish the upgrade, not that anything is wrong.POST /ha/switch
Swap roles — the active drains and the peer promotes. Publishes a command and returns 202 Accepted with the command's offset as an idempotency token.
{ "command": "SWITCH", "target": null, "force": false, "commandOffset": 42 }
All three command endpoints share two independent 409 Conflict causes, and only the first is overridable:
1. Readiness gate — overridable. Rejected unless a caught-up target exists (a node in READY_STANDBY) — handing off to a not-ready peer is a self-inflicted outage. Override with ?force=true; the override travels with the command and is re-checked on the acting pod, but a forced promotion still fully restores state before processing.
2. In-place restart — NOT overridable. Rejected while the pod the command would move is restarting its engine in place. A role change cannot be serialised against an engine swap, so the command would land as a silent no-op behind a success response. ?force=true does not override this: force exists to overrule the readiness judgement, not to make a structurally impossible operation succeed. The restart is bounded — it completes in seconds, or exhausts commit-barrier.max-engine-restarts and hands off on its own — so poll GET /ha/status until selfRestarting (or the peer's restarting) is false, then re-issue.
Because every command moves the active, the restart check covers the active for all three verbs, plus the named ?pod= target for promote/demote.
POST /ha/promote
Ask a specific standby pod to promote. Requires a ?pod=<id> target (400 if missing); 409 unless that pod is READY_STANDBY (override ?force=true), or if either it or the current active is restarting in place (not overridable). Returns 202 with the command offset.
POST /ha/demote
Ask a specific active pod to demote. Requires a ?pod=<id> target (400 if missing); 409 unless some node is READY_STANDBY to take over (override ?force=true), or if the target is restarting in place (not overridable). Returns 202 with the command offset.
Debug
The two /debug/* endpoints are diagnostic aids for investigating a stalled commit pipeline. They are gated by runtime.http.debug.enabled (default true); when disabled, neither handler is registered and both paths return 404. They are free at rest and invaluable during a freeze; disable only for hardened deployments that minimise attack surface. When enabled, both return 503 until the engine is initialized.
GET /debug/threads
A JSON snapshot of the engine's threads (and the JVM's platform threads), with each thread's state and a truncated stack trace — for answering "what is the engine stuck on?" during a freeze.
Optional query parameters:
| Param | Default | Meaning |
|---|---|---|
depth | 40 | Maximum stack frames per thread |
filter | all | all, stuck (only threads not RUNNABLE), or known (only engine-owned threads) |
GET /debug/barriers
A JSON snapshot of commit-pipeline state, designed to answer "which commit is stuck, at which phase, and what is blocking it?" from a single call. The response includes a derived phase field summarising the pipeline state at a glance (for example IN_TX_COMMIT, AWAITING_LANE_ACKS, or IDLE).
Related
- Runtime → REST API — narrative guide to the endpoints with curl examples.
- Health checks — the health-indicator system behind
/health/*. - Metrics — the meters exposed at
/metrics. - Configuration reference — the
runtime.http.*,runtime.metrics.*, andruntime.endpoints.*keys. - Kubernetes and Probes — wiring the probes and choosing which endpoints to expose.
Configuration reference
Curated reference of the StoatFlow configuration keys — stoatflow.* (engine) and runtime.* (HTTP, metrics, health) — with type, default, and a one-line description per key.
Gradle plugin reference
The io.stoatflow convention plugin — the full stoatflow { } extension DSL, the plugins and JVM flags it applies, the tasks it contributes, and the Docker and native-image defaults.