Bandera.Usage (bandera v0.3.0)

Copy Markdown View Source

Optional last-evaluated tracker. Attaches to [:bandera, :enabled?] and [:bandera, :variant] and records, in ETS, the last time each flag was checked — the signal for Bandera.stale_flags/1. Start it in your supervision tree and call Bandera.Usage.attach/0 once at boot.

Summary

Functions

Registers the telemetry handler. Call once after the supervisor starts.

Returns a specification to start this module under a supervisor.

Unregisters the telemetry handler.

Returns the last UTC DateTime flag_name was evaluated, or nil if never seen.

Starts the Usage tracker and creates its ETS table. Add to your supervision tree.

Functions

attach()

@spec attach() :: :ok | {:error, :already_exists}

Registers the telemetry handler. Call once after the supervisor starts.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

detach()

@spec detach() :: :ok | {:error, :not_found}

Unregisters the telemetry handler.

last_evaluated(flag_name)

@spec last_evaluated(atom()) :: DateTime.t() | nil

Returns the last UTC DateTime flag_name was evaluated, or nil if never seen.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

Starts the Usage tracker and creates its ETS table. Add to your supervision tree.