Skip to content

Commit e94eb25

Browse files
committed
add finch to config.ex
1 parent f62aecb commit e94eb25

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
@@ -352,11 +352,11 @@ defmodule Sentry.Config do
352352
client: [
353353
type: :atom,
354354
type_doc: "`t:module/0`",
355-
default: Sentry.HackneyClient,
355+
default: Sentry.FinchClient,
356356
doc: """
357357
A module that implements the `Sentry.HTTPClient`
358-
behaviour. Defaults to `Sentry.HackneyClient`, which uses
359-
[hackney](https://github.com/benoitc/hackney) as the HTTP client.
358+
behaviour. Defaults to `Sentry.FinchClient`, which uses
359+
[Finch](https://github.com/sneako/finch) as the HTTP client.
360360
"""
361361
],
362362
send_max_attempts: [
@@ -366,6 +366,16 @@ defmodule Sentry.Config do
366366
The maximum number of attempts to send an event to Sentry.
367367
"""
368368
],
369+
finch_opts: [
370+
type: :keyword_list,
371+
default: [size: 50, conn_max_idle_time: 5000],
372+
doc: """
373+
Pool options to be passed to `Finch.start_link/1`. These options control
374+
the connection pool behavior. Only applied if `:client` is set to
375+
`Sentry.FinchClient`. See [Finch documentation](https://hexdocs.pm/finch/Finch.html#start_link/1)
376+
for available options.
377+
"""
378+
],
369379
hackney_opts: [
370380
type: :keyword_list,
371381
default: [pool: :sentry_pool],
@@ -663,6 +673,9 @@ defmodule Sentry.Config do
663673
@spec traces_sampler() :: traces_sampler_function() | nil
664674
def traces_sampler, do: get(:traces_sampler)
665675

676+
@spec finch_opts() :: keyword()
677+
def finch_opts, do: fetch!(:finch_opts)
678+
666679
@spec hackney_opts() :: keyword()
667680
def hackney_opts, do: fetch!(:hackney_opts)
668681

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)