Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ config :sentry,
| `release` | False | None | |
| `server_name` | False | None | |
| `use_error_logger` | False | False | |
| `client` | False | `Sentry.Client` | If you need different functionality for the HTTP client, you can define your own module that implements the `Sentry.HTTPClient` behaviour and set `client` to that module |
| `hackney_opts` | False | `[pool: :sentry_pool]` | |
| `hackney_pool_max_connections` | False | 50 | |
| `hackney_pool_timeout` | False | 5000 | |
Expand Down
4 changes: 4 additions & 0 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ Optional settings
Set this to true if you want to capture all exceptions that occur even outside of a request cycle. This
defaults to false.

.. describe:: client

If you need different functionality for the HTTP client, you can define your own module that implements the `Sentry.HTTPClient` behaviour and set `client` to that module.

.. describe:: filter

Set this to a module that implements the ``Sentry.EventFilter`` behaviour if you would like to prevent
Expand Down
2 changes: 2 additions & 0 deletions lib/sentry/client.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
defmodule Sentry.Client do
@behaviour Sentry.HTTPClient

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

Expand Down
12 changes: 12 additions & 0 deletions lib/sentry/http_client.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
defmodule Sentry.HTTPClient do
@moduledoc """
Specifies the API for using a custom HTTP Client.

Clients must implement the `send_event/1` function that receives
the Event and sends it to the Sentry API. It may return anything.

See `Sentry.Client` for `Sentry.TestClient` for example implementations.
"""

@callback send_event(Sentry.Event.t) :: any
end
2 changes: 2 additions & 0 deletions test/support/test_client.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
defmodule Sentry.TestClient do
@behaviour Sentry.HTTPClient

def send_event(%Sentry.Event{} = event) do
{endpoint, _public_key, _secret_key} = Sentry.Client.get_dsn!
event = Sentry.Client.maybe_call_before_send_event(event)
Expand Down