Bloccs.Inspect (bloccs v0.7.0)

Copy Markdown View Source

Opt-in capture of message payloads for observability (e.g. the bloccs_web Messages feed).

Off by default. Payloads can be large or sensitive, so capture is enabled explicitly and is always bounded and redactable:

config :bloccs, :inspect,
  enabled: true,
  max_bytes: 512,
  redact: [:password, :token, :secret, :authorization]

When enabled, the runtime attaches a rendered, truncated, redacted snapshot of the emitted payload to the [:bloccs, :emit] telemetry event under the :payload metadata key (nil when disabled). It is a string — a display artifact, never the live term — so consumers can't accidentally hold or mutate message data.

Redaction matches map keys by name (atom or string form) at any depth and replaces the value with "[redacted]"; structs keep their type.

Summary

Functions

Render a bounded, redacted snapshot of payload for telemetry, or nil when capture is disabled. Always returns a string (or nil).

The effective inspect config (application env merged over defaults).

Whether payload capture is enabled.

Types

config()

@type config() :: [enabled: boolean(), max_bytes: pos_integer(), redact: [atom()]]

Functions

capture(payload)

@spec capture(term()) :: String.t() | nil

Render a bounded, redacted snapshot of payload for telemetry, or nil when capture is disabled. Always returns a string (or nil).

config()

@spec config() :: config()

The effective inspect config (application env merged over defaults).

enabled?()

@spec enabled?() :: boolean()

Whether payload capture is enabled.