Skip to content
Registry StackDocsDevelopment (unreleased)

Operate the Adapter

For the operator

View as Markdown

If you run the Registry Adapter for an institution, this page covers what you do after the configuration is reviewed: install the binaries, give the facade’s database role its grants, and run an ingestion job through initialisation, preview, bounded passes, upgrade, and held items. The Adapter has two runtime shapes. The facade (adapter serve) serves a declared API over an existing source. The ingestion job host (adapter-job) reads bounded source pages and delivers each reviewed projection to a Base Registry Engine (BReg) Action or to a Coordinator workflow. The job commands use the maintained KoboToolbox job example as the worked case.

The adapter runtime and the adapterctl author tool are published with each Registry Stack release for Linux amd64, Linux arm64, and macOS arm64. Download them from the latest release and check them against the release SHA256SUMS. Linux assets are executables named <binary>-<tag>-linux-<arch>. macOS assets are .tar.gz bundles that carry the executable, its AWS-LC-FIPS libraries, and notices. There is no Adapter container image; build one from the repository if you need it.

Authenticate the checksum bundle as release/VERIFY.md at the tag you install describes, then install the binaries with the release-pinned installer or as an rstack component:

Terminal window
bash adapter-<tag>-install.sh
adapterctl --version
rstack install adapter
rstack adapter check --help

The installer puts the two binaries in ~/.local/bin; set ADAPTER_INSTALL_DIR to change that. rstack install adapter installs the same two binaries into an rstack generation, and rstack adapter runs adapterctl. Neither path needs a Rust toolchain.

adapter-job, the governed-ingestion job host, has no numbered-release asset or installer path. You build it from a reviewed source checkout (see Build the job host).

The facade journals every request and, when it serves a write, keeps idempotency state in PostgreSQL. Serving needs TLS to PostgreSQL, even on loopback: database.testOnlyPlaintext is refused outside test builds. Without a configured root, the system roots verify the server. When the certificate comes from a private CA, name that CA with database.caBundleRef.

adapter serve migrates through database.migrationUrlRef and serves through database.runtimeUrlRef. The migration role owns the tables. Give the runtime role only the grants its deployment uses. The Adapter refuses a runtime role at startup, naming each missing grant and table, before it listens. In the statements that follow, adapter stands for the schema on the runtime role’s search path and runtime for that role:

-- Every deployment: append journal events, run audit.retentionDays, report readiness.
GRANT USAGE ON SCHEMA adapter TO runtime;
GRANT INSERT, SELECT, DELETE ON adapter_journal_events TO runtime;
GRANT SELECT ON adapter_schema_migrations TO runtime;
-- A deployment that serves any write: idempotent claims, response custody and the expiry sweep.
GRANT SELECT, INSERT, UPDATE, DELETE
ON adapter_idempotency_entries, adapter_idempotency_resumes TO runtime;
-- A deployment that declares asyncCompletion or a resumable write: the artifact fence.
GRANT SELECT, INSERT, UPDATE ON adapter_idempotency_async_artifacts TO runtime;
-- A deployment that declares a resumable write: its checkpointed identifiers.
GRANT SELECT, INSERT ON adapter_idempotency_resume_bindings TO runtime;

The runtime role needs no grant on adapter_idempotency_schema_migrations; only the migration role reads it.

An ingestion job reads one bounded source page per pass and sends each reviewed projection to one chosen destination. The job store keeps item identity and progress, never source payloads. This section runs the maintained KoboToolbox job example as a controlled pilot.

The maintained KoboToolbox pack has synthetic fixture coverage only, and no run record is published. Treat the pack, the Coordinator job, and the hook job as unverified until your own pilot repeats them. Adapter job packs states the remaining limits.

Build an independently runnable adapter-job binary from the reviewed Registry Stack source checkout. Build with exactly one destination feature for the chosen job, plus job-hook for the hook job:

  • direct-breg for job.yaml and job-runtime.example.yaml.
  • signed-coordinator-event for job.coordinator.yaml and job-runtime.coordinator.example.yaml.
  • job-hook,direct-breg for job.hook.yaml and job-runtime.hook.example.yaml; the hook job needs job-hook beside its destination feature.

