Continuum.Observer (continuum v0.6.2)

Copy Markdown View Source

Data and action helpers for the optional Continuum Observer.

The Observer is mounted from a host Phoenix router with Continuum.Observer.Router.continuum_observer/2. Continuum does not start an Observer supervisor and does not provide authentication; mount it only inside an authenticated admin scope.

Query helpers in this module are Phoenix-independent and operate on the configured Continuum instance repo. Event payloads are decoded with :erlang.binary_to_term/1 because Continuum stores its own trusted journal data as bytea; the Observer is not a boundary for untrusted database writes.

Summary

Functions

Cancels a run through the public Continuum API using the Observer instance.

Decodes a JSON payload from the Observer signal form.

Loads one run for the Observer detail view.

Builds the operational health report shown by the Observer health panel.

Lists decoded journal events for a run ordered by sequence.

Lists runs for the Observer index.

Pretty prints an event payload for display.

Plans or executes a fenced operational repair from the Observer.

Returns the per-run topic used by run detail pages.

Returns the low-fidelity per-instance runs topic used by the Observer index.

Sends a signal through the public Continuum API using the Observer instance.

Subscribes the caller to full-fidelity updates for a single run.

Subscribes the caller to coarse run-index updates for an instance.

Returns the run id that this run continued into via continue_as_new, or nil.

Types

run_state()

@type run_state() :: :running | :suspended | :completed | :failed | :cancelled

Functions

cancel_run(run_id, opts \\ [])

@spec cancel_run(
  binary(),
  keyword()
) :: :ok | {:error, term()}

Cancels a run through the public Continuum API using the Observer instance.

decode_signal_payload(json)

@spec decode_signal_payload(binary()) :: {:ok, term()} | {:error, term()}

Decodes a JSON payload from the Observer signal form.

get_run(run_id, opts \\ [])

@spec get_run(
  binary(),
  keyword()
) :: {:ok, map()} | {:error, :not_found | term()}

Loads one run for the Observer detail view.

health(opts \\ [])

@spec health(keyword()) :: {:ok, map()} | {:error, term()}

Builds the operational health report shown by the Observer health panel.

list_events(run_id, opts \\ [])

@spec list_events(
  binary(),
  keyword()
) :: {:ok, [map()]} | {:error, term()}

Lists decoded journal events for a run ordered by sequence.

list_runs(opts \\ [])

@spec list_runs(keyword()) :: {:ok, map()} | {:error, term()}

Lists runs for the Observer index.

Options:

  • :instance - Continuum instance name or struct. Defaults to Continuum.
  • :state - atom/string run state filter.
  • :workflow - workflow module substring filter.
  • :search - run id or workflow substring filter.
  • :page - 1-based page number.
  • :per_page - page size, capped at 100.

pretty(term)

@spec pretty(term()) :: binary()

Pretty prints an event payload for display.

repair_health(action, subject_id, opts \\ [])

@spec repair_health(atom() | binary(), binary(), keyword()) ::
  {:ok, map()} | {:error, term()}

Plans or executes a fenced operational repair from the Observer.

Repairs remain dry-run by default; pass execute: true after presenting an explicit confirmation to the operator.

run_topic(run_id)

@spec run_topic(binary()) :: binary()

Returns the per-run topic used by run detail pages.

runs_topic()

@spec runs_topic() :: binary()

Returns the low-fidelity per-instance runs topic used by the Observer index.

send_signal(run_id, name, payload, opts \\ [])

@spec send_signal(binary(), atom() | binary(), term(), keyword()) ::
  :ok | {:error, term()}

Sends a signal through the public Continuum API using the Observer instance.

subscribe_run(run_id, opts \\ [])

@spec subscribe_run(
  binary(),
  keyword()
) :: :ok | {:error, term()}

Subscribes the caller to full-fidelity updates for a single run.

subscribe_runs(opts \\ [])

@spec subscribe_runs(keyword()) :: :ok | {:error, term()}

Subscribes the caller to coarse run-index updates for an instance.

successor_run_id(run_id, opts \\ [])

@spec successor_run_id(
  binary(),
  keyword()
) :: binary() | nil

Returns the run id that this run continued into via continue_as_new, or nil.