Replicant.Telemetry (Replicant v3.0.0)

Copy Markdown View Source

Replicant emits 38 structure-only events for operators who monitor pipelines and sinks. Event metadata and measurements use closed key and value-shape allowlists. A rejected entry raises without including the rejected value.

The table lists direct events. See span/3 for the span API.

Events

EventFires whenMeasurementsMetadata
[:replicant, :pipeline, :halted]A permanent halt begins before asynchronous teardownNoneslot_name, structural atom reason, optional atom kind
[:replicant, :connection, :connected]The replication session connects or reconnects.Nonekind (:primary or :standby)
[:replicant, :connection, :disconnected]The connection drops.NoneNone
[:replicant, :connection, :health]The receive watchdog requests a reply from an unpaused stream.duration (milliseconds since the last frame)slot_name
[:replicant, :connection, :receive_timeout]A watchdog probe receives no reply within the receive deadline.duration (milliseconds since the last frame)slot_name, reason: :receive_timeout
[:replicant, :connection, :slot_release_wait]A watchdog reconnect finds the slot still held by another backend. Repeats once per second while held.duration (milliseconds waiting)slot_name
[:replicant, :connection, :paused] / :resumedThe queue crosses its intake watermarks.byte_size, change_count, duration (elapsed pause in milliseconds)slot_name
[:replicant, :connection, :stalled]Queued work has made no progress for at least five seconds. A warning and event repeat every five seconds until progress resumes.byte_size, change_count, duration (milliseconds without a completed frame)slot_name
[:replicant, :buffer, :exhausted]Retained payload exceeds the available buffer budget.byte_sizeslot_name, reason: :buffer_limit_exceeded
[:replicant, :connection, :slot_active]Replication starts, or the incremental snapshot starts streaming.NoneNone
[:replicant, :connection, :slot_invalidated]Source checks or slot state prevent replication.Nonereason (:failover_unsupported, :publication_missing, invalidation class)
[:replicant, :connection, :session_identity_rejected]The sink rejects the replication-session identity.Nonereason: :session_identity_rejected
[:replicant, :connection, :command_error_halt]The pre-frame replication command exhausts its retry budget.Noneattempt, max_retries, slot_name
[:replicant, :checkpoint, :advanced]The connection advances the acknowledgment.Nonecommit_lsn (kind: :idle on the idle-advance path)
[:replicant, :checkpoint_store, :read]The pipeline reads its library-owned checkpoint.Noneslot_name, commit_lsn (nil on a fresh slot)
[:replicant, :checkpoint_store, :written]A library-owned checkpoint commits.Noneslot_name, commit_lsn
[:replicant, :checkpoint_store, :batch_flushed]A batched checkpoint window flushes.Noneslot_name, change_count, byte_size (LSN span), reason (includes :max_buffer_bytes)
[:replicant, :checkpoint_store, :retrying]A transient store fault triggers a retry.Noneslot_name, attempt, max_retries
[:replicant, :checkpoint_store, :failed]A permanent or exhausted store fault halts delivery.duration on individual checkpoint write failureslot_name, reason
[:replicant, :transaction, :assembled]A committed transaction is ready for delivery.Nonecommit_lsn, change_count, byte_size, lag_ms
[:replicant, :sink, :committed]The sink successfully applies a transaction.durationcommit_lsn
[:replicant, :sink, :batch_committed]The sink successfully applies an atomic batch.durationcommit_lsn, change_count, reason
[:replicant, :sink, :failed]The sink callback fails.duration when timing the callreason (for example :sink_failed or :spill_io_failed)
[:replicant, :message, :received]The assembler handles a logical-decoding message.Nonecommit_lsn, byte_size, transactional
[:replicant, :schema_change, :additive]The assembler applies an additive schema change.Nonetable, kind: :additive
[:replicant, :schema_change, :halted]A destructive schema change halts the pipeline.Nonetable, kind: :destructive
[:replicant, :snapshot, :started]A snapshot or incremental backfill starts.Nonecommit_lsn
[:replicant, :snapshot, :resumed]An incremental backfill resumes from durable progress.Noneslot_name
[:replicant, :snapshot, :table_completed]A table finishes snapshotting.Nonetable, change_count
[:replicant, :snapshot, :chunk_completed]A backfill chunk is applied.Nonetable, change_count
[:replicant, :snapshot, :chunk_retried]The reader discards a contended chunk and retries.Nonetable, reason: :snapshot_table_contended
[:replicant, :snapshot, :completed]The snapshot finishes and hands off to streaming.durationcommit_lsn, change_count
[:replicant, :snapshot, :failed]The snapshot or backfill fails.Nonereason (for example :snapshot_failed or :snapshot_table_contended), plus table on table-specific snapshot errors
[:replicant, :stream, :committed]A streamed transaction commits.Nonecommit_lsn, byte_size (change_count on the folded path)
[:replicant, :stream, :aborted]A streamed transaction aborts.Nonereason: :stream_abort
[:replicant, :stream, :spilled]The assembler flushes streamed changes to disk.Nonebyte_size, change_count
[:replicant, :stream, :spill_exhausted]The spill reaches its disk limit and halts the pipeline.Nonebyte_size, reason: :spill_exhausted

Summary

Functions

The permitted event measurement keys.

The permitted span/event metadata keys.

Emit a value-free telemetry event. BOTH measurements and meta are validated against their closed key + value-shape contracts (validate!/1 and validate_measurements!/1 raise on an off-list key or a wrong-shape value), so no row/column value can reach a telemetry consumer.

Wrap fun in a [:replicant, op] span, validating BOTH the start metadata and the returned stop metadata against the value-free contract (validate!/1 raises on an off-list key or a wrong-shape value). fun must return {result, stop_meta}. The span's own measurements (monotonic_time/duration) are generated by :telemetry and are not user-supplied.

Functions

allowed_measurement_keys()

@spec allowed_measurement_keys() :: [atom()]

The permitted event measurement keys.

allowed_meta_keys()

@spec allowed_meta_keys() :: [atom()]

The permitted span/event metadata keys.

event(name, measurements, meta)

@spec event([atom(), ...], map(), map()) :: :ok

Emit a value-free telemetry event. BOTH measurements and meta are validated against their closed key + value-shape contracts (validate!/1 and validate_measurements!/1 raise on an off-list key or a wrong-shape value), so no row/column value can reach a telemetry consumer.

span(op, start_meta, fun)

@spec span(atom(), map(), (-> {term(), map()})) :: term()

Wrap fun in a [:replicant, op] span, validating BOTH the start metadata and the returned stop metadata against the value-free contract (validate!/1 raises on an off-list key or a wrong-shape value). fun must return {result, stop_meta}. The span's own measurements (monotonic_time/duration) are generated by :telemetry and are not user-supplied.