A source needs its own feature as well: job-file, job-postgres, job-sftp, or job-rabbitmq. A default build delivers nowhere and reads from no local source. From the reviewed checkout root, build the selected features into a dedicated target directory:

Terminal window
CARGO_TARGET_DIR="<absolute-build-dir>" PATH="$HOME/.cargo/bin:$PATH" \
cargo build --locked --release \
-p registry-adapter-job \
--features "<direct-breg-or-signed-coordinator-event>"

Keep the workspace FIPS crypto configuration enabled. Install the binary with the exact runtime libraries that build produced. On macOS, follow the source checkout’s CONTRIBUTING.md procedure for the exact AWS-LC FIPS dynamic library rather than copying a library selected by a path pattern. A successful Cargo build alone does not establish that the installed binary can find its runtime libraries.

Prepare the store, the source, and the destination

Section titled “Prepare the store, the source, and the destination”

Provision a dedicated PostgreSQL database, schema, and role outside adapter-job. The command does not create or drop a database, schema namespace, role, or grant. The role named by store.runtimeUrlRef must connect over verified TLS, create and alter the job tables, and perform the runtime reads and writes. The same reference serves the job and applies compatible migrations, so the role retains data definition authority. The job runtime does not implement separate migration and serving roles.

Prepare the source and one destination:

  1. Confirm the KoboToolbox deployment matches the remaining limits that Adapter job packs states, including stable _id, changing _uuid, sorted keyset reads, edit discovery, and form size.
  2. Bind kobo-api to the selected form’s /api/v2/assets/<asset-uid>/data URL and give the job a source account restricted to that form. Bind that account’s API token through the credential’s tokenRef (secret:env/KOBO_TOKEN in the examples), not its password, because a Kobo password also signs in to the web UI.
  3. For the direct job, configure the reviewed BReg Action, mapping, ingestion access profile, and narrowly scoped BReg credential. The kobotoolbox-breg example is the BReg project that matches the job’s mapping and access profile.
  4. For the Coordinator job, configure the reviewed event trigger and workflow, provision its signing key, and keep the host clock within 30 seconds of Coordinator’s.

Choose one destination before the first pass. Do not run both jobs against one form, and do not fall back from a refusal to the other destination.

Copy the kobotoolbox-job example into the deployment’s configuration workspace. Select one pair and use the same pair in every command:

  • Direct BReg Proposal: job.yaml and job-runtime.example.yaml.
  • Coordinator workflow: job.coordinator.yaml and job-runtime.coordinator.example.yaml.

Replace the synthetic origins, identifiers, scopes, and mappings with reviewed deployment values. The reusable pack stays outside the example directory, in the kobotoolbox pack of the reviewed checkout. Pass the example’s profile.yaml and project.yaml explicitly because the binary otherwise looks beside the pack.

Keep credentials and database URLs outside every YAML file. The runtime accepts environment secret references such as secret:env/ADAPTER_JOB_DB; inject the referenced values through the service manager or the deployment’s secret facility. Do not paste secret values into commands, shell history, checked files, logs, or review records.

The commands that follow use these placeholders:

  • <job-file> is the selected absolute job path.
  • <runtime-file> is its matching absolute runtime path.
  • <example-dir> is the absolute deployment copy of the example.
  • <source-checkout> is the reviewed Registry Stack checkout used for the build.

Initialise the existing PostgreSQL database before a preview or an observational command:

Terminal window
adapter-job init-store --runtime "<runtime-file>"

init-store requires only --runtime; it needs no job, pack, profile, or project. CLI-wide flags remain accepted, but initialisation output stays value-free. The command parses the complete runtime document, resolves only the store connection and the optional store trust reference, and applies the embedded schema versions 100 through the highest this release supports, under the migration lock. Run status before init-store to see which version applies. The command is idempotent and creates no job-state or item row. It does not resolve source or destination credentials and causes no source or destination effect.

