NatureWhistle. Application
(nature_whistle v0.3.0)
Copy Markdown
OTP bootstrap for NatureWhistle.
This application module owns the runtime setup for the library:
- it creates the ETS tables used to store alert definitions, alert state, and rate-limiting data
- it loads alert configuration from the
:nature_whistleapplication environment into ETS - it attaches a telemetry handler for each unique configured event
- it starts the
NatureWhistle.TaskSupervisorused for asynchronous notification delivery - it starts
NatureWhistle.BackgroundCleaner, which resolves alert timers and prunes old rate-limit data
The module is intentionally small, but it is the most important piece of the runtime because every other module depends on these ETS tables and processes existing before the first telemetry event is handled.
Summary
Functions
Normalizes application alert configuration and stores it in ETS.
Creates the application runtime.
Functions
Normalizes application alert configuration and stores it in ETS.
cpu_cores is used to scale the default CPU run-queue alert so the threshold
remains proportional to the size of the current scheduler pool.
The loader accepts alerts written as keyword lists or maps. Each alert is converted into a normalized map that contains the keys used by the runtime:
:id:event:measurement_key:threshold:formatter:alert_message:calm_message:debounce_ms:resolution_ms:sliding_window:rate_limit:notifiers
For compatibility, the loader also accepts the older singular :notifier
key and promotes it to the :notifiers list used by the dispatcher.
The normalized alerts are grouped by telemetry event and written into the
:nature_whistle_alerts table. Existing table contents are cleared first so
the result reflects the current application configuration exactly.
Creates the application runtime.
The startup sequence is:
- create the ETS tables if they do not already exist
- load alert definitions from application config into ETS
- attach one telemetry handler per configured event
- validate retry settings
- start the task supervisor and background cleaner
The function returns the result of the internal supervisor start-up.