Application crashes when configuring mod_metrics to exometer
I have the following config:
config :hackney,
mod_metrics: :exometer
When I try to start my Phoenix application I get:
{"Kernel pid terminated",application_controller,"{application_start_failure,hackney,{bad_return,{{hackney_app,start,[normal,[]]},{'EXIT',{{badmatch,{error,{shutdown,{failed_to_start_child,hackney_manager,{noproc,{gen_server,call,[exometer_admin,{ensure,[hackney,nb_requests],counter,[]}]}}}}}},[{hackney_sup,start_link,0,[{file,\"src/hackney_sup.erl\"},{line,27}]},{application_master,start_it_old,4,[{file,\"application_master.erl\"},{line,273}]}]}}}}}"}
Crash dump is being written to: erl_crash.dump...done
Kernel pid terminated (application_controller) ({application_start_failure,hackney,{bad_return,{{hackney_app,start,[normal,[]]},{'EXIT',{{badmatch,{error,{shutdown,{failed_to_start_child,hackney_manag
If I comment out the config, the application starts up and the exometer reporter works. I'm using Hackney 1.6.3, exometer_core master, exometer_influxdb master, and Erlang/OTP 19. Anyone have any ideas on what I'm doing wrong?
I created a repo that reproduces the issue in case it may help: https://github.com/ianwalter/hackney_metrics
thanks I will have a look at it.
This was caused by application order I believe. Having a different issue but closing this one.
@ianwalter I'm having the same issue / with same setup. I'm also starting hackney (httpoison) after exometer in mix.exs. What did you change in application order to get it to work?
I'm having this issue too. I get the following error on an elixir umbrella project:
** (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) /Users/paco/dev/github/cabify/product_ex_core/deps/hackney/src/hackney_sup.erl:27: :hackney_sup.start_link/0
(kernel) application_master.erl:273: :application_master.start_it_old/4
If I have the following apps configured to be started
[:httpoison, :exometer_core]
It does not work, but work if I change the order
[:exometer_core, :httpoison]
Any suggestion in how can I avoid this error. This is the exometer configuration that I'm testing
config :exometer,
predefined:
[
{
~w(hackney nb_requests)a,
:counter,
[]
},
{
~w(hackney total_requests)a,
:counter,
[]
},
{
~w(hackney finished_requests)a,
:counter,
[]
},
{
~w(hackney_pool default take_rate)a,
:histogram,
[]
},
{
~w(hackney_pool default no_socket)a,
:counter,
[]
},
{
~w(hackney_pool default in_use_count)a,
:histogram,
[]
},
{
~w(hackney_pool default free_count)a,
:histogram,
[]
},
{
~w(hackney_pool default queue_counter)a,
:histogram,
[]
}
],
reporters: [{reporter, reporter_ops}],
report: [
subscribers:
[
{
reporter,
[:hackney, :nb_requests], :value, polling_interval, true
},
{
reporter,
[:hackney, :total_requests], :value, polling_interval, true
},
{
reporter,
[:hackney, :finished_requests], :value, polling_interval, true
},
{
reporter,
[:hackney_pool, :default, :take_rate], histogram_stats, polling_interval, true
},
{
reporter,
[:hackney_pool, :default, :no_socket], :value, polling_interval, true
},
{
reporter,
[:hackney_pool, :default, :in_use_count], histogram_stats, polling_interval, true
},
{
reporter,
[:hackney_pool, :default, :free_count], histogram_stats, polling_interval, true
},
{
reporter,
[:hackney_pool, :default, :queue_counter], histogram_stats, polling_interval, true
}
]
]
Thanks in advance
You will need to start exometer first. It's needed so hackney can init the metrics at startup.
Cool thanks!
I am still having this issue. I am having a difficult time resolving it. I am starting exometer (elixometer) before hackney (httpoison) in my mix file, but am seeing the following error --
** (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) /Users/msmykowski/Br/djay/deps/hackney/src/hackney_sup.erl:27: :hackney_sup.start_link/0
(kernel) application_master.erl:273: :application_master.start_it_old/4```
This doesn't work when bundled into a release. Even setting the :applications explicitly and it still won't start up. 👎
@mgwidmann can you be more explict. what is the error, how applications are started’ what is the result? That would help. Also this ticket is closed, please open a new one with the details :)
@msmykowski this error means tje process of exometer is not started. what version of elixir are you running?
@benoitc more details are in #567 so we can discuss further there...