If the store is missing or behind, status, inspect, and pass --dry-run refuse and name init-store; they never migrate the store themselves. If init-store cannot connect or migrate, correct the PostgreSQL authority, the TLS trust, or the referenced secret, then rerun the same command.

Compile the exact deployment artifacts and preflight the source credential:

Terminal window
adapter-job check "<job-file>" \
--pack "<source-checkout>/products/adapter/packs/kobotoolbox/pack.yaml" \
--runtime "<runtime-file>" \
--profile "<example-dir>/profile.yaml" \
--project "<example-dir>/project.yaml"

check does not contact KoboToolbox or activate the destination credential. A successful check establishes that the files compile together, not that the source or the destination is reachable.

Read the fresh store before any pass:

Terminal window
adapter-job status "<job-file>" --runtime "<runtime-file>"

A fresh initialised store reports zero item counts and is not overdue. The read creates no job row.

Run one preview against the actual KoboToolbox source:

Terminal window
adapter-job pass "<job-file>" \
--pack "<source-checkout>/products/adapter/packs/kobotoolbox/pack.yaml" \
--runtime "<runtime-file>" \
--profile "<example-dir>/profile.yaml" \
--project "<example-dir>/project.yaml" \
--dry-run

The preview reads one bounded source page, delivers nothing, and writes no lease, item, position, or schedule state. Output omits projected values by default. Do not add --show-values to an operational run unless the projected personal data has an approved destination and handling procedure.

The preview is not a source snapshot. Run the first real pass promptly after you review the preview, and account for source edits between the two reads.

Run one bounded operational pass by removing --dry-run:

Terminal window
adapter-job pass "<job-file>" \
--pack "<source-checkout>/products/adapter/packs/kobotoolbox/pack.yaml" \
--runtime "<runtime-file>" \
--profile "<example-dir>/profile.yaml" \
--project "<example-dir>/project.yaml"

One bounded pass is the default; there is no --once flag. The pass reads at most one page, records item outcomes, and moves the source position only after the page settles under the job’s acceptance and refusal policy. A stopped pass exits unsuccessfully and leaves the position unchanged.

After each pilot pass, inspect the aggregate state:

Terminal window
adapter-job status "<job-file>" --runtime "<runtime-file>"

Inspect a specific item when status reports a refusal or a hold:

Terminal window
adapter-job inspect "<job-file>" --runtime "<runtime-file>" --key "<item-key>"

status and inspect are observational. They do not retry, release, accept, acknowledge, or migrate anything. Resolve a BReg outcome in BReg, or a Coordinator Run and its linked review in their owning products. The Adapter row remains held, and an unchanged held item remains skipped.

The reports contain no source payload by default, but item identifiers and destination references remain operational data. Protect the reports, and do not put item keys into shared logs or tickets.

KoboToolbox edits can remain behind the saved keyset position, so the maintained route declares a periodic rescan. To request one rescan from the first page, run:

Terminal window
adapter-job rescan "<job-file>" \
--pack "<source-checkout>/products/adapter/packs/kobotoolbox/pack.yaml" \
--runtime "<runtime-file>" \
--profile "<example-dir>/profile.yaml" \
--project "<example-dir>/project.yaml"

An ordinary rescan writes the due marker and runs one pass. Unchanged items skip by digest, refused items retry, and held items remain held while unchanged. An item refused on the retry of a lost answer may already be admitted, so the rescan does not send it again under a new key: it is held as adapter.job.revised-item, or sent to destination.revisedReceiver when a Coordinator job names one. An item whose revised event may already be admitted is sent only to the same revised receiver with the same body. A changed receiver or body stops the rescan as adapter.job.coordinator-receiver-changed or adapter.job.coordinator-body-changed before any request; restoring the previous receiver and job definition lets the item settle.

For a long-running process driven by the job’s interval trigger, run:

Terminal window
adapter-job pass "<job-file>" \
--pack "<source-checkout>/products/adapter/packs/kobotoolbox/pack.yaml" \
--runtime "<runtime-file>" \
--profile "<example-dir>/profile.yaml" \
--project "<example-dir>/project.yaml" \
--loop

