View Source LightningWeb.Telemetry (Lightning v2.10.4)
Assorted metrics to collect during runtime.
Summary
Functions
Returns a specification to start this module under a supervisor.
Convenience function that wraps :telemetry.span/3
.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec with_span( :telemetry.event_prefix(), :telemetry.event_metadata(), (:telemetry.event_metadata() -> {any(), :telemetry.event_metadata()}) | (-> any()) ) :: any()
Convenience function that wraps :telemetry.span/3
.
Given a function with an arity of zero, it passes the metadata
argument
out with the result of the function.
If you need to control the metadata
, pass in a function with an arity of
one. It will be called with the metadata provided and expects the result and
the updated metadata to be returned in a tuple.
Example:
with_span([:my, span], %{project_id: 123}, fn -> get_project(456) end)
Or when you want to extend the metadata:
with_span([:my, :span], %{user_id: 123}, fn _metadata ->
project = get_project(456)
{project, %{project_id: project.id}}
end)