PgFlow.Telemetry.PubSub (PgFlow v0.1.0)

Copy Markdown View Source

Bridges PgFlow telemetry events to Phoenix.PubSub.

Attaches to all PgFlow telemetry events and broadcasts them as {:pgflow, run_id, event_payload} tuples to per-run and global topics.

Topics

  • "pgflow:run:<run_id>" — all events for a specific run
  • "pgflow:runs" — all run lifecycle events (started, completed, failed)
  • "pgflow:tasks" — all task events (started, completed, failed)

Usage

Typically started automatically by PgFlow.Supervisor when :pubsub is configured:

children = [
  {PgFlow.Supervisor, pubsub: MyApp.PubSub, ...}
]

Can also be attached manually:

PgFlow.Telemetry.PubSub.attach(pubsub: MyApp.PubSub)

Summary

Functions

Attaches telemetry handlers that broadcast events to PubSub.

Detaches the telemetry handlers.

Functions

attach(opts)

@spec attach(keyword()) :: :ok | {:error, :already_exists}

Attaches telemetry handlers that broadcast events to PubSub.

Options

  • :pubsub — (required) the Phoenix.PubSub module to broadcast on

detach()

@spec detach() :: :ok | {:error, :not_found}

Detaches the telemetry handlers.