Use either one scheduler that invokes bounded passes or one --loop process for a job, not both. SIGTERM (what systemctl stop, docker stop, and Kubernetes send) and Ctrl+C stop the loop the same way. A loop that is waiting exits at once with status 0. The process stops after its listeners drain. The metrics listener and the hook ingress each wait at most 10 seconds for open connections, then close them and log the cut-off. A stalled client never changes the exit status. A pass already in progress finishes first (it ends at its page deadline at the latest), releases its lease, and then the process exits with status 0. Give the supervisor a stop timeout longer than the job’s pageDeadlineMilliseconds: a process killed earlier leaves its lease to expire before a restart can pass.

A loop whose job store stops answering (a PostgreSQL restart or failover) does not exit. It prints adapter.job.store-unreachable cause=<token> on stderr, where the token is a SQLSTATE such as sqlstate-57P01 or a condition such as connection-closed, and reads the store again after one delay.

Stop the scheduled or looping job before you change its binary or configuration.

Before upgrading a store older than schema 103, drain first. Run passes with the current binary until adapter-job status lists no pending items, and take a database backup. A signed delivery left pending from before schema 103 has no recorded receiver or body identity, so the new binary stops it as adapter.job.coordinator-identity-unrecorded before any recipient call. The recovery is to restore that backup, settle the item with the previous binary, and upgrade again. Drain a direct BReg job the same way, and take a backup, before upgrading from a binary whose stored receiver identity did not include the client assertion audience: this binary’s receiver identity includes it, so an item left pending stops as adapter.job.breg-receiver-changed before any BReg call, and no configuration clears it. The new init-store moves the store to schema 104, which the previous binary refuses, so the recovery is the same: restore that backup, settle the item with the previous binary, and upgrade again. Run the new binary’s init-store once before you restart passes. Compatible embedded transitions serialise under the migration lock and can be repeated safely. An older binary refuses a store whose schema is newer than that binary supports.

Pre-1.0 formats can change without a compatible transition. If a source build cannot migrate an older store, retain the existing database and its backups, provision a separate fresh database, and make an explicit migration or fresh-install decision. Do not drop, truncate, or reset the retained store as a recovery step.

Settle pending items before you change job.version or the projection. A pending signed event keeps the body it was first attempted with, so a pass that would now build a different body stops as adapter.job.coordinator-body-changed before any recipient call, because a new body could start a second Run. adapter-job status lists the pending keys. Restore the previous job definition, let passes settle those items, then ship the change. A changed receiver stops as adapter.job.coordinator-receiver-changed instead; restoring the original receiver recovers it.

A direct BReg job fences the same way, and the recoveries are the same:

  • adapter.job.breg-body-changed: the mapped operation differs.
  • adapter.job.breg-receiver-changed: another BReg binding, base URL, token endpoint, caller, client assertion audience, TLS trust profile, access profile, Action, or mode. The exception is an item left pending by a previous binary whose stored receiver identity did not include the client assertion audience: no configuration clears its stop (see the upgrade steps above).
  • adapter.job.breg-identity-unrecorded: the item was staged before schema 103.

Removing destination.revisedReceiver from a Coordinator job does not stop: a possibly admitted item then has no receiver and is held as adapter.job.revised-item, even when its revised event was sent and that answer lost. Restoring the receiver does not resend a held item, so check Coordinator for that Run before you resolve the hold.

A pass that stops as adapter.job.identity-migration-required found stored items that predate the job’s item-identity binding (store schema 103). Confirm the job definition is the one you intend to run, stop any running pass or loop, then run adapter-job rebind-identity <job.yaml> --pack <pack> --runtime <runtime> once. The command binds the current identity and keeps the stored items. It prints a JSON receipt on stdout and an adapter.job.identity-rebound audit line on stderr. The next pass reads the current identity’s items as new, so source rows can be delivered again. To keep the old identity instead, restore the previous job definition. pass --dry-run shows the same stop before it reads a page.

The job store keeps no audit row for the rebind. The audit line and the receipt are the only record, so send both to your log pipeline and retain them as you would any other operator change record.

