GithubHelp home page GithubHelp logo

deadtrickster / prometheus-phoenix Goto Github PK

View Code? Open in Web Editor NEW
71.0 9.0 20.0 54 KB

Prometheus.io Phoenix instrumenter

Elixir 92.02% Shell 7.92% HTML 0.07%
prometheus collector phoenix elixir instrumentation monitoring

prometheus-phoenix's Introduction

Prometheus.io Phoenix Instrumenter

Hex.pm Hex.pm Build Status Documentation

Phoenix integration for Prometheus.ex.

  • IRC: #elixir-lang on Freenode;
  • Slack: #prometheus channel - Browser or App(slack://elixir-lang.slack.com/messages/prometheus).

Metrics

Metrics implemented for the following built-in events:

  • phoenix_controller_call
    • phoenix_controller_call_duration_<duration_unit>;
  • phoenix_controller_render
    • phoenix_controller_render_duration_<duration_unit>;
  • phoenix_channel_join
    • phoenix_channel_join_duration_<duration_unit>;
  • phoenix_channel_receive
    • phoenix_channel_receive_duration_<duration_unit>.

Live endpoint

https://slackinex.herokuapp.com/metrics

Configuration

This integration is configured via :prometheus app env key. Please see Prometheus.PhoenixInstrumenter module documentation for more information.

Integrations / Collectors / Instrumenters

Installation

Available in Hex, the package can be installed as:

  1. Add prometheus_phoenix to your list of dependencies in mix.exs:

    def deps do
      [{:prometheus_phoenix, "~> 1.3.0"}]
    end
  2. Ensure prometheus_phoenix is started before your application:

    def application do
      [applications: [:prometheus_phoenix]]
    end

prometheus-phoenix's People

Contributors

deadtrickster avatar kosmas avatar markmeeus avatar oskardamkjaer avatar paveltyk avatar smaximov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prometheus-phoenix's Issues

[Question] Recommendation for Exporting Metrics

Do you have a recommendation for how I should export metrics within a Phoenix application? Your other repo deadtrickster/prometheus-plugs doesn't seem like it's built for Phoenix since it's checking the path, and Phoenix wants controllers configured for everything. I could reimplement that as a Phoenix controller, but I wanted to reach out to you first. I'm new to Elixir and Phoenix so I could just be missing something obvious. Thanks.

undefined function conn/0 when using a custom label for channel_*

The instrumenters label_value function clause for custom assumes the socket value is set:

  defp label_value(label) do
    quote do
      label_value(unquote(label), conn)
    end
  end

This will cause the compiler to throw undefined function conn/0 when using a custom label for phoenix_channel_join or phoenix_channel_receive

I have created a patch, I'll submit a PR

New telemetry handler for phoenix 1.5+ projects

Greetings @deadtrickster!

I hope all is well. I have created a project called prometheus-phx that handles the telemetry changes in phoenix 1.5. I would be happy to contribute those changes back to this project but they would be breaking changes and require a major version bump. I'm not sure what your preference would be moving forward. Do you still want to continue maintaining this project? Would you want to transfer the project? Looking forward to hearing from you :)

For those interested here is a link to the new project: https://github.com/theblitzapp/prometheus-phx

It's not a hex package yet because I'm waiting the preferred direction from deadtrickster

Confused using this lib

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

Phoenix 1.4 Phoenix.Socket struct change

It looks like in Phoenix 1.4 the Phoenix.Socket struct no longer has the :transport_name field which in turns yields the following error:

[error] Instrumenter SampleApp.PhoenixInstrumenter.phoenix_channel_join/3 failed.
** (KeyError) key :transport_name not found in: %Phoenix.Socket{assigns: %{}, channel: Phoenix.LiveReloader.Channel, channel_pid: nil, endpoint: SampleAppWeb.Endpoint, handler:
Phoenix.LiveReloader.Socket, id: nil, join_ref: "1", joined: false, private: %{log_handle_in: :debug, log_join: :info}, pubsub_server: SampleApp.PubSub, ref: nil, serializer: Phoenix.Socket.V2.JSONSerializer, topic: "phoenix:live_reload", transport: :websocket, transport_pid: #PID<0.695.0>}

Any thoughts on getting around this with Phoenix 1.4?

Thanks!

phoenix 1.5-pre: prometheus_phoenix dependency requires 1.4

Will prometheus_phoenix continue on now that telemetry is "baked in" to phoenix 1.5?

Failed to use "phoenix" (version 1.5.0-rc.0) because
  apps/faithful_word_api/mix.exs requires ~> 1.5-pre
  prometheus_phoenix (version 1.3.0) requires ~> 1.4 *

Does the latest prometheus-phoenix 1.3.0 support phoenix 1.6.x?

Hi there,
We're using the following stack:

      {:phoenix, "~> 1.6.6"},
      {:phoenix_html, "~> 3.0"},
      {:phoenix_live_view, "~> 0.17.5"},
      {:phoenix_live_dashboard, "~> 0.6"},
      {:prometheus, "~> 4.8.2"},
      {:prometheus_ex, "~> 3.0.5"},
      {:prometheus_phoenix, "~> 1.3.0"},
      {:prometheus_plugs, "~> 1.1.5"},

And the phoenix instrumenter doesn't get triggered. Could you confirm that the latest prometheus_phoenix supports phoenix 1.6.x?

Phoenix 1.3 compatible?

Currently phoenix dependency is locked on 1.2 branch. Is promeheus-phoenix compatible with phoenix 1.3?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.