benoitc / hackney

simple HTTP client in Erlang
Other
1.34k stars 427 forks source link

Error Starting Hackney Manager #563

Closed nitinjain1105 closed 4 years ago

nitinjain1105 commented 5 years ago

Hi @benoitc

I am trying to enable the metrics feature of hackney (from my Elixir application)

config.exs

config :hackney,
  mod_metrics: :exometer

mix.exs

      {:elixometer, "~> 1.2"},
      {:exometer_core, "~> 1.5"},
      {:pobox, "~> 1.2"}

I am getting the following error. Please help

** (Mix) Could not start application hackney: exited in: :hackney_app.start(:normal, [])
    ** (EXIT) an exception was raised:
        ** (MatchError) no match of right hand side value: {:error, {:shutdown, {:failed_to_start_child, :hackney_manager, {:noproc, {:gen_server, :call, [:exometer_admin, {:ensure, [:hackney, :nb_requests], :counter, []}]}}}}}
            (hackney) c:/dev/ged2/hydra2/apps/dispatcher/deps/hackney/src/hackney_sup.erl:27: :hackney_sup.start_link/0
            (kernel) application_master.erl:277: :application_master.start_it_old/4
2019-05-10 17:03:29.345 [info] Application hackney exited: exited in: :hackney_app.start(:normal, [])
    ** (EXIT) an exception was raised:
        ** (MatchError) no match of right hand side value: {:error, {:shutdown, {:failed_to_start_child, :hackney_manager, {:noproc, {:gen_server, :call, [:exometer_admin, {:ensure, [:hackney, :nb_requests], :counter, []}]}}}}}
            (hackney) c:/dev/ged2/hydra2/apps/dispatcher/deps/hackney/src/hackney_sup.erl:27: :hackney_sup.start_link/0
            (kernel) application_master.erl:277: :application_master.start_it_old/4
benoitc commented 4 years ago

exometer need to be started before hackney is

eclecticjohny commented 3 years ago

I'm running into the same issue with not being able to ensure exometer is started before hackney.

benoitc commented 3 years ago

un erlang you can do it by passing it to the application list.

eclecticjohny commented 3 years ago

i won't extend this closed issue too much however, this is exactly how i tried to solve the issue, moving exometer to be first in application list above hackney. this did not resolve the issue.

benoitc commented 3 years ago

i won't extend this closed issue too much however, this is exactly how i tried to solve the issue, moving exometer to be first in application list above hackney. this did not resolve the issue.

if you have still an issure, please open a new ticket and share the code/config you did. Maybe someone else could have a look.

sirius248 commented 1 year ago

I fixed the issue by adding the following

# mix.exs
def project do
    [
    ...,
      releases: [
        my_release_name: [
          applications: [exometer_core: :temporary]
        ]
      ]
    ]
  end
benoitc commented 1 year ago

thanks i will fix it in new metric hooks