A new process reloads secret material behind the same environment reference. Restoring trusted material behind the same reference is corrected-material recovery: a later pass retains the pending item’s identity. This mechanism does not establish valid-to-valid issuer key rotation, overlap, old-key revocation, or provider token lifetime behaviour. Plan those rotations with the source or destination provider, and verify them in the controlled pilot before you retire the predecessor credential.

Each source reads its credential through a secret reference, and the sources pick up a rotated secret differently:

SourceWhen the reference resolvesAfter a rotation
FileNo credentialNothing to rotate
SFTPOn every readThe next read uses the new secret
PostgreSQLOnce, when the job host activates the source, into the source’s poolRestart the job host; the pool keeps signing in with the old password until then
RabbitMQOnce, when the job host activates the sourceRestart the job host; reconnects reuse the activation-time secret

Rotate by publishing the new secret, then restart the job host for a PostgreSQL or RabbitMQ source. A rerun after a restart is safe, because the cursor and the item store carry the progress.

An asynchronous write is polled only at the source origin it was sent to; see Asynchronous writes. Rotating a source credential needs no care. Change the baseUrl of an endpoint that an asynchronous write, status or uncertainty route reaches only after that operation’s writes have settled: an unfinished write is otherwise held and never polled. Its status link answers the stored 202, a same-key retry answers 409 without Retry-After, and the facade logs a value-free warning for each held poll. Restore the original baseUrl to let held writes finish, or let them expire. Let async writes settle before upgrading; rows written by an earlier version are quarantined and expire.

The job-sftp feature of the job host is read-only. Give it a dedicated source account whose server-side authorisation confines that account to the configured baseDirectory, using a chroot or an equivalent SFTP-server policy. SFTP v3 has no portable atomic open-beneath or no-follow operation: client symlink and canonical-path checks are defence in depth, not the confinement boundary.

Choose exactly one completed-file protocol:

  • completed-name means the producer writes under another name, closes it, then atomically renames the complete bytes into the final candidate name.
  • done-file means the producer removes any stale marker before it replaces a same-name file, writes under another name, closes it, atomically renames the complete bytes into place, then publishes the marker last. This read-only consumer never removes markers. Leaving an old marker while overwriting in place is an unsupported producer protocol, and size, timestamp, or marker rechecks cannot make it safe.

Pin one complete OpenSSH Ed25519 or P-256 public key, and use only secret references for the password or private key. The sftp-source example shows the runtime shape and the producer lifecycle. Ingestion job sources lists the connection settings and the refusal codes.

Each page downloads the whole file, up to maximumFileBytes, within the pollEnrich step’s timeoutMilliseconds. Size that timeout to at least the file size divided by the link bandwidth, and keep the number of pages per file low (a larger maximumRowsPerPage means fewer pages). Otherwise the pass stops with adapter.job.read-timeout, and the next pass starts the same page again.

The job-rabbitmq feature of the job host reads one message at a time with the explicit rabbitmq-json profile and manual source-owned settlement. Production builds require AMQPS with system roots or an operator-captured private CA. Plain AMQP exists only behind the named loopback fixture feature and is not a production runtime option.

Publish immutable events with a unique, stable AMQP message-id. The job key combines the configured namespace with that identity. Its stored digest domain-separates the raw-message revision from the declared projection digest, so neither a changed body nor a reviewed normalisation change can silently skip. Reuse of one identity for changed event bytes or projection is retained as adapter.job.rabbitmq-event-changed and held for an operator; the job neither delivers nor acknowledges it automatically.

Publishers must also set delivery_mode=2 and wait for publisher confirms. The host rejects a delivery without mode 2 to the configured dead-letter queue (DLQ) under adapter.job.rabbitmq-delivery-mode; it cannot tell whether the producer received a publisher confirm. The dedicated source principal needs only the resource-scoped configure, write, and read patterns in the maintained example, not a broker administrative tag.

