Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ jobs:
- pair:
elixir: "1.18"
otp: "28"
- pair:
elixir: "1.19"
otp: "28"
lint: lint
distribution: distribution
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6

- uses: erlef/setup-beam@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ defmodule BroadwayDashboard.MixProject do
{:plug_cowboy, "~> 2.0", only: :dev},
{:jason, "~> 1.0", only: [:dev, :test, :docs]},
{:ex_doc, "~> 0.24", only: [:docs], runtime: false},
{:stream_data, "~> 0.5", only: [:dev, :test]},
{:stream_data, "~> 1.0", only: [:dev, :test]},
{:floki, "~> 0.34", only: :test}
]
end
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"plug_cowboy": {:hex, :plug_cowboy, "2.7.1", "87677ffe3b765bc96a89be7960f81703223fe2e21efa42c125fcd0127dd9d6b2", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "02dbd5f9ab571b864ae39418db7811618506256f6d13b4a45037e5fe78dc5de3"},
"plug_crypto": {:hex, :plug_crypto, "2.1.0", "f44309c2b06d249c27c8d3f65cfe08158ade08418cf540fd4f72d4d6863abb7b", [:mix], [], "hexpm", "131216a4b030b8f8ce0f26038bc4421ae60e4bb95c5cf5395e1421437824c4fa"},
"ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
"stream_data": {:hex, :stream_data, "0.6.0", "e87a9a79d7ec23d10ff83eb025141ef4915eeb09d4491f79e52f2562b73e5f47", [:mix], [], "hexpm", "b92b5031b650ca480ced047578f1d57ea6dd563f5b57464ad274718c9c29501c"},
"stream_data": {:hex, :stream_data, "1.2.0", "58dd3f9e88afe27dc38bef26fce0c84a9e7a96772b2925c7b32cd2435697a52b", [:mix], [], "hexpm", "eb5c546ee3466920314643edf68943a5b14b32d1da9fe01698dc92b73f89a9ed"},
"telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"},
"telemetry_metrics": {:hex, :telemetry_metrics, "1.0.0", "29f5f84991ca98b8eb02fc208b2e6de7c95f8bb2294ef244a176675adc7775df", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "f23713b3847286a534e005126d4c959ebcca68ae9582118ce436b521d1d47d5d"},
"websock": {:hex, :websock, "0.5.3", "2f69a6ebe810328555b6fe5c831a851f485e303a7c8ce6c5f675abeb20ebdadc", [:mix], [], "hexpm", "6105453d7fac22c712ad66fab1d45abdf049868f253cf719b625151460b8b453"},
Expand Down
20 changes: 10 additions & 10 deletions test/support/broadway_support.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ defmodule BroadwayDashboard.BroadwaySupport do
defmodule ForwarderViaName do
use Broadway

# For some reason, this module needs to always be compiled in order
# to see the "process_name/2" function implemented.
# TODO: investigate
def __mix_recompile__?(), do: true

def process_name({:via, registry, {registry_name, name}}, base_name) do
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1) test shutdown server when there is no listener via name (BroadwayDashboard.MetricsTest)
Error:      test/broadway_dashboard/metrics_test.exs:89
     ** (EXIT from #PID<0.381.0>) an exception was raised:
         ** (ArgumentError) expected Broadway to be started with an atom :name, got: {:via, Registry, {BroadwayDashboardTestRegistry, :metrics_test}}

     If starting Broadway with a :name that is not an atom, you must define the process_name/2 callback in the module which calls "use Broadway" (see the documentation).

             (broadway 1.1.0) lib/broadway/topology.ex:490: Broadway.Topology.default_process_name/2
             (broadway 1.1.0) lib/broadway/topology.ex:165: Broadway.Topology.put_terminator/1
             (broadway 1.1.0) lib/broadway/topology.ex:160: Broadway.Topology.init_config/2
             (broadway 1.1.0) lib/broadway/topology.ex:57: Broadway.Topology.init/1
             (stdlib 7.2.1) gen_server.erl:2276: :gen_server.init_it/2
             (stdlib 7.2.1) gen_server.erl:2236: :gen_server.init_it/6
             (stdlib 7.2.1) proc_lib.erl:333: :proc_lib.init_p_do_apply/3

.

  2) test subscribe a process to a pipeline and ask it to refresh stats via name (BroadwayDashboard.MetricsTest)
Error:      test/broadway_dashboard/metrics_test.exs:15
     ** (EXIT from #PID<0.410.0>) an exception was raised:
         ** (ArgumentError) expected Broadway to be started with an atom :name, got: {:via, Registry, {BroadwayDashboardTestRegistry, :metrics_test}}

     If starting Broadway with a :name that is not an atom, you must define the process_name/2 callback in the module which calls "use Broadway" (see the documentation).

             (broadway 1.1.0) lib/broadway/topology.ex:490: Broadway.Topology.default_process_name/2
             (broadway 1.1.0) lib/broadway/topology.ex:165: Broadway.Topology.put_terminator/1
             (broadway 1.1.0) lib/broadway/topology.ex:160: Broadway.Topology.init_config/2
             (broadway 1.1.0) lib/broadway/topology.ex:57: Broadway.Topology.init/1
             (stdlib 7.2.1) gen_server.erl:2276: :gen_server.init_it/2
             (stdlib 7.2.1) gen_server.erl:2236: :gen_server.init_it/6
             (stdlib 7.2.1) proc_lib.erl:333: :proc_lib.init_p_do_apply/3

.............
Finished in 0.6 seconds (0.3s async, 0.3s sync)
1 property, 37 tests, 2 failures (3 excluded)
Error: Process completed with exit code 2.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean tests are failing? But they seem to be passing below?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test failed without the changes on Elixir 1.19.

{:via, registry, {registry_name, {name, base_name}}}
end
Expand All @@ -49,11 +44,16 @@ defmodule BroadwayDashboard.BroadwaySupport do
opts
)

cond do
is_atom(name) -> Forwarder
is_tuple(name) -> ForwarderViaName
end
|> Broadway.start_link([{:name, name} | opts])
module =
cond do
is_atom(name) -> Forwarder
is_tuple(name) -> ForwarderViaName
end

# Ensure the module is loaded so that function_exported?/3 works.
# OTP 28 no longer auto-loads modules in erlang:function_exported/3.
Code.ensure_loaded!(module)
Broadway.start_link(module, [{:name, name} | opts])

name
end
Expand Down