Telemetry integration for the Lithic client.
Events
All events are prefixed with the :telemetry_prefix config value (default [:lithic]).
| Event | When | Measurements | Metadata |
|---|---|---|---|
[:lithic, :request_start] | Before HTTP call | %{} | %{method, path, client} |
[:lithic, :request_stop] | After success | %{duration: native_time} | %{method, path, client, status: :ok} |
[:lithic, :request_exception] | After failure | %{duration: native_time} | %{method, path, client, error: %Lithic.Error{}} |
Attaching a handler
Lithic.Telemetry.attach_default_logger()Custom handler
:telemetry.attach(
"my-lithic-handler",
[:lithic, :request_stop],
fn event, measurements, metadata, _config ->
duration_ms = System.convert_time_unit(measurements.duration, :native, :millisecond)
Logger.info("Lithic #{inspect(metadata.method)} #{metadata.path} completed in #{duration_ms}ms")
end,
nil
)
Summary
Functions
Attach a default structured logger for all Lithic telemetry events.
Returns a specification to start this module under a supervisor.
Returns the list of telemetry events emitted by this library.
Functions
@spec attach_default_logger(keyword()) :: :ok | {:error, :already_exists}
Attach a default structured logger for all Lithic telemetry events.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec events() :: [[atom(), ...]]
Returns the list of telemetry events emitted by this library.