Skip to content

Commit 379a0d3

Browse files
committed
first round of feedback
1 parent c8b460c commit 379a0d3

File tree

7 files changed

+28
-14
lines changed

7 files changed

+28
-14
lines changed

lib/mix/tasks/sentry.send_test_event.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ defmodule Mix.Tasks.Sentry.SendTestEvent do
6767
end
6868

6969
Mix.shell().info("current environment_name: #{inspect(to_string(Config.environment_name()))}")
70-
Mix.shell().info("finch_pool_opts: #{inspect(Config.finch_pool_opts())}\n")
70+
Mix.shell().info("Finch pool options: #{inspect(Config.finch_pool_opts(), pretty: true)}\n")
7171
end
7272

7373
defp send_event(opts) do

lib/sentry/config.ex

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ defmodule Sentry.Config do
357357
A module that implements the `Sentry.HTTPClient`
358358
behaviour. Defaults to `Sentry.FinchClient`, which uses
359359
[Finch](https://github.com/sneako/finch) as the HTTP client.
360+
*The default changed from Hackney to Finch in v10.11.0*.
360361
"""
361362
],
362363
send_max_attempts: [
@@ -368,11 +369,11 @@ defmodule Sentry.Config do
368369
],
369370
finch_pool_opts: [
370371
type: :keyword_list,
371-
default: [size: 50, conn_max_idle_time: 5000],
372+
default: [size: 50],
372373
doc: """
373374
Pool options to be passed to `Finch.start_link/1`. These options control
374375
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+
`Sentry.FinchClient`. See [Finch documentation](https://hexdocs.pm/finch/0.17.0/Finch.html#start_link/1)
376377
for available options.
377378
"""
378379
],
@@ -382,7 +383,7 @@ defmodule Sentry.Config do
382383
doc: """
383384
Request options to be passed to `Finch.request/4`. These options control
384385
individual request behavior. Only applied if `:client` is set to
385-
`Sentry.FinchClient`. See [Finch documentation](https://hexdocs.pm/finch/Finch.html#request/4)
386+
`Sentry.FinchClient`. See [Finch documentation](https://hexdocs.pm/finch/0.17.0/Finch.html#request/4)
386387
for available options.
387388
"""
388389
],
@@ -395,7 +396,10 @@ defmodule Sentry.Config do
395396
applied if `:client` is set to `Sentry.HackneyClient`.
396397
"""
397398
] ++
398-
if(Mix.env() == :test, do: [], else: [deprecated: "Use Finch instead as default client."]),
399+
if(Mix.env() == :test,
400+
do: [],
401+
else: [deprecated: "Use Finch as the default HTTP client instead."]
402+
),
399403
hackney_pool_timeout:
400404
[
401405
type: :timeout,
@@ -406,7 +410,10 @@ defmodule Sentry.Config do
406410
`Sentry.HackneyClient`.
407411
"""
408412
] ++
409-
if(Mix.env() == :test, do: [], else: [deprecated: "Use Finch instead as default client."]),
413+
if(Mix.env() == :test,
414+
do: [],
415+
else: [deprecated: "Use Finch as the default HTTP client instead."]
416+
),
410417
hackney_pool_max_connections:
411418
[
412419
type: :pos_integer,
@@ -417,7 +424,10 @@ defmodule Sentry.Config do
417424
`Sentry.HackneyClient`.
418425
"""
419426
] ++
420-
if(Mix.env() == :test, do: [], else: [deprecated: "Use Finch instead as default client."])
427+
if(Mix.env() == :test,
428+
do: [],
429+
else: [deprecated: "Use Finch as the default HTTP client instead."]
430+
)
421431
]
422432

423433
source_code_context_opts_schema = [

lib/sentry/finch_client.ex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@ defmodule Sentry.FinchClient do
33

44
@moduledoc """
55
The built-in HTTP client.
6+
67
This client implements the `Sentry.HTTPClient` behaviour.
78
It's based on the [Finch](https://github.com/sneako/finch) Elixir HTTP client,
89
which is an *optional dependency* of this library. If you wish to use another
910
HTTP client, you'll have to implement your own `Sentry.HTTPClient`. See the
1011
documentation for `Sentry.HTTPClient` for more information.
1112
Finch is built on top of [NimblePool](https://github.com/dashbitco/nimble_pool). If you need to set other pool configuration options,
12-
see "Pool Configuration Options" in the Finch documentation for details on the possible map values.
13+
see ["Pool Configuration Options"](https://hexdocs.pm/finch/Finch.html#start_link/1-pool-configuration-options)
14+
in the Finch documentation for details on the possible map values.
1315
[finch configuration options](https://hexdocs.pm/finch/Finch.html#start_link/1-pool-configuration-options)
1416
"""
17+
@moduledoc since: "10.11.0"
18+
1519
@impl true
1620
def child_spec do
1721
if Code.ensure_loaded?(Finch) do

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.FinchClient`.
5+
The default HTTP client is `Sentry.FinchClient` since v10.11.0 (it was based on Hackney before that).
66
77
To configure a different HTTP client, implement the `Sentry.HTTPClient` behaviour and
88
change the `:client` configuration:

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ defmodule Sentry.Mixfile do
100100

101101
# Optional dependencies
102102
{:hackney, "~> 1.8", optional: true},
103-
{:finch, "~> 0.19", optional: true},
103+
{:finch, "~> 0.17.0", optional: true},
104104
{:jason, "~> 1.1", optional: true},
105105
{:phoenix, "~> 1.6", optional: true},
106106
{:phoenix_live_view, "~> 0.20 or ~> 1.0", optional: true},

mix.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"acceptor_pool": {:hex, :acceptor_pool, "1.0.0", "43c20d2acae35f0c2bcd64f9d2bde267e459f0f3fd23dab26485bf518c281b21", [:rebar3], [], "hexpm", "0cbcd83fdc8b9ad2eee2067ef8b91a14858a5883cb7cd800e6fcd5803e158788"},
33
"bandit": {:hex, :bandit, "1.6.11", "2fbadd60c95310eefb4ba7f1e58810aa8956e18c664a3b2029d57edb7d28d410", [:mix], [{:hpax, "~> 1.0", [hex: :hpax, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:thousand_island, "~> 1.0", [hex: :thousand_island, repo: "hexpm", optional: false]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "543f3f06b4721619a1220bed743aa77bf7ecc9c093ba9fab9229ff6b99eacc65"},
44
"bypass": {:hex, :bypass, "2.1.0", "909782781bf8e20ee86a9cabde36b259d44af8b9f38756173e8f5e2e1fabb9b1", [:mix], [{:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: false]}, {:ranch, "~> 1.3", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "d9b5df8fa5b7a6efa08384e9bbecfe4ce61c77d28a4282f79e02f1ef78d96b80"},
5-
"castore": {:hex, :castore, "1.0.10", "43bbeeac820f16c89f79721af1b3e092399b3a1ecc8df1a472738fd853574911", [:mix], [], "hexpm", "1b0b7ea14d889d9ea21202c43a4fa015eb913021cb535e8ed91946f4b77a8848"},
5+
"castore": {:hex, :castore, "1.0.14", "4582dd7d630b48cf5e1ca8d3d42494db51e406b7ba704e81fbd401866366896a", [:mix], [], "hexpm", "7bc1b65249d31701393edaaac18ec8398d8974d52c647b7904d01b964137b9f4"},
66
"certifi": {:hex, :certifi, "2.12.0", "2d1cca2ec95f59643862af91f001478c9863c2ac9cb6e2f89780bfd8de987329", [:rebar3], [], "hexpm", "ee68d85df22e554040cdb4be100f33873ac6051387baf6a8f6ce82272340ff1c"},
77
"chatterbox": {:hex, :ts_chatterbox, "0.15.1", "5cac4d15dd7ad61fc3c4415ce4826fc563d4643dee897a558ec4ea0b1c835c9c", [:rebar3], [{:hpack, "~> 0.3.0", [hex: :hpack_erl, repo: "hexpm", optional: false]}], "hexpm", "4f75b91451338bc0da5f52f3480fa6ef6e3a2aeecfc33686d6b3d0a0948f31aa"},
88
"cowboy": {:hex, :cowboy, "2.12.0", "f276d521a1ff88b2b9b4c54d0e753da6c66dd7be6c9fca3d9418b561828a3731", [:make, :rebar3], [{:cowlib, "2.13.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "8a7abe6d183372ceb21caa2709bec928ab2b72e18a3911aa1771639bef82651e"},
@@ -19,7 +19,7 @@
1919
"erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"},
2020
"ex_doc": {:hex, :ex_doc, "0.34.2", "13eedf3844ccdce25cfd837b99bea9ad92c4e511233199440488d217c92571e8", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "5ce5f16b41208a50106afed3de6a2ed34f4acfd65715b82a0b84b49d995f95c1"},
2121
"excoveralls": {:hex, :excoveralls, "0.17.1", "83fa7906ef23aa7fc8ad7ee469c357a63b1b3d55dd701ff5b9ce1f72442b2874", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "95bc6fda953e84c60f14da4a198880336205464e75383ec0f570180567985ae0"},
22-
"finch": {:hex, :finch, "0.19.0", "c644641491ea854fc5c1bbaef36bfc764e3f08e7185e1f084e35e0672241b76d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.6.2 or ~> 1.7", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 1.1", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "fc5324ce209125d1e2fa0fcd2634601c52a787aff1cd33ee833664a5af4ea2b6"},
22+
"finch": {:hex, :finch, "0.17.0", "17d06e1d44d891d20dbd437335eebe844e2426a0cd7e3a3e220b461127c73f70", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.3", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2.6 or ~> 1.0", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "8d014a661bb6a437263d4b5abf0bcbd3cf0deb26b1e8596f2a271d22e48934c7"},
2323
"floki": {:hex, :floki, "0.37.0", "b83e0280bbc6372f2a403b2848013650b16640cd2470aea6701f0632223d719e", [:mix], [], "hexpm", "516a0c15a69f78c47dc8e0b9b3724b29608aa6619379f91b1ffa47109b5d0dd3"},
2424
"gen_stage": {:hex, :gen_stage, "1.2.1", "19d8b5e9a5996d813b8245338a28246307fd8b9c99d1237de199d21efc4c76a1", [:mix], [], "hexpm", "83e8be657fa05b992ffa6ac1e3af6d57aa50aace8f691fcf696ff02f8335b001"},
2525
"glob_ex": {:hex, :glob_ex, "0.1.11", "cb50d3f1ef53f6ca04d6252c7fde09fd7a1cf63387714fe96f340a1349e62c93", [:mix], [], "hexpm", "342729363056e3145e61766b416769984c329e4378f1d558b63e341020525de4"},

test/mix/sentry.send_test_event_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ defmodule Mix.Tasks.Sentry.SendTestEventTest do
1515
assert output =~ """
1616
Client configuration:
1717
current environment_name: "some_env"
18-
finch_pool_opts: []
18+
Finch pool options: []
1919
"""
2020

2121
assert output =~ ~s(Event not sent because the :dsn option is not set)
@@ -49,7 +49,7 @@ defmodule Mix.Tasks.Sentry.SendTestEventTest do
4949
public_key: public
5050
secret_key: secret
5151
current environment_name: "test"
52-
finch_pool_opts: []
52+
Finch pool options: []
5353
"""
5454

5555
assert output =~ "Sending test event..."

0 commit comments

Comments
 (0)