Skip to content

Commit 9ccf6e0

Browse files
committed
add finch to config.ex
1 parent 1bc8f85 commit 9ccf6e0

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

lib/sentry/config.ex

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,11 @@ defmodule Sentry.Config do
302302
client: [
303303
type: :atom,
304304
type_doc: "`t:module/0`",
305-
default: Sentry.HackneyClient,
305+
default: Sentry.FinchClient,
306306
doc: """
307307
A module that implements the `Sentry.HTTPClient`
308-
behaviour. Defaults to `Sentry.HackneyClient`, which uses
309-
[hackney](https://github.com/benoitc/hackney) as the HTTP client.
308+
behaviour. Defaults to `Sentry.FinchClient`, which uses
309+
[Finch](https://github.com/sneako/finch) as the HTTP client.
310310
"""
311311
],
312312
send_max_attempts: [
@@ -316,6 +316,16 @@ defmodule Sentry.Config do
316316
The maximum number of attempts to send an event to Sentry.
317317
"""
318318
],
319+
finch_opts: [
320+
type: :keyword_list,
321+
default: [size: 50, conn_max_idle_time: 5000],
322+
doc: """
323+
Pool options to be passed to `Finch.start_link/1`. These options control
324+
the connection pool behavior. Only applied if `:client` is set to
325+
`Sentry.FinchClient`. See [Finch documentation](https://hexdocs.pm/finch/Finch.html#start_link/1)
326+
for available options.
327+
"""
328+
],
319329
hackney_opts: [
320330
type: :keyword_list,
321331
default: [pool: :sentry_pool],
@@ -607,6 +617,9 @@ defmodule Sentry.Config do
607617
@spec sample_rate() :: float()
608618
def sample_rate, do: fetch!(:sample_rate)
609619

620+
@spec finch_opts() :: keyword()
621+
def finch_opts, do: fetch!(:finch_opts)
622+
610623
@spec hackney_opts() :: keyword()
611624
def hackney_opts, do: fetch!(:hackney_opts)
612625

lib/sentry/finch_client.ex

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ defmodule Sentry.FinchClient do
2323
Finch.child_spec(
2424
name: __MODULE__,
2525
pools: %{
26-
:default => [
27-
size: Sentry.Config.max_finch_connections(),
28-
conn_max_idle_time: Sentry.Config.finch_timeout()
29-
]
26+
:default => Sentry.Config.finch_opts()
3027
}
3128
)
3229
else

lib/sentry/http_client.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ defmodule Sentry.HTTPClient do
22
@moduledoc """
33
A behaviour for HTTP clients that Sentry can use.
44
5-
The default HTTP client is `Sentry.HackneyClient`.
5+
The default HTTP client is `Sentry.FinchClient`.
66
77
To configure a different HTTP client, implement the `Sentry.HTTPClient` behaviour and
88
change the `:client` configuration:

0 commit comments

Comments
 (0)