Chronicle.Discovery.DefaultedIdWarning (cratis_chronicle v3.16.1)

Copy Markdown View Source

Warns, at most once per module for the lifetime of the BEAM node, that a reactor, reducer or projection is relying on its module name as its identifier.

Renaming or moving the module then silently resets Chronicle's observation position for it, because the id changes along with the name. Discovery can run more than once in a client's lifetime (once while logging at startup, again through Chronicle.Client.discovery_report/1 or mix chronicle.discover), so the warning is kept behind a :persistent_term guard keyed by module rather than emitted unconditionally.

Summary

Functions

Emits the one-time warning for module when its id was defaulted and warnings are enabled.

Functions

warn_once(module, kind, bool)

@spec warn_once(module(), :reactor | :reducer | :projection, boolean()) :: :ok

Emits the one-time warning for module when its id was defaulted and warnings are enabled.

kind is :reactor, :reducer or :projection — only those three default an id from the module name today. warn? is the client's warn_defaulted_ids option; passing false suppresses the warning (and skips the :persistent_term write) without otherwise affecting discovery.