ExNudge.Telemetry (ExNudge v1.0.0)

View Source

Telemetry events emitted by ExNudge.

Events

[:ex_nudge, :send_notification]

This event is emitted when a notification has completed both successfully and with an error.

Measurements

  • :duration - The time taken in milliseconds from sending the notification to receiving a response.
  • :payload_size - Size of the payload in bytes

Metadata

  • :endpoint - Sanitized push service endpoint
  • :status - Operation status (:success or :error)
  • :http_status_code - HTTP response status code or nil
  • :error_reason - Error reason or nil

Example Usage

:telemetry.attach("my-handler", [:ex_nudge, :send_notification], fn name, measurements, metadata, config ->
  case metadata.status do
    :success ->
      Logger.info("Notification sent successfully",
        duration: measurements.duration,
        endpoint: metadata.endpoint)
    :error ->
      Logger.error("Notification failed",
        error: metadata.error_reason,
        http_status: metadata.http_status_code)
  end
end, nil)