View Source CozyTelemetry.Measurements behaviour (cozy_telemetry v0.4.1)

A behaviour for declaring periodic measurements.

Any module that wants to run periodic measurements should implement this behaviour.

defmodule MyApp.Cache do
  use CozyTelemetry.Measurements

  @impl CozyTelemetry.Measurements
  def periodic_measurements(meta) do
    [
      {__MODULE__, :dispatch_stats, []}
    ]
  end
end

Then, the declared measurements in above module can be loaded with following configuration:

config :my_app, CozyTelemetry,
  meta: [],
  metrics: [],
  measurements: [
    MyApp.Cache
  ],
  # ...

Link to this section Summary

Functions

Loads the measurements from given module.

Same as load_measurements_from_module/2 but raises if the module cannot be loaded.

Link to this section Types

Link to this section Callbacks

Link to this callback

periodic_measurements(meta)

View Source
@callback periodic_measurements(meta()) :: [TelemetryPoller.measurement()]

Link to this section Functions

Link to this function

load_measurements_from_module(module, meta)

View Source

Loads the measurements from given module.

Link to this function

load_measurements_from_module!(module, meta)

View Source

Same as load_measurements_from_module/2 but raises if the module cannot be loaded.