NatureWhistle (nature_whistle v0.3.0)

Copy Markdown

NatureWhistle is the public entry point for the library.

It holds the default alert templates shipped with the project and provides helpers for looking up alert definitions from application configuration.

The runtime itself is started through NatureWhistle.Application, but this module is still useful because it documents the shape of the alert structures that flow through the rest of the system:

  • alert definitions are configured as maps or keyword lists
  • alerts are grouped by telemetry event
  • values are compared against a numeric threshold
  • optional formatter, rate_limit, sliding_window, and resolution_ms settings change how an alert behaves at runtime
  • delivery targets are selected by profile names listed in notifiers

The module also returns the built-in sample alerts used when no custom alerts are configured. These are convenient examples for documentation and testing, and the application loader understands both the older :notifier key and the newer :notifiers profile list when normalizing them.

Summary

Functions

Returns the built-in sample alert templates shipped with NatureWhistle.

Looks up a single alert definition by alert_id.

Functions

default_alerts()

Returns the built-in sample alert templates shipped with NatureWhistle.

The returned values are keyword lists rather than maps so they are easy to read in documentation and config examples. They demonstrate the two common alert patterns supported by the library:

  • a memory alert with a high threshold and a console delivery target
  • a CPU run-queue alert with rate limiting and a sliding window gate

These values are used as a fallback template source when no custom alerts are present in the application environment. Their :notifier field is accepted for compatibility by NatureWhistle.Application.

get_alert_config(alert_id)

Looks up a single alert definition by alert_id.

The lookup is performed against :nature_whistle, :alerts in application configuration. If that key is not set, the function falls back to default_alerts/0 and converts the sample definitions into maps before searching.

Both keyword lists and maps are accepted in the configuration source. The helper normalizes each alert into a map so callers can rely on dot access in the rest of the codebase.

Return value

  • returns the matching alert map when found
  • returns nil when no alert with the requested ID exists