Skip to content

Commit

Permalink
Merge pull request #137 from breakroom/finch-pool-metrics
Browse files Browse the repository at this point in the history
Enable Finch pool metrics
  • Loading branch information
tomtaylor authored Jan 13, 2025
2 parents f96f8be + 275a4f9 commit 459e33b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/snap/http_client/adapters/finch.ex
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ defmodule Snap.HTTPClient.Adapters.Finch do
finch_config = [
name: connection_pool_name(cluster),
pools: %{
url => [size: size, count: 1, conn_opts: conn_opts]
url => [size: size, count: 1, conn_opts: conn_opts, start_pool_metrics?: true]
}
]

Expand Down
14 changes: 13 additions & 1 deletion test/http_client/adapters/finch_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ defmodule Snap.HTTPClient.Adapters.FinchTest do
assert {Finch,
[
name: Snap.Test.Cluster.Pool,
pools: %{"http://localhost:9200" => [size: 5, count: 1, conn_opts: []]}
pools: %{
"http://localhost:9200" => [
size: 5,
count: 1,
conn_opts: [],
start_pool_metrics?: true
]
}
]} == FinchAdapter.child_spec(config)
end

Expand Down Expand Up @@ -98,6 +105,11 @@ defmodule Snap.HTTPClient.Adapters.FinchTest do
end
end

test "should be able to retreive Finch pool metrics" do
assert {:ok, [%Finch.HTTP1.PoolMetrics{}]} =
Finch.get_pool_status(Snap.Test.Cluster.Pool, {:http, "localhost", 9200})
end

defp build_config(extra_config \\ []) do
default_config = [
cluster: Snap.Test.Cluster,
Expand Down

0 comments on commit 459e33b

Please sign in to comment.