Registry stack documentation: machine-readable Markdown.
Index of all pages: https://docs.registrystack.org/llms.txt
Full corpus: https://docs.registrystack.org/llms-full.txt

# Find and clear stuck work

> Where stuck, held, failed, and overdue work shows up in each Registry Stack product, how to clear it today, and example Prometheus alert rules for the metrics that exist.

Use this page when something has not finished and you need to know where to look and what you can do about it.
It goes product by product.
For each one it names the signal that shows the work and the command or route that clears it.
It also says whether that action needs access to the host.
Where a product gives you no way to clear something, it says so.

## Two kinds of access

Only Coordinator offers operator actions over HTTP with an operator token.
`coordinatorctl` calls that API with `--url` and `--token-file`, so you can run it from any machine that can reach the service.

Every other product clears work with its own control command on the host.
These commands open PostgreSQL directly with `--runtime-config`, so they run where the runtime file and the database credentials are.
Treat that access as an operator privilege and keep it off shared laptops.

Metrics are served on a separate listener from the API.
Bind it to loopback or a private interface and scrape it from there.
Gauges that count queued work are read from the database at scrape time.
When the database cannot answer, the series is omitted rather than reported as zero.
Alert on a missing series as well as a high value.

{/* Evidence: crates/registry-coordinator/src/metrics.rs, coordinator_dispatch_jobs;
    crates/registry-coordinator/src/cli.rs, DeploymentStatus, RetrySame;
    crates/registry-breg/src/metrics.rs, breg_worker_last_success_age_seconds;
    crates/registry-casework/src/metrics.rs, casework_due_review_tasks. */}

## Coordinator

**Signal.** Run `coordinatorctl status`, `coordinatorctl list --attention`, or `coordinatorctl doctor` against the HTTP API.
The doctor report lists held runs with `heldRunCount`, the oldest due step with `oldestDueAt`, and `uncertain` steps.
It shows the first 100 held runs.
For the full list, run `coordinatorctl deployment-status --runtime-config` on the host.
The metrics series `coordinator_dispatch_jobs` carries a `state` label of `pending`, `leased`, or `unknown`.
Four more gauges show holds and attention, all read from the database at scrape time:

- `coordinator_runs_attention{reason}` counts runs needing attention, with `reason` of `definition-refused` or `other`.
- `coordinator_runs_restore_review_required` counts runs held for review after a restore.
- `coordinator_hold_active{hold}` is 1 while the `restore` or `admissions` hold is set.
- `coordinator_metrics_sample_failures_total{sample}` counts scrapes where the dispatch queue or the held-work gauges could not be read.
- `coordinator_oldest_due_age_seconds` is how long ago the oldest pending step was due, counting only steps the worker can claim.
  Runs a worker cannot claim, such as runs waiting for restore review or with a refused definition, are not counted.
  Read `coordinator_runs_attention` and `coordinator_hold_active` beside it.

**Clear.**

- `coordinatorctl inspect --run` shows one run before you act.
- `coordinatorctl retry-same`, `coordinatorctl reconcile`, and `coordinatorctl cancel` each take `--run` and `--reason`.
- `coordinatorctl check-now` takes `--run` and `--step` and reads a waiting step now.
- `coordinatorctl release-restore-hold`, `coordinatorctl release-admission-hold`, and `coordinatorctl complete-execution-recovery` lift the matching hold.
- `coordinatorctl retain` erases ended payloads, with `--before` and `--limit` (default and maximum 100).

A run held as `definition-refused` cannot be ended with retry-same, reconcile, or cancel.
The service answers 409 `run.definition-incompatible`.
Fix the definition and apply it instead.

**Access.** HTTP with an operator token for everything above except `deployment-status`, which needs the host.