An acknowledged destination outcome is written to PostgreSQL before the broker delivery is acknowledged. An item-scoped refusal is written before the delivery is rejected without requeue, so the configured durable dead-letter exchange (DLX) and DLQ receive it. Pending, stopped, crashed, and held deliveries remain unsettled and requeue when their channel closes. A held message can therefore remain at the head of a queue and delay later messages; use operational queue partitioning where head blocking is unacceptable. The job stores identity, digest, state, and destination references only, never message payloads or broker credentials. Settlement uses the poll operation’s finite deadline. A timeout is uncertain, keeps the source position safe, and reconnects on a later bounded read. The host does not leave the AMQP client’s detached automatic-recovery loop running.

This source uses AMQP basic.get, which broker prefetch does not govern. maximumOutstandingDeliveries is a local semaphore bound over unsettled deliveries. The AMQP client has already assembled a body before the job can apply its retained-message ceiling, so every authenticated institutional broker must set RabbitMQ’s hard max_message_size no higher than the deployment ceiling. The client does not attest that broker setting. A queue --dry-run refuses before broker acquisition, because AMQP 0-9-1 has no side-effect-free peek and even requeueing can consume a delivery attempt.

The rabbitmq-source example shows the authored endpoint, the strict decoder, the runtime TLS and dead-letter bindings, and the broker-side requirement.

adapter-job status reports aggregate holdGuidance by code. Use adapter-job inspect for the item-level hold, including the stored destinationReference when one exists, the actionOwner, and the static nextAction. These reports are observational: the Adapter has no generic unhold, retry, accept, or acknowledge mutation. A held row remains held, and ordinary passes and rescans skip an unchanged held item. Resolve a BReg outcome in BReg, or a Coordinator Run and its linked review in their owning products.

adapter.job.revised-item holds an item the destination may already have admitted under its key: a source edit after a hand-off that was accepted or whose answer was lost, or a rescan of an item refused on the retry of a lost answer. A Coordinator job that names a receiver for revisions sends such an item there as a revised event instead of holding it. Once that revised event may have been admitted (its answer was lost and its retry refused), a rescan sends it only to the same receiver with the same body; a changed receiver or body stops the pass as adapter.job.coordinator-receiver-changed or adapter.job.coordinator-body-changed before any request. Removing that receiver holds every such item, including one whose revised event was sent and whose answer was lost; restoring the receiver does not resend a held item, so check Coordinator for that Run before you resolve the hold.

This hold is conservative. A refusal of the retry cannot show that the first attempt had no effect, so an item whose first attempt never reached the destination is held the same way: for example, a BReg request that timed out before it arrived, then a retry refused for invalid data. On a direct BReg job, or a Coordinator job without a receiver for revisions, correcting that item’s source record does not deliver it, and no Adapter command releases the hold. Confirm under the destination’s own authority that the first attempt left no effect, then make the registration there, outside the job.

A refusal the destination answered is stored as adapter.job.breg.<word> or adapter.job.coordinator.<word>, where <word> is the destination’s own refusal word. The prefix says which product to ask; the word is the one that product’s documentation uses.

For adapter.job.rabbitmq-event-changed, first establish any possible destination outcome. The broker operator then resolves the old unsettled delivery under approved broker policy. Only after that does the source operator correct immutable-identity and version handling for legitimate later messages. Publishing a new message ID does not clear the old held row or acknowledge its delivery, and that delivery can continue to block the queue head.

A pass that stops as adapter.job.projection-flat-dotted-name read a row whose flat member is named like a dotted projection.fields entry, such as a CSV column headed household.size. A dotted field reads a nested object, so the projection would hand the destination a null. The pass stops before it stages the page instead, and nothing on that page is delivered. Group the columns into a nested object in the route (a setBody that builds {"household": {"size": ...}}), or read a source that delivers the nested object, then run the job again.

Stored items that predate the identity binding

Section titled “Stored items that predate the identity binding”

A pass that stops as adapter.job.identity-migration-required found stored file or SFTP items that predate the job’s item-identity binding (store schema 103), including a legacy raw decoder whose authored semantics did not change. This is a stop, not a held item, and HTTP and PostgreSQL jobs do not receive it. Confirm the job definition is the one you intend to run, stop any running pass or loop, then run adapter-job rebind-identity <job.yaml> --pack <pack> --runtime <runtime> once. It records the job’s current identity and keeps the stored items and the cursor, so the next pass reads source rows as new and can deliver them again. The rebind refuses only while a pass holds the job lease; it does not check for held items or items marked as possibly admitted (admittedBefore in inspect), so settle those under the destination’s own authority before you rebind. The host never infers identity from stored keys, rewrites rows, or resets the cursor automatically. To keep the old identity instead, restore the previous job definition. Upgrade and recover describes the receipt and the audit line.

