sentry v4.0.3 Sentry.Client

This module is the default client for sending an event to Sentry via HTTP.

It makes use of Task.Supervisor to create unlinked asynchronous tasks to avoid holding up a user’s application to send a Sentry event.

Configuration

  • :before_send_event - allows performing operations on the event before it is sent. Accepts an anonymous function or a {module, function} tuple, and the event will be passed as the only argument.

Example configuration of putting Logger metadata in the extra context:

config :sentry,
  before_send_event: fn(event) ->
    metadata = Map.new(Logger.metadata)
    %{event | extra: Map.merge(event.extra, metadata)}
  end

Summary

Functions

Generates a Sentry API authorization header

Get a Sentry DSN which is simply a URI

Makes the HTTP request to Sentry using hackney

Starts an unlinked asynchronous task that will attempt to send the event to the Sentry API up to 4 times with exponential backoff

Types

get_dsn()
get_dsn() :: {String.t, String.t, Integer.t}

Functions

authorization_header(public_key, secret_key)
authorization_header(String.t, String.t) :: String.t

Generates a Sentry API authorization header.

get_dsn!()
get_dsn!() :: get_dsn

Get a Sentry DSN which is simply a URI.

hackney_pool_name()
maybe_call_before_send_event(event)
request(method, url, headers, body)

Makes the HTTP request to Sentry using hackney.

Hackney options can be set via the hackney_opts configuration option.

send_event(event)
send_event(Sentry.Event.t) :: {:ok, Task.t} | :error

Starts an unlinked asynchronous task that will attempt to send the event to the Sentry API up to 4 times with exponential backoff.

The event is dropped if it all retries fail.