View Source CozyTelemetry.Measurements behaviour (cozy_telemetry v0.4.2)
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
@type meta() :: keyword()
Link to this section Callbacks
@callback periodic_measurements(meta()) :: [TelemetryPoller.measurement()]
Link to this section Functions
Loads the measurements from given module.
Same as load_measurements_from_module/2
but raises if the module cannot be loaded.