A pass that stops with adapter.job.page-bytes-bound built a page larger than profile.maximumPageBytes. The cursor does not move, so every later pass stops at the same place until you change the profile. Lower profile.read.maximumRowsPerPage (or the file source’s maxMessagesPerPoll) so a page fits, or raise profile.maximumPageBytes, which cannot exceed profile.maximumResponseBytes. Then run the job again.

The job checks profile.maximumPageBytes after it builds a page, not while it builds one. A file or PostgreSQL source reads up to maximumRowsPerPage rows before the check runs, so a page can be larger than the bound in memory before the pass stops. The real memory ceiling is therefore maximumRowsPerPage * maximumRowBytes: size those two members, not only maximumPageBytes, to the memory you can spare. The stop report prints the same fix as its next step.

Neither the facade listener nor the hook ingress serves metrics. Set metricsListener.bind in the runtime file to a loopback or private address with a non-zero port. In a container, declare metricsListener.networkExposure: container-private to bind 0.0.0.0; see Scrape metrics from a container. It answers GET /metrics in the Prometheus text format without authentication, so keep it inside the scraper’s network. Without the key, no metrics are served. A public address, or the socket of the facade listener or the hook ingress, is refused when the runtime file is read.

The facade serves its metrics from adapter serve. The job host serves them only while adapter-job pass --loop runs, because a bounded pass exits before a scraper could read it. Counters start at zero when the process starts. No label carries a record key, a principal, a path parameter, an error message, or a source name.

Facade series:

SeriesTypeLabelsMeaning
adapter_http_requests_totalcounterroute (route template, or unmatched), method, status (1xx, 2xx, 3xx, 4xx, 5xx, other)Answered facade requests.
adapter_upstream_failures_totalcounterclass (upstream, upstream.http, upstream.timeout, upstream.connection, upstream.malformed, upstream.too-large, upstream.redirect, breaker.open, throttle.rejected, credential.rejected, egress.refused)Calls to the source that failed, by error class. It counts failed exchanges, status polls, bounded-wait polls and recovery checks.
adapter_journal_write_failures_totalcounternoneAudit journal writes that failed, so the exchange answered an internal error. Custody and rendering failures are not counted here.
adapter_retention_sweep_failures_totalcounterstore (journal, idempotency, other)Retention sweep batches that failed and were left to the next tick.

Job host series:

SeriesTypeLabelsMeaning
adapter_job_itemsgaugestate (pending, acknowledged, refused, held)Items in the job store by state. The read runs in a read-only transaction whose server-side statement timeout is the time left of one 5 second scrape deadline, so the server cancels a slow count, and a result is reused for 5 seconds.
adapter_job_last_successful_pass_age_secondsgaugenoneSeconds since a pass in this process settled its page. Absent until the first such pass.
adapter_job_pass_failures_totalcounterreason (page-fault, destination-stop, refusal-limit, store-unreachable)Passes that did not settle, and passes that could not reach the store. A pass that finds another process holding the lease is not a failure and is not counted.
adapter_job_hook_refusals_totalcounterreason (not-found, method, unauthenticated, rate-limited, unavailable, body-timeout, body-too-large, body-unreadable)Hook requests the ingress refused.
adapter_job_gauge_sample_failures_totalcounternoneItem count reads that failed or timed out.

When the store cannot be read at scrape time, adapter_job_items carries no samples and adapter_job_gauge_sample_failures_total rises. It never reports zero for an unread store. The job has no retention sweep, so a pass that cannot reach the store (store-unreachable) is the equivalent signal. A rising held count is a prompt to follow Resolve held job items. The metrics are read-only: they release, accept, and acknowledge nothing.