prometheus.ex
prometheus.ex copied to clipboard
Prometheus.InvalidMetricArityError after phoenix Update
I updated phoenix to Version 1.6. After that i get the following error in the log:
[error] Handler "telemetry_web__event_handler" has failed and has been detached. Class=:error
Reason=%Prometheus.InvalidMetricArityError{expected: 2, present: 3}
Stacktrace=[
{:prometheus_metric, :check_mf_exists, 4,
[file: 'src/prometheus_metric.erl', line: 149]},
{:prometheus_histogram, :insert_placeholders, 3,
[file: 'src/metrics/prometheus_histogram.erl', line: 443]},
{:prometheus_histogram, :insert_metric, 5,
[file: 'src/metrics/prometheus_histogram.erl', line: 431]},
{:prometheus_histogram, :observe, 4,
[file: 'src/metrics/prometheus_histogram.erl', line: 203]},
{Prometheus.Metric.Histogram, :observe, 2,
[file: 'lib/prometheus/metric/histogram.ex', line: 101]},
{:telemetry, :"-execute/3-fun-0-", 4,
[
file: '/Users/david/projects/private/BetterTyping/deps/telemetry/src/telemetry.erl',
line: 150
]},
{:lists, :foreach, 2, [file: 'lists.erl', line: 1342]},
{Plug.Telemetry, :"-call/2-fun-0-", 4,
[file: 'lib/plug/telemetry.ex', line: 76]},
{Enum, :"-reduce/3-lists^foldl/2-0-", 3, [file: 'lib/enum.ex', line: 2396]},
{Plug.Conn, :run_before_send, 2, [file: 'lib/plug/conn.ex', line: 1690]},
{Plug.Conn, :send_resp, 1, [file: 'lib/plug/conn.ex', line: 399]},
{TyperacerWeb.LobbyController, :action, 2,
[file: 'lib/typeracer_web/controllers/lobby_controller.ex', line: 1]},
{TyperacerWeb.LobbyController, :phoenix_controller_pipeline, 2,
[file: 'lib/typeracer_web/controllers/lobby_controller.ex', line: 1]},
{Phoenix.Router, :__call__, 2, [file: 'lib/phoenix/router.ex', line: 355]},
{TyperacerWeb.Endpoint, :plug_builder_call, 2,
[file: 'lib/typeracer_web/endpoint.ex', line: 1]},
{TyperacerWeb.Endpoint, :"call (overridable 3)", 2,
[file: 'lib/plug/debugger.ex', line: 136]},
{TyperacerWeb.Endpoint, :call, 2,
[file: 'lib/typeracer_web/endpoint.ex', line: 1]},
{Phoenix.Endpoint.Cowboy2Handler, :init, 4,
[file: 'lib/phoenix/endpoint/cowboy2_handler.ex', line: 54]},
{:cowboy_handler, :execute, 2,
[
file: '/Users/david/projects/private/BetterTyping/deps/cowboy/src/cowboy_handler.erl',
line: 37
]},
{:cowboy_stream_h, :execute, 3,
[
file: '/Users/david/projects/private/BetterTyping/deps/cowboy/src/cowboy_stream_h.erl',
line: 306
]}
]
This is how i configure it:
application.ex:
...
Typeracer.PhoenixInstrumenter.setup()
Typeracer.PipelineInstrumenter.setup()
Typeracer.RepoInstrumenter.setup()
Prometheus.Registry.register_collector(:prometheus_process_collector)
Typeracer.PrometheusExporter.setup()
:ok =
:telemetry.attach(
"prometheus-ecto",
[:typeracer, :repo, :query],
&Typeracer.RepoInstrumenter.handle_event/4,
%{}
)
PrometheusPhx.setup()
...