deadtrickster / prometheus-phoenix

Prometheus.io Phoenix instrumenter
71 stars 20 forks source link

Confused using this lib #6

Closed epinault closed 5 years ago

epinault commented 6 years ago

I am following this doc https://hexdocs.pm/prometheus_phoenix/Prometheus.PhoenixInstrumenter.html but I am still not quite clear how I access the metrics? I don t see metrics route created.

I am quite new with Phoenix and the eco system so I might be missing something obvious . But it seems to me that you are adding an instrumenter as part the end point of the app. But I am not sure where to go from there to access those metrics

Also I noticed that this breaks

config :prometheus, MyApp.Endpoint.Instrumenter,
  controller_call_labels: [:controller, :action],
  duration_buckets: :prometheus_http.microseconds_duration_buckets(),
  registry: :default,
  duration_unit: :microseconds

I get the following error

 (Mix.Config.LoadError) could not load config apps/outreach_fairness_web/config/config.exs
    ** (UndefinedFunctionError) function :prometheus_http.microseconds_duration_buckets/0 is undefined (module :prometheus_http is not available)
    :prometheus_http.microseconds_duration_buckets()
    (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
    (stdlib) erl_eval.erl:878: :erl_eval.expr_list/6
    (stdlib) erl_eval.erl:236: :erl_eval.expr/5
    (stdlib) erl_eval.erl:228: :erl_eval.expr/5
    (stdlib) erl_eval.erl:229: :erl_eval.expr/5
    (stdlib) erl_eval.erl:878: :erl_eval.expr_list/6
    (stdlib) erl_eval.erl:236: :erl_eval.expr/5
smaximov commented 5 years ago

I am still not quite clear how I access the metrics? I don t see metrics route created

You need to use another library to export metrics from your app

epinault commented 5 years ago

thanks. I ended up using the one you linked to