Worldpay.Telemetry (Worldpay v1.0.0)

Copy Markdown View Source

Telemetry integration for all Worldpay API calls.

Events

All events live under the [:worldpay, :request, *] prefix.

EventMeasurementsMetadata
[:worldpay, :request, :start]%{system_time: integer}%{api: atom, operation: atom}

| [:worldpay, :request, :stop] | %{duration: integer} | %{api: atom, operation: atom, status: integer, outcome: :ok | :error} | | [:worldpay, :request, :exception] | %{duration: integer} | %{api: atom, operation: atom, kind: atom, reason: term} |

Attaching handlers

:telemetry.attach_many(
  "worldpay-logger",
  [
    [:worldpay, :request, :start],
    [:worldpay, :request, :stop],
    [:worldpay, :request, :exception]
  ],
  &Worldpay.Telemetry.log_handler/4,
  nil
)

Summary

Functions

Returns a specification to start this module under a supervisor.

Default structured logger handler — attach in your application if desired.

Emit the start event and return a monotonic start time.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

exception(api, operation, start_time, kind, reason)

@spec exception(atom(), atom(), integer(), atom(), term()) :: :ok

Emit exception event.

log_handler(event, measurements, meta, config)

@spec log_handler(list(), map(), map(), term()) :: :ok

Default structured logger handler — attach in your application if desired.

start(api, operation, metadata \\ %{})

@spec start(atom(), atom(), map()) :: integer()

Emit the start event and return a monotonic start time.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

stop(api, operation, start_time, status, outcome)

@spec stop(atom(), atom(), integer(), non_neg_integer(), :ok | :error) :: :ok

Emit stop event.