Documents the :telemetry events this package emits. There's nothing to
call here — attach your own handler with :telemetry.attach/4 or
:telemetry.attach_many/4.
Every HTTP request made by this package (REST, Procurement, SOAP, and the
internal OAuth2 token fetch) emits a standard :telemetry.span/3 triple
under the prefix configured via Tipalti.Config :telemetry_prefix
(default [:tipalti]):
[:tipalti, :request, :start]— metadata:%{api: :rest | :soap | :procurement, operation: atom(), method: atom(), url: String.t()}[:tipalti, :request, :stop]— same metadata plus:status(HTTP status) on success,:error(exception module) on failure; measurement:durationin native time units.[:tipalti, :request, :exception]— emitted if the request function itself raises.
Example
:telemetry.attach(
"tipalti-logger",
[:tipalti, :request, :stop],
fn _event, measurements, metadata, _config ->
duration_ms = System.convert_time_unit(measurements.duration, :native, :millisecond)
Logger.info("tipalti #{metadata.api}.#{metadata.operation} -> #{inspect(metadata[:status] || metadata[:error])} in #{duration_ms}ms")
end,
nil
)