ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - deadtrickster/prometheus-plugs: Prometheus.erl Elixir Plugs
Prometheus.erl Elixir Plugs. Contribute to deadtrickster/prometheus-plugs development by creating an account on GitHub.
Visit Site

GitHub - deadtrickster/prometheus-plugs: Prometheus.erl Elixir Plugs

GitHub - deadtrickster/prometheus-plugs: Prometheus.erl Elixir Plugs

Prometheus.io Plugs Instrumenter/Exporter

Build Status Module version Documentation Total Download License Last Updated

Elixir Plug integration for prometheus.ex

Quick introduction by @skosch: Monitoring Elixir apps in 2016: Prometheus/Grafana Step-by-Step Guide

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

Instrumentation

To instrument whole plug pipeline use Prometheus.PlugPipelineInstrumenter:

defmodule MyApp.Endpoint.PipelineInstrumenter do
  use Prometheus.PlugPipelineInstrumenter
end

To instrument just a single plug use Prometheus.PlugInstrumenter:

defmodule MyApp.CoolPlugInstrumenter do
  use Prometheus.PlugInstrumenter, [plug: Guardian.Plug.EnsureAuthenticated,
                                    counter: :guardian_ensure_authenticated_total,
                                    histogram: :guardian_ensure_authenticated_duration_microseconds,
                                    labels: [:authenticated]]
end

Both modules implement plug interface and Prometheus.PlugInstrumenter generates proxy for specified plug so you'll need to replace instrumented plug with your instrumenter in pipeline.

Instrumenters configured via :prometheus app environment. Please consult respective modules documentation on what options are available.

Exporting

To export metric we first have to create a plug that will serve scraping requests.

defmodule MyApp.MetricsExporter do
  use Prometheus.PlugExporter
end

Call the MyApp.MetricsExporter.setup/0 function when the application starts.

# e.g. in `application.ex`
MyApp.MetricsExporter.setup()

Then we add exporter to MyApp pipeline:

plug MyApp.MetricsExporter

You can configure path, export format and Prometheus registry via :prometheus app environment. For more information please see Prometheus.PlugExporter module documentation.

Export endpoint can be secured using HTTP Basic Authentication:

  auth: {:basic, "username", "password"}

Integrations / Collectors / Instrumenters

Installation

The package can be installed as:

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

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

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

License

This project is licensed under the MIT license. Copyright (c) 2016-present, Ilya Khaprov.

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory