Current section

40 Versions

Jump to

Compare versions

12 files changed
+83 additions
-44 deletions
  @@ -1,5 +1,15 @@
1 1 # Changelog
2 2
3 + ## v0.18.0 (2024-02-09)
4 +
5 + ### Enhancements
6 +
7 + - Add Finch name to telemetry events #252
8 +
9 + ### Bug Fixes
10 +
11 + - Fix several minor dialyzer errors and run dialyzer in CI #259, #261
12 +
3 13 ## v0.17.0 (2024-01-07)
4 14
5 15 ### Enhancements
  @@ -107,7 +107,7 @@ The package can be installed by adding `finch` to your list of dependencies in `
107 107 ```elixir
108 108 def deps do
109 109 [
110 - {:finch, "~> 0.17"}
110 + {:finch, "~> 0.18"}
111 111 ]
112 112 end
113 113 ```
  @@ -2,7 +2,7 @@
2 2 [{<<"Changelog">>,<<"https://hexdocs.pm/finch/changelog.html">>},
3 3 {<<"GitHub">>,<<"https://github.com/sneako/finch">>}]}.
4 4 {<<"name">>,<<"finch">>}.
5 - {<<"version">>,<<"0.17.0">>}.
5 + {<<"version">>,<<"0.18.0">>}.
6 6 {<<"description">>,<<"An HTTP client focused on performance.">>}.
7 7 {<<"elixir">>,<<"~> 1.11">>}.
8 8 {<<"app">>,<<"finch">>}.
  @@ -44,8 +44,8 @@
44 44 <<"lib/finch/http1/pool_metrics.ex">>,<<"lib/finch/http2">>,
45 45 <<"lib/finch/http2/request_stream.ex">>,<<"lib/finch/http2/pool.ex">>,
46 46 <<"lib/finch/http2/pool_metrics.ex">>,<<"lib/finch/request.ex">>,
47 - <<"lib/finch/ssl.ex">>,<<"lib/finch/telemetry.ex">>,
48 - <<"lib/finch/response.ex">>,<<"lib/finch/pool.ex">>,
49 - <<"lib/finch/pool_manager.ex">>,<<"lib/finch.ex">>,<<".formatter.exs">>,
47 + <<"lib/finch/ssl.ex">>,<<"lib/finch/response.ex">>,
48 + <<"lib/finch/pool_manager.ex">>,<<"lib/finch/pool.ex">>,
49 + <<"lib/finch/telemetry.ex">>,<<"lib/finch.ex">>,<<".formatter.exs">>,
50 50 <<"mix.exs">>,<<"README.md">>,<<"LICENSE.md">>,<<"CHANGELOG.md">>]}.
51 51 {<<"build_tools">>,[<<"mix">>]}.
  @@ -90,7 +90,7 @@ defmodule Finch do
90 90 ],
91 91 start_pool_metrics?: [
92 92 type: :boolean,
93 - doc: "When true, pool metrics will be collected and avaiable through Finch.pool_status/2",
93 + doc: "When true, pool metrics will be collected and available through Finch.pool_status/2",
94 94 default: false
95 95 ]
96 96 ]
  @@ -104,7 +104,7 @@ defmodule Finch do
104 104
105 105 @type scheme_host_port() :: {scheme(), host :: String.t(), port :: :inet.port_number()}
106 106
107 - @type request_opt() :: {:pool_timeout, pos_integer()} | {:receive_timeout, pos_integer()}
107 + @type request_opt() :: {:pool_timeout, timeout()} | {:receive_timeout, timeout()}
108 108
109 109 @typedoc """
110 110 Options used by request functions.
  @@ -360,10 +360,9 @@ defmodule Finch do
360 360 {:ok, acc} | {:error, Exception.t()}
361 361 when acc: term()
362 362 def stream(%Request{} = req, name, acc, fun, opts \\ []) when is_function(fun, 2) do
363 - fun =
364 - fn entry, acc ->
365 - {:cont, fun.(entry, acc)}
366 - end
363 + fun = fn entry, acc ->
364 + {:cont, fun.(entry, acc)}
365 + end
367 366
368 367 stream_while(req, name, acc, fun, opts)
369 368 end
  @@ -427,7 +426,7 @@ defmodule Finch do
427 426
428 427 defp __stream__(%Request{} = req, name, acc, fun, opts) do
429 428 {pool, pool_mod} = get_pool(req, name)
430 - pool_mod.request(pool, req, acc, fun, opts)
429 + pool_mod.request(pool, req, acc, fun, name, opts)
431 430 end
432 431
433 432 @doc """
  @@ -560,7 +559,7 @@ defmodule Finch do
560 559 @spec async_request(Request.t(), name(), request_opts()) :: request_ref()
561 560 def async_request(%Request{} = req, name, opts \\ []) do
562 561 {pool, pool_mod} = get_pool(req, name)
563 - pool_mod.async_request(pool, req, opts)
562 + pool_mod.async_request(pool, req, name, opts)
564 563 end
565 564
566 565 @doc """
  @@ -17,22 +17,24 @@ defmodule Finch.HTTP1.Conn do
17 17 }
18 18 end
19 19
20 - def connect(%{mint: mint} = conn) when not is_nil(mint) do
20 + def connect(%{mint: mint} = conn, name) when not is_nil(mint) do
21 21 meta = %{
22 22 scheme: conn.scheme,
23 23 host: conn.host,
24 - port: conn.port
24 + port: conn.port,
25 + name: name
25 26 }
26 27
27 28 Telemetry.event(:reused_connection, %{}, meta)
28 29 {:ok, conn}
29 30 end
30 31
31 - def connect(%{mint: nil} = conn) do
32 + def connect(%{mint: nil} = conn, name) do
32 33 meta = %{
33 34 scheme: conn.scheme,
34 35 host: conn.host,
35 - port: conn.port
36 + port: conn.port,
37 + name: name
36 38 }
37 39
38 40 start_time = Telemetry.start(:connect, meta)
  @@ -98,12 +100,12 @@ defmodule Finch.HTTP1.Conn do
98 100 end
99 101 end
100 102
101 - def request(%{mint: nil} = conn, _, _, _, _, _, _), do: {:error, conn, "Could not connect"}
103 + def request(%{mint: nil} = conn, _, _, _, _, _, _, _), do: {:error, conn, "Could not connect"}
102 104
103 - def request(conn, req, acc, fun, receive_timeout, request_timeout, idle_time) do
105 + def request(conn, req, acc, fun, name, receive_timeout, request_timeout, idle_time) do
104 106 full_path = Finch.Request.request_path(req)
105 107
106 - metadata = %{request: req}
108 + metadata = %{request: req, name: name}
107 109
108 110 extra_measurements = %{idle_time: idle_time}
Loading more files…