Replicant.Telemetry (Replicant v1.0.0)

Copy Markdown View Source

Value-free :telemetry.span/3 wrapper. Owns the metadata allowlist — the single enforcement point for "no row values in telemetry" (Critical Rule 1). LSNs, table names, counts, durations, and error classes are permitted; an off-allowlist key raises rather than shipping a value downstream. Mirrors arcadic's allowlist pattern.

Summary

Functions

The permitted span metadata keys.

Emit a value-free telemetry event. meta is validated against the allowlist (validate!/1 raises on an off-allowlist key), 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 allowlist (validate!/1 raises on an off-allowlist key). fun must return {result, stop_meta}.

Functions

allowed_meta_keys()

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

The permitted span metadata keys.

event(name, measurements, meta)

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

Emit a value-free telemetry event. meta is validated against the allowlist (validate!/1 raises on an off-allowlist key), 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 allowlist (validate!/1 raises on an off-allowlist key). fun must return {result, stop_meta}.