**Read more.** [Held runs](../coordinator/#held-runs), [Recover a run](../coordinator/#recover-a-run), [Watch metrics](../coordinator/#watch-metrics).

{/* Evidence: crates/registry-coordinator/src/http.rs, retry-same and restore-hold routes;
    crates/registry-coordinator/src/cli.rs, Command, CheckNow and Retain;
    crates/registry-coordinator/src/metrics.rs, coordinator_dispatch_jobs. */}

## Base Registry Engine (BReg)

**Signal.** Four sources, all on the metrics listener unless noted.

- `breg_worker_last_success_age_seconds{worker}` is the age of each background worker's last success.
  The `worker` label is one of `hook`, `record-timer`, `attachment-verification`, `review`, `subject-access-log-retention`, `external-projection-retention`, or `external-refresh`.
  A worker that has not yet succeeded has no series.
- `breg_queue_oldest_pending_age_seconds{queue}` is the age of the oldest pending item in `hook-delivery`, `review-submission`, or `review-application`.
- `breg_proposal_application_blocked_jobs` counts Proposal applications that cannot proceed.
- `breg_record_timer_oldest_due_lag_seconds` is how long the oldest due Record timer has waited.
  `breg_record_timer_control_compatible` is 0 when the timer protocol does not match this process.
- `breg_hook_deliveries{state}` counts webhook deliveries in `pending`, `leased`, `delivered`, `dead-lettered`, or `expired`.
  Retention deletes delivered and expired rows, so watch the first three.
- `breg_ingestion_runs{state}` counts durable ingestion runs in `open`, `complete`, `cancelled`, or `blocked`.
- `breg_metrics_sample_failures_total{sample}` counts scrapes where a database sample failed.
  The `sample` label is `queue`, `record-timer`, `hook-delivery`, or `ingestion-run`.
- `bregctl status` and `bregctl doctor` take `--runtime-config`.
  Doctor reports `external-refresh.status` and `external-projection.status`.

**Clear.** All of these take `--runtime-config` and run on the host.

- Webhook deliveries: `bregctl hook list`, `hook drain`, `hook replay`, and `hook discard`.
  Replay and discard take `--event-id`, `--delivery-id`, and `--expected-generation`.
- Review recovery: `bregctl` review recovery subcommands resubmit a review, close one the authority lost, or retry its application.
- Import windows: `bregctl import-authority list`, `open`, `close`, and `close-expired`.
- Record timers: `bregctl timer status`, `list`, `show`, `retry`, `pause`, and `resume`.
  Retry takes `--occurrence-id`, `--expected-attempt-count`, `--operator-reference`, and `--reason`.
  Pause and resume take `--expected-control-epoch`, `--operator-reference`, and `--reason`.
- Durable ingestion runs: `bregctl data runs list` and `data runs cancel` go over HTTP, and only the creator of a run can use them.

**Access.** Host with `--runtime-config` for everything except `data runs`.
BReg has no operator token API for the rest.

**Read more.** [Watch the background workers](../breg-monitor/#watch-the-background-workers), [Scrape metrics](../breg-monitor/#scrape-metrics), [Recover a blocked Proposal](../breg-changes/#recover-a-blocked-proposal), [Inspect and recover deliveries](../breg-webhooks/#inspect-and-recover-deliveries), [Recover a run](../breg-data/#recover-a-run), [Operate Record timers](../breg/#operate-record-timers).

{/* Evidence: crates/registry-breg/src/metrics.rs, ProgressWorker, PendingQueue and breg_proposal_application_blocked_jobs;
    crates/registry-bregctl/src/lib.rs, HookCommand, ReviewRecoveryCommand, ImportAuthorityCommand;
    crates/registry-bregctl/src/timer_operator_lifecycle.rs. */}

## Registry Evidence

**Signal.** Evidence keeps no queue of work, so nothing is stuck inside it.
The signals show a failing dependency instead.

- `evidence_source_requests_total{source,outcome}` counts calls to each governed source.
  Outcomes other than `success` are failures, for example `timeout`, `transport`, `credential`, and `rate-limited`.
- `evidence_signer_requests_total{signer,outcome}` does the same for the signer.
- `evidence_source_shape_drift_total{source}` rises when a source starts answering in a shape the bundle does not describe.
- `evidence_rate_limiter_tracked_keys` rises toward its ceiling of 100,000 keys.
- With OID4VCI enabled, `evidence_oid4vci_store_entries` approaches `evidence_oid4vci_store_capacity`, and `evidence_oid4vci_outcomes_total{outcome}` counts `store-saturated` and `store-fault`.
- `evidencectl doctor --runtime-config` is a preflight of the runtime file and, with `--require-audit-under`, of the audit path.
  It reports readiness and does not list work.

**Clear.** There is nothing to clear.
Evidence has no operator HTTP API and no command that releases work.
Fix the source or signer, and callers retry.
Readiness does not depend on sources, so `/ready` stays green while a source is down.
Use the metrics.

**Access.** Host for the preflight. No operator API.

**Read more.** [Preflight the audit path](../evidence-audit/), [OID4VCI metrics](../../configure/evidence-oid4vci/#metrics).

{/* Evidence: crates/registry-evidence/src/observability/golden-scrape.txt;
    crates/registry-evidence/src/observability.rs, evidence_source_shape_drift_total;
    crates/registry-evidence-oid4vci/src/observability.rs, evidence_oid4vci_store_capacity;
    crates/registry-evidencectl/src/runtime.rs, DoctorArgs. */}

## Registry Casework

**Signal.**

- `casework_open_review_requests` and `casework_open_review_tasks` count open work.
- `casework_due_review_tasks` counts open tasks past their due time.
  It is the overdue signal.
- `casework_database_up` is 0 when the database cannot answer the review counts.
- `casework_metrics_sample_failures_total{sample}` counts each read of the review counts or the completion backlog that failed.
- `casework_completion_deliveries{state}` counts completion deliveries in `pending`, `retrying`, `leased`, `unknown`, `dead-lettered`, or `expired`.
- `casework_completion_oldest_undelivered_age_seconds` is how long the oldest undelivered completion has waited.
- `caseworkctl status` and `caseworkctl doctor` take `--runtime-config`.
- The metrics listener also serves `/version`.

**Clear.** Supervisors move overdue tasks over HTTP with their own credentials.
The routes are `POST /v1/review-tasks/{task_id}/assign`, `release`, `claim`, and `delegate`.
`GET /v1/review-tasks/supervision` lists tasks for a supervisor.
A producer withdraws a request with `POST /v1/review-requests/{request_id}/cancel`.
These are caller actions under a role, not an operator token API.

A dead-lettered completion delivery shows in `casework_completion_deliveries`, but Casework has no command or route to retry or discard it.
The row stays in the database.
See the retention guide for what is kept.

**Access.** HTTP with a caller credential for tasks and requests. Host for `caseworkctl`.

**Read more.** [Scrape metrics and the running version](../casework/#scrape-metrics-and-the-running-version), [Check readiness with doctor](../casework/#check-readiness-with-doctor), [Troubleshooting](../casework/#troubleshooting), [Casework retention](../casework-retention/).

{/* Evidence: crates/registry-casework/src/metrics.rs, casework_due_review_tasks;
    crates/registry-casework/src/http.rs, review-tasks routes;
    crates/registry-caseworkctl/src/lib.rs, OperatorArgs;
    crates/registry-casework/src/runtime/completion.rs, dead_lettered_at. */}

## Registry Messaging

**Signal.**

- `messaging_dispatch_jobs{state}` with `state` of `pending`, `leased`, or `unknown`.
  `unknown` means a provider attempt whose outcome is not known.
- `messaging_provider_attempts_total{outcome}` counts `accepted`, `transient`, `permanent`, and `maybe-sent`.
- `messaging_provider_callbacks_total{outcome}` counts callbacks, including `unmatched` and `ambiguous`.
- `messaging_metrics_sample_failures_total{sample}` counts scrapes where the dispatch queue could not be read.
- `messagingctl messages list --status` filters by status, with `--limit` (default 50).

A message whose attempts run out leaves `pending` and becomes `failed`.
With the default retry policy that happens within about 7.5 minutes, before the backlog alert below could fire.
No gauge counts failed messages, so alert on `transient` attempts and list them with `messagingctl messages list --status failed`.

**Clear.** All of these take `--runtime-config` and run on the host.

- `messagingctl messages show` reads one message.
- `messagingctl messages retry` and `messagingctl messages cancel` change a message.
- `messagingctl messages settle --outcome sent` or `--outcome not-sent` records the truth for an unknown outcome.
- The state-changing commands take `--apply`.
- `messagingctl retention erase-expired` erases expired data on demand.

Over HTTP, `POST /v1/messages/{message_id}/cancel` cancels a message with an operator or owner profile.
It works only before dispatch has leased the message.
Otherwise the service answers that dispatch has started or the message is already terminal.

**Access.** Host for retry, settle, and erase. HTTP for cancel before dispatch.

**Read more.** [Operate messages](../messaging/#operate-messages), [Settle an unknown outcome](../messaging/#settle-an-unknown-outcome), [Watch the journal and metrics](../messaging/#watch-the-journal-and-metrics).

{/* Evidence: crates/registry-messaging/src/metrics.rs, messaging_dispatch_jobs;
    crates/registry-messagingctl/src/lib.rs, messages and retention commands;
    crates/registry-messaging/src/http.rs, cancel route. */}

## Registry Scheduling

**Signal.** `schedulingctl intents --runtime-config` lists delivery intents that are undelivered or dead-lettered, with `--limit` (default 50, maximum 200).
Scheduling can also publish metrics on an optional `metricsListener`, which is off by default and must bind a private address.
These series show stuck work:

- `scheduling_outbox_items{state}` counts delivery intents by state, and `scheduling_outbox_oldest_pending_age_seconds` is how long the oldest pending one has been eligible for pickup (its due time, or the end of its last retry back-off).
  An intent waiting out a retry back-off is not counted.
- `scheduling_hook_deliveries{state}` counts observer-hook deliveries by state, and `scheduling_hook_oldest_pending_age_seconds` is the age of the oldest pending one.
- `scheduling_worker_last_success_age_seconds{worker}` is the age of the last completed pass of the `hold-expiry` or `retention` worker.
- `scheduling_metrics_sample_failures_total{queue}` counts scrapes where a queue could not be read.

The operate page lists the states and the other series.
Its probes are `/healthz` and `/readyz`.

**Clear.** Scheduling has no command to retry or discard a dead-lettered delivery.
The list is read-only.
Callers can remove their own holds and cancel their own appointments over HTTP with `DELETE` on a hold and `POST` on an appointment cancel.

**Access.** Host for `intents`. Caller credential for holds and appointments.

**Read more.** [Scheduling operations](../scheduling/), [Watch the metrics](../scheduling/#watch-the-metrics), [Read the deployment](../scheduling/#read-the-deployment), [Retention](../scheduling/#retention).

{/* Evidence: crates/registry-schedulingctl/src/lib.rs, intents;
    crates/registry-scheduling/src/http.rs, healthz and readyz. */}

## Registry Adapter

**Job.** The job reports held work and does not release it.
This is by design, because the action belongs to the product that owns the data.
The signals are:

- `adapter_job_items{state}` counts items in `pending`, `acknowledged`, `refused`, or `held`.
  Held and refused items are the ones that need a person.
- `adapter_job_last_successful_pass_age_seconds` is the age of the last pass this process settled.
  It is absent until the first pass settles.
  A standby process keeps ageing while another process holds the lease, so alert on the youngest age across the processes of one job.
  Passes are due `delayMilliseconds` times `backoffMultiplier` after the last pass at most, and a pass takes its own time on top, so set the threshold well above that gap.
- `adapter_job_pass_failures_total{reason}` counts passes that did not settle.
  The reasons are `page-fault`, `destination-stop`, `refusal-limit`, and `store-unreachable`.
  A standby process that finds the lease held by another process is not counted.
- `adapter_job_hook_refusals_total{reason}` counts refused hook-trigger requests.
- `adapter_job_gauge_sample_failures_total` counts item count reads that failed or timed out. Scrapes served from the cached result do not count again.
  The items gauge then has no samples.

The job serves these only under `adapter-job pass --loop`, on an optional `metricsListener.bind` in its runtime document.
It is off by default and must be loopback or private.
Counters restart from zero with the process.
The commands are:

- `adapter-job status <job> --runtime` shows each held item with the product that owns the action and the next step.
- `adapter-job inspect <job> --runtime --key` shows one item.
- `adapter-job rescan <job> --pack --runtime` makes the job read the source again.
- `adapter-job rebind-identity <job> --pack --runtime` repairs an identity binding.
  It stops a fault and does not release a held item.
- `adapter-job check` and `adapter-job pass` (with `--loop`, `--dry-run`, and `--refusal-limit`) check and run the job.

There is no release or unhold command.
Resolve the held item in the owning product, then let the next pass pick up the change.
It is a source-build binary, so it runs wherever you build it, with host access to its own store.

**Facade.** The facade has no operator surface for stuck work.
`adapterctl` runs offline checks only.
It can publish metrics on an optional `metricsListener.bind`, off by default and loopback or private only:

- `adapter_upstream_failures_total{class}` counts failed calls to a source.
  The classes are `upstream`, `upstream.http`, `upstream.timeout`, `upstream.connection`, `upstream.malformed`, `upstream.too-large`, `upstream.redirect`, `breaker.open`, `throttle.rejected`, `credential.rejected`, and `egress.refused`.
- `adapter_journal_write_failures_total` counts audit journal writes that failed.
- `adapter_retention_sweep_failures_total{store}` counts failed retention sweeps of the `journal`, `idempotency`, or `other` store.
- `adapter_http_requests_total{route,method,status}` counts answered requests.

The operate page has the full table.

**Access.** Host.

**Read more.** [Adapter operations](../adapter/), [Scrape metrics](../adapter/#scrape-metrics), [Check the job](../adapter/#check-the-job), [Rescan or run on the interval](../adapter/#rescan-or-run-on-the-interval), [Resolve held job items](../adapter/#resolve-held-job-items).

{/* Evidence: crates/registry-adapter-job/src/cli.rs, Command;
    crates/registry-adapter-job/src/main.rs, holdGuidance and nextAction. */}

## Registry Documents

**Signal.** `documentsctl verification list`, `documentsctl erasure status`, and `documentsctl erasure list` show pending verification and erasure jobs.
All take `--runtime-config`.
Its probes are `/health` and `/ready`.
With the optional `metricsListener` turned on, Documents also publishes these series on that private socket:

- `documents_verification_jobs{state}` and `documents_erasure_jobs{state}` count jobs by stored state, and `documents_verification_oldest_overdue_age_seconds` and `documents_erasure_oldest_overdue_age_seconds` are how far the oldest pending one is past its due time.
- `documents_hook_deliveries{state}` counts observer-hook deliveries by state, and `documents_hook_oldest_overdue_age_seconds` is how far the oldest pending one is past its due time.
- `documents_worker_last_success_age_seconds{worker}` is the age of the last completed pass of the `cleanup` worker. The other workers have no age, so watch their overdue ages.
- `documents_metrics_sample_failures_total{sample}` counts scrapes where a queue could not be read.
- `documents_http_requests_total{route,method,status}` counts answered requests.

The operate page has the full table.

**Clear.** `documentsctl verification replay` and `documentsctl erasure replay` rerun a job.
They take `--version-id` and `--expected-generation`.
No HTTP route lists or replays jobs.

Hook deliveries have no command.
A pending delivery pins its destination binding, so moving a hook needs the steps in the operate guide.

**Access.** Host.

**Read more.** [Deploy and operate the Document Store](../documents/) covers replaying a stuck verification, removal and erasure, moving a hook, and watching the metrics.

{/* Evidence: crates/registry-documentsctl/src/lib.rs, verification and erasure commands;
    crates/registry-documents-core/src/naming.rs, HEALTH_PATH and READY_PATH;
    crates/registry-documents/src/metrics.rs, Metrics and render. */}

## Registry Discovery

Discovery has no stuck work.
It holds no queue, publishes no metrics, and has no operator command.
Its probes are `/health` and `/ready`, and `/ready` is a static answer.
If it misbehaves, rebuild the index and restart it on the new package.

**Read more.** [Restart on the new package](../../configure/discovery/#restart-on-the-new-package), [Maintain the index](../../configure/discovery/#maintain-the-index), [Troubleshooting](../../configure/discovery/#troubleshooting).

{/* Evidence: crates/registry-discovery/src/server.rs, health and ready routes. */}

## Registry Render

**Signal.** `GET /ready` reports `{"status":"ready"}`.
When a seal is configured it adds a `signing` member per seal, `ready` or `not-ready`, with the reason `certificate-expired`, `certificate-not-yet-valid`, or `signer-not-ready`.
Readiness also fails when the audit writer has stopped.
`registry-render check --environment` warns 30 days before a certificate expires.
Render can also publish metrics on an optional `metricsListener`, which is off by default and must bind a private address.

- `render_documents_total{operation,result}` counts calls, with `operation` of `render` or `seal` and `result` of `ok`, `refused`, or `failed`.
- `render_audit_write_failures_total` counts failed audit writes.
- `render_seal_certificate_expiry_seconds{seal}` is the time until each seal certificate stops being valid, negative once it has.

The operate page has the full table.

**Clear.** Render has no work queue and no clearing command.
Renew the certificate and restart.
A seal outage with Transit needs no restart.
A stopped audit writer needs a restart.
`registry-render healthcheck --runtime-config` runs the readiness probe for a supervisor.

**Access.** Host.

**Read more.** [Render operations](../registry-render/), [Watch the metrics](../registry-render/#watch-the-metrics), [Read readiness](../registry-render/#read-readiness), [Renew the certificate](../registry-render/#renew-the-certificate), [Keep the audit file](../registry-render/#keep-the-audit-file).

{/* Evidence: crates/registry-render/src/server.rs, ready and healthcheck;
    crates/registry-render/src/cli.rs, Healthcheck and environment. */}

## Scrape metrics from a container

A container often does not know its private address when you write the runtime file, so a loopback or private `metricsListener.bind` cannot be written down.
Declare the placement instead.
Add `metricsListener.networkExposure: container-private` and bind the wildcard address.
Coordinator names the key `deployment.metricsListener`.
Every other refusal still holds: a public, link-local, multicast or IPv4-mapped address, port `0`, and the service's own socket stay refused.
The key is accepted by Registry Evidence and its OID4VCI and OID4VP services, BReg, Casework, Messaging, Scheduling, Render, Adapter, Documents and Coordinator.

With Docker Compose, put Prometheus on the same Compose network and do not publish the metrics port:

```yaml test-skip="illustrative fragment"
# runtime.yaml
metricsListener:
  bind: 0.0.0.0:9091
  networkExposure: container-private
```

```yaml test-skip="illustrative fragment"
# compose.yaml: no ports entry for 9091
services:
  casework:
    networks: [registry]
  prometheus:
    networks: [registry]
    # scrape target: casework:9091
networks:
  registry: {}
```

On Kubernetes, bind the pod address from the downward API, or use `container-private`.
Bind the pod address only when it is in a private range. Write an IPv6 pod address in brackets (`[fd00::5]:9091`).
`container-private` allows only the unspecified address, so a pod address outside the private ranges is refused. In that case bind `0.0.0.0` with `container-private` and keep the port off every public route.
Substitution is allowed in operator files, so the runtime file can read `${POD_IP}` (see CFG-SEC-2 in the configuration conventions):

```yaml test-skip="illustrative fragment"
metricsListener:
  bind: ${POD_IP}:9091
```

```yaml test-skip="illustrative fragment"
env:
  - name: POD_IP
    valueFrom:
      fieldRef:
        fieldPath: status.podIP
```

Publishing the metrics port or running the container on the host network exposes the counts on the host, and the counters carry no authentication.

{/* Evidence: crates/registry-platform-config/src/metrics_bind.rs, check_metrics_bind_address;
    crates/registry-platform-config/src/blocks.rs, MetricsListenerConfig. */}

## Scrape the metrics listeners

Each product serves `/metrics` on its own `metricsListener`, so give each product its own scrape job.
The Adapter facade (`adapter serve`) and the Adapter job host (`adapter-job pass --loop`) are separate processes, so each is its own scrape target.
The Evidence protocol services, OID4VCI and OID4VP, are also separate processes with their own targets.
No product has a default metrics port.
The ports below are the examples on each product's operate or reference page, and the addresses are examples.
Use the `bind` you set in each runtime file.
The Evidence and Adapter pages show no example port, so the ports for those jobs are placeholders.

```yaml
global:
  scrape_interval: 30s
  # Sampled gauges stop reading after 5 s, so 10 s leaves room for the rest of the scrape.
  scrape_timeout: 10s

scrape_configs:
  - job_name: coordinator
    static_configs: [{targets: ["10.42.0.5:9108"]}]
  - job_name: breg
    static_configs: [{targets: ["10.42.0.6:9464"]}]
  - job_name: casework
    static_configs: [{targets: ["10.42.0.7:9100"]}]
  - job_name: messaging
    static_configs: [{targets: ["10.42.0.8:9107"]}]
  - job_name: scheduling
    static_configs: [{targets: ["10.42.0.9:9105"]}]
  - job_name: documents
    static_configs: [{targets: ["10.42.0.10:9116"]}]
  - job_name: render
    static_configs: [{targets: ["10.42.0.11:9108"]}]
  - job_name: adapter
    static_configs: [{targets: ["10.42.0.12:9109"]}]
  - job_name: adapter-job
    static_configs: [{targets: ["10.42.0.14:9109"]}]
  - job_name: evidence
    static_configs: [{targets: ["10.42.0.13:9110"]}]
  - job_name: evidence-oid4vci
    static_configs: [{targets: ["10.42.0.15:9111"]}]
  - job_name: evidence-oid4vp
    static_configs: [{targets: ["10.42.0.16:9112"]}]
```

The listener has no authentication.
Keep every target on a private network that only your monitoring can reach.
The alert rules below do not filter on `job`, so any job names work.
The Adapter job stale-pass rule is the exception to that freedom.
It groups processes by every label except `instance`, so scrape each adapter job under its own `job` name.
If your service discovery adds another per-process label, such as `pod`, add it to the rule's `without` list.

## Example alert rules

These rules use only series that the products publish.
Adjust the thresholds to your volumes.
The `job` label comes from your scrape configuration, so match it to the names you use.

Because a failed database sample omits the series, groups that read gauges from the database include an `absent()` rule.

Where you can clear a dead-lettered item with a command, the rule fires while any are left.
Where no command can clear it, a count above zero would fire until retention erases the item, so the rule fires when the count rises from one minute to the next.
Comparing each minute keeps a retention sweep that erases old items from hiding a new one in the same window.
Check the series itself to see how many are left.
The Scheduling, Documents, and Render groups need their optional `metricsListener` turned on.

Each block below is a separate rule file with its own `groups:` key.
Save each one as its own file and list every file under `rule_files` in `prometheus.yml`.
To keep one file instead, write a single `groups:` key and move each product's `- name:` entry under it.

To cover a new series, add one rule to that product's group.
Keep one `groups` entry per product, with the product name as the `name`.
Adapter has two, one for the facade and one for the job host.

### Coordinator

```yaml
groups:
  - name: coordinator
    rules:
      - alert: CoordinatorUnknownDispatchJobs
        expr: coordinator_dispatch_jobs{state="unknown"} > 0
        for: 5m
        labels: {severity: page}
        annotations:
          summary: A step attempt has an unknown outcome. Reconcile the run.
      - alert: CoordinatorDispatchBacklog
        expr: coordinator_dispatch_jobs{state="pending"} > 0
        for: 15m
        labels: {severity: warn}
        annotations:
          summary: Dispatch jobs have stayed pending. Check the worker and the target service.
      - alert: CoordinatorAuthenticationRefusals
        expr: sum(rate(coordinator_authentication_refusals_total[5m])) > 0.1
        for: 10m
        labels: {severity: warn}
        annotations:
          summary: Callers are presenting credentials Coordinator refuses.
      - alert: CoordinatorRunsFailing
        expr: sum(increase(coordinator_runs_finished_total{state="failed"}[15m])) > 0
        for: 0m
        labels: {severity: warn}
        annotations:
          summary: A run ended in the failed state. List it with coordinatorctl list --attention.
      - alert: CoordinatorRunsNeedAttention
        expr: coordinator_runs_attention > 0
        for: 15m
        labels: {severity: warn}
        annotations:
          summary: Runs need attention. The reason label says whether the definition was refused.
      - alert: CoordinatorRestoreReviewRequired
        expr: coordinator_runs_restore_review_required > 0
        for: 5m
        labels: {severity: page}
        annotations:
          summary: Runs are held for review after a restore.
      - alert: CoordinatorHoldActive
        expr: coordinator_hold_active == 1
        for: 30m
        labels: {severity: warn}
        annotations:
          summary: A restore or admissions hold has stayed set. Release it when recovery is complete.
      - alert: CoordinatorOldestDueJob
        expr: coordinator_oldest_due_age_seconds > 900
        for: 10m
        labels: {severity: warn}
        annotations:
          summary: The oldest due job has waited more than 15 minutes.
      - alert: CoordinatorMetricsSampleFailing
        expr: increase(coordinator_metrics_sample_failures_total[15m]) > 0
        for: 0m
        labels: {severity: warn}
        annotations:
          summary: A database read failed at scrape time. The sample label names it.
      - alert: CoordinatorMetricsAbsent
        expr: absent(coordinator_dispatch_jobs) or absent(coordinator_hold_active)
        for: 10m
        labels: {severity: page}
        annotations:
          summary: Coordinator gauges are missing. The database may be unreachable.
```

### Casework

```yaml
groups:
  - name: casework
    rules:
      - alert: CaseworkDatabaseDown
        expr: casework_database_up == 0
        for: 5m
        labels: {severity: page}
        annotations:
          summary: Casework cannot reach its database.
      - alert: CaseworkOverdueReviewTasks
        expr: casework_due_review_tasks > 0
        for: 30m
        labels: {severity: warn}
        annotations:
          summary: Review tasks are past their due time. A supervisor can reassign them.
      - alert: CaseworkCompletionDeadLettered
        expr: max_over_time((casework_completion_deliveries{state="dead-lettered"} - casework_completion_deliveries{state="dead-lettered"} offset 1m)[15m:1m]) > 0
        for: 0m
        labels: {severity: page}
        annotations:
          summary: A completion delivery was dead-lettered. Casework has no command to retry it, so tell the requester the review finished.
      - alert: CaseworkCompletionExpired
        expr: max_over_time((casework_completion_deliveries{state="expired"} - casework_completion_deliveries{state="expired"} offset 1m)[15m:1m]) > 0
        for: 0m
        labels: {severity: warn}
        annotations:
          summary: A completion delivery expired undelivered, so the requester was not told the review finished.
      - alert: CaseworkCompletionUnknown
        expr: casework_completion_deliveries{state="unknown"} > 0
        for: 15m
        labels: {severity: warn}
        annotations:
          summary: A completion delivery has an unknown outcome.
      - alert: CaseworkCompletionBacklog
        expr: casework_completion_oldest_undelivered_age_seconds > 1800
        for: 10m
        labels: {severity: warn}
        annotations:
          summary: The oldest undelivered completion has waited more than 30 minutes.
      - alert: CaseworkMetricsSampleFailing
        expr: increase(casework_metrics_sample_failures_total[15m]) > 0
        for: 15m
        labels: {severity: warn}
        annotations:
          summary: A Casework metrics sample is failing, so some series are missing.
      - alert: CaseworkMetricsAbsent
        expr: absent(casework_database_up)
        for: 10m
        labels: {severity: page}
        annotations:
          summary: Casework metrics are missing.
```

### BReg

```yaml
groups:
  - name: breg
    rules:
      - alert: BregWorkerStalled
        expr: breg_worker_last_success_age_seconds > 900
        for: 10m
        labels: {severity: page}
        annotations:
          summary: A BReg background worker has not succeeded recently. The worker label names it.
      - alert: BregProposalApplicationBlocked
        expr: breg_proposal_application_blocked_jobs > 0
        for: 5m
        labels: {severity: page}
        annotations:
          summary: A Proposal application is blocked. Recover it with bregctl.
      - alert: BregQueueOldestPendingAge
        expr: breg_queue_oldest_pending_age_seconds > 900
        for: 10m
        labels: {severity: warn}
        annotations:
          summary: The oldest item in a BReg queue has waited too long. The queue label names it.
      - alert: BregRecordTimerOverdue
        expr: breg_record_timer_oldest_due_lag_seconds > 900
        for: 10m
        labels: {severity: warn}
        annotations:
          summary: A due Record timer has not run. Check bregctl timer list.
      - alert: BregHookDeadLettered
        expr: breg_hook_deliveries{state="dead-lettered"} > 0
        for: 5m
        labels: {severity: page}
        annotations:
          summary: A webhook delivery was dead-lettered. Replay or discard it with bregctl hook.
      - alert: BregHookDeliveriesBacklog
        expr: breg_hook_deliveries{state=~"pending|leased"} > 0
        for: 30m
        labels: {severity: warn}
        annotations:
          summary: Webhook deliveries have stayed pending or leased.
      - alert: BregIngestionRunBlocked
        expr: breg_ingestion_runs{state="blocked"} > 0
        for: 15m
        labels: {severity: warn}
        annotations:
          summary: An ingestion run is blocked because a successor package retired its binding.
      - alert: BregMetricsSampleFailing
        expr: increase(breg_metrics_sample_failures_total[15m]) > 0
        for: 0m
        labels: {severity: warn}
        annotations:
          summary: A BReg database sample failed. The sample label names it.
      - alert: BregRecordTimerIncompatible
        expr: breg_record_timer_control_compatible == 0
        for: 5m
        labels: {severity: page}
        annotations:
          summary: The Record timer protocol does not match this process.
```

### Scheduling

```yaml
groups:
  - name: scheduling
    rules:
      - alert: SchedulingOutboxDeadLettered
        expr: max_over_time((scheduling_outbox_items{state="dead-lettered"} - scheduling_outbox_items{state="dead-lettered"} offset 1m)[15m:1m]) > 0
        for: 0m
        labels: {severity: warn}
        annotations:
          summary: A delivery intent was dead-lettered. List it with schedulingctl intents.
      - alert: SchedulingOutboxUnknown
        expr: scheduling_outbox_items{state="unknown"} > 0
        for: 15m
        labels: {severity: warn}
        annotations:
          summary: A delivery intent has an unknown outcome.
      - alert: SchedulingOutboxOldestPending
        expr: scheduling_outbox_oldest_pending_age_seconds > 900
        for: 10m
        labels: {severity: warn}
        annotations:
          summary: The oldest pending delivery intent has waited more than 15 minutes.
      - alert: SchedulingHookDeadLettered
        expr: max_over_time((scheduling_hook_deliveries{state="dead-lettered"} - scheduling_hook_deliveries{state="dead-lettered"} offset 1m)[15m:1m]) > 0
        for: 0m
        labels: {severity: warn}
        annotations:
          summary: An observer-hook delivery was dead-lettered. Scheduling has no command to retry it.
      - alert: SchedulingHookOldestPending
        expr: scheduling_hook_oldest_pending_age_seconds > 900
        for: 10m
        labels: {severity: warn}
        annotations:
          summary: The oldest pending observer-hook delivery has waited more than 15 minutes.
      - alert: SchedulingWorkerStalled
        expr: scheduling_worker_last_success_age_seconds > 900
        for: 10m
        labels: {severity: page}
        annotations:
          summary: A Scheduling worker has not completed a pass. The worker label names it.
      - alert: SchedulingMetricsSampleFailing
        expr: increase(scheduling_metrics_sample_failures_total[15m]) > 0
        for: 0m
        labels: {severity: warn}
        annotations:
          summary: A queue could not be read at scrape time. The queue label names it.
      - alert: SchedulingServerErrors
        expr: sum(rate(scheduling_http_requests_total{status="5xx"}[5m])) > 0.05
        for: 10m
        labels: {severity: warn}
        annotations:
          summary: Scheduling is answering with server errors.
      - alert: SchedulingMetricsAbsent
        expr: absent(scheduling_outbox_items)
        for: 10m
        labels: {severity: page}
        annotations:
          summary: Scheduling outbox gauges are missing. The database may be unreachable.
```

### Documents

```yaml
groups:
  - name: documents
    rules:
      - alert: DocumentsVerificationDeadLettered
        expr: documents_verification_jobs{state="dead-lettered"} > 0
        for: 5m
        labels: {severity: warn}
        annotations:
          summary: A content verification job was dead-lettered. List it with documentsctl verification list.
      - alert: DocumentsErasureDeadLettered
        expr: documents_erasure_jobs{state="dead-lettered"} > 0
        for: 5m
        labels: {severity: warn}
        annotations:
          summary: An erasure job was dead-lettered. List it with documentsctl erasure list.
      - alert: DocumentsHookDeadLettered
        expr: max_over_time((documents_hook_deliveries{state="dead-lettered"} - documents_hook_deliveries{state="dead-lettered"} offset 1m)[15m:1m]) > 0
        for: 0m
        labels: {severity: warn}
        annotations:
          summary: An observer-hook delivery was dead-lettered. Documents has no command to retry it.
      - alert: DocumentsVerificationOverdue
        expr: documents_verification_oldest_overdue_age_seconds > 900
        for: 10m
        labels: {severity: warn}
        annotations:
          summary: The oldest pending content verification job has been due for more than 15 minutes.
      - alert: DocumentsErasureOverdue
        expr: documents_erasure_oldest_overdue_age_seconds > 900
        for: 10m
        labels: {severity: warn}
        annotations:
          summary: The oldest pending erasure job has been due for more than 15 minutes.
      - alert: DocumentsHookOverdue
        expr: documents_hook_oldest_overdue_age_seconds > 900
        for: 10m
        labels: {severity: warn}
        annotations:
          summary: The oldest pending observer-hook delivery has been due for more than 15 minutes.
      - alert: DocumentsCleanupStalled
        expr: documents_worker_last_success_age_seconds{worker="cleanup"} > 900
        for: 10m
        labels: {severity: page}
        annotations:
          summary: The Documents cleanup pass has not completed cleanly.
      - alert: DocumentsMetricsSampleFailing
        expr: increase(documents_metrics_sample_failures_total[15m]) > 0
        for: 0m
        labels: {severity: warn}
        annotations:
          summary: A queue could not be read at scrape time. The sample label names it.
      - alert: DocumentsMetricsAbsent
        expr: absent(documents_verification_jobs)
        for: 10m
        labels: {severity: page}
        annotations:
          summary: Documents queue gauges are missing. The database may be unreachable.
```

### Render

```yaml
groups:
  - name: render
    rules:
      - alert: RenderSealCertificateExpiring
        expr: render_seal_certificate_expiry_seconds < 14 * 24 * 3600
        for: 1h
        labels: {severity: warn}
        annotations:
          summary: A seal certificate expires within 14 days. Renew it. The seal label names it.
      - alert: RenderSealCertificateExpiringSoon
        expr: render_seal_certificate_expiry_seconds < 3 * 24 * 3600
        for: 10m
        labels: {severity: page}
        annotations:
          summary: A seal certificate expires within three days or has expired.
      - alert: RenderAuditWriteFailing
        expr: increase(render_audit_write_failures_total[15m]) > 0
        for: 0m
        labels: {severity: page}
        annotations:
          summary: Render failed to write an audit entry. A stopped audit writer needs a restart.
      - alert: RenderCallsFailing
        expr: |
          sum by (operation) (rate(render_documents_total{result="failed"}[5m]))
            / sum by (operation) (rate(render_documents_total[5m])) > 0.1
        for: 10m
        labels: {severity: warn}
        annotations:
          summary: More than a tenth of render or seal calls are failing.
```

### Adapter

The facade and the job host each get their own rule file.
Load the job host file only where `adapter-job pass --loop` runs.
A facade-only deployment never serves `adapter_job_items`, so its `absent()` rule would page for nothing.

```yaml
groups:
  - name: adapter
    rules:
      - alert: AdapterJournalWriteFailing
        expr: increase(adapter_journal_write_failures_total[15m]) > 0
        for: 0m
        labels: {severity: page}
        annotations:
          summary: The facade failed to write its audit journal, so exchanges answered an internal error.
```

```yaml
groups:
  - name: adapter-job
    rules:
      - alert: AdapterJobItemsHeld
        expr: adapter_job_items{state="held"} > 0
        for: 30m
        labels: {severity: warn}
        annotations:
          summary: Items are held. Run adapter-job status to see the owning product, which acts on them.
      - alert: AdapterJobItemsRefused
        expr: adapter_job_items{state="refused"} > 0
        for: 30m
        labels: {severity: warn}
        annotations:
          summary: The destination refused items. Run adapter-job status to see why.
      - alert: AdapterJobPassStale
        expr: min without (instance) (adapter_job_last_successful_pass_age_seconds) > 1800
        for: 10m
        labels: {severity: page}
        annotations:
          summary: No process of the job has settled a pass for more than 30 minutes.
      - alert: AdapterJobPassFailing
        expr: sum by (reason) (increase(adapter_job_pass_failures_total[15m])) > 0
        for: 15m
        labels: {severity: warn}
        annotations:
          summary: Passes are failing to settle. The reason label names why.
      - alert: AdapterJobGaugeSampleFailing
        expr: increase(adapter_job_gauge_sample_failures_total[15m]) > 0
        for: 0m
        labels: {severity: warn}
        annotations:
          summary: The job store could not be read at scrape time.
      - alert: AdapterJobMetricsAbsent
        expr: absent(adapter_job_items)
        for: 10m
        labels: {severity: page}
        annotations:
          summary: The job items gauge is missing. The store may be unreadable or the loop may be down.
```

### Messaging

```yaml
groups:
  - name: messaging
    rules:
      - alert: MessagingUnknownOutcome
        expr: messaging_dispatch_jobs{state="unknown"} > 0
        for: 5m
        labels: {severity: page}
        annotations:
          summary: A message has an unknown provider outcome. Settle it with messagingctl.
      - alert: MessagingDispatchBacklog
        expr: messaging_dispatch_jobs{state="pending"} > 0
        for: 15m
        labels: {severity: warn}
        annotations:
          summary: Messages have stayed pending. The dispatch worker may be stopped.
      - alert: MessagingTransientFailures
        expr: increase(messaging_provider_attempts_total{outcome="transient"}[15m]) > 0
        for: 10m
        labels: {severity: warn}
        annotations:
          summary: The provider keeps failing temporarily. Messages that run out of attempts become failed. Run messagingctl messages list.
      - alert: MessagingPermanentFailures
        expr: increase(messaging_provider_attempts_total{outcome="permanent"}[15m]) > 0
        for: 0m
        labels: {severity: warn}
        annotations:
          summary: The provider refused messages permanently.
      - alert: MessagingMetricsSampleFailing
        expr: increase(messaging_metrics_sample_failures_total[15m]) > 0
        for: 0m
        labels: {severity: warn}
        annotations:
          summary: The dispatch queue could not be read at scrape time.
      - alert: MessagingMetricsAbsent
        expr: absent(messaging_dispatch_jobs)
        for: 10m
        labels: {severity: page}
        annotations:
          summary: Messaging dispatch gauge is missing. The database may be unreachable.
```

### Evidence

```yaml
groups:
  - name: evidence
    rules:
      - alert: EvidenceSourceFailing
        expr: |
          sum by (source) (rate(evidence_source_requests_total{outcome!="success"}[5m]))
            / sum by (source) (rate(evidence_source_requests_total[5m])) > 0.2
        for: 10m
        labels: {severity: warn}
        annotations:
          summary: More than a fifth of calls to a governed source are failing.
      - alert: EvidenceSignerFailing
        expr: |
          sum by (signer) (rate(evidence_signer_requests_total{outcome!="success"}[5m]))
            / sum by (signer) (rate(evidence_signer_requests_total[5m])) > 0.05
        for: 10m
        labels: {severity: page}
        annotations:
          summary: Signer calls are failing.
      - alert: EvidenceSourceShapeDrift
        expr: increase(evidence_source_shape_drift_total[1h]) > 0
        for: 0m
        labels: {severity: warn}
        annotations:
          summary: A source answered in a shape the bundle does not describe.
      - alert: EvidenceRateLimiterNearCeiling
        expr: evidence_rate_limiter_tracked_keys > 80000
        for: 15m
        labels: {severity: warn}
        annotations:
          summary: The rate limiter is nearing its ceiling of 100,000 tracked keys.
      - alert: EvidenceOid4vciStoreNearCapacity
        expr: evidence_oid4vci_store_entries / evidence_oid4vci_store_capacity > 0.8
        for: 10m
        labels: {severity: warn}
        annotations:
          summary: The OID4VCI store is above 80 percent of its capacity.
```

{/* Evidence: crates/registry-coordinator/src/metrics.rs, RunOutcome;
    crates/registry-casework/src/metrics.rs, casework_database_up;
    crates/registry-breg/src/metrics.rs, breg_record_timer_control_compatible and breg_queue_oldest_pending_age_seconds;
    crates/registry-messaging/src/metrics.rs, messaging_provider_attempts_total;
    crates/registry-evidence/src/observability.rs, evidence_rate_limiter_tracked_keys;
    crates/registry-evidence-oid4vci/src/observability.rs, evidence_oid4vci_store_entries. */}

## Next

- [Operator handoff](../)
- [Inspect and diagnose a running deployment](../advanced/inspect-and-diagnose/)
- [Retention and persistent state](../retention-and-persistent-state/)