deadtrickster/prometheus-ecto

Prometheus.io collector for Elixir.Ecto

Elixir

78

73 commits

updated Apr 26, 2021

See the code

README

Prometheus.io Ecto Instrumenter

Build Status Module version Documentation Total Download License Last Updated

Ecto integration for Prometheus.ex

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

Quickstart

  1. Define your instrumenter:

    defmodule MyApp.Repo.Instrumenter do
      use Prometheus.EctoInstrumenter
    end
    
  2. Call MyApp.Repo.Instrumenter.setup/0 when application starts (e.g. supervisor setup):

    MyApp.Repo.Instrumenter.setup()
    
  3. If using Ecto 2, add MyApp.Repo.Instrumenter to Repo loggers list:

    config :myapp, MyApp.Repo,
      loggers: [MyApp.Repo.Instrumenter, Ecto.LogEntry]
      # ...
    

    If using Ecto 3, attach to telemetry in your application start function:

    :ok =
      Telemetry.attach(
        "prometheus-ecto",
        [:my_app, :repo, :query],
        MyApp.Repo.Instrumenter,
        :handle_event,
        %{}
      )
    

    If using Ecto 3.1 with telemetry 0.4+:

    :ok =
      :telemetry.attach(
        "prometheus-ecto",
        [:my_app, :repo, :query],
        &MyApp.Repo.Instrumenter.handle_event/4,
        %{}
      )
    

Integrations / Collectors / Instrumenters

Installation

Available in Hex, the package can be installed as:

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

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

    def application do
      [applications: [:prometheus_ecto]]
    end
    
collector
ecto
elixir
instrumenter
monitoring
prometheus

Contributors

deadtrickster

63 commits

gmile

2 commits

tzumby

2 commits

moxley

1 commits

deadtrickster/prometheus-ecto

Prometheus.io collector for Elixir.Ecto

Elixir

78

73 commits

updated Apr 26, 2021

See the code

README

Prometheus.io Ecto Instrumenter

Build Status Module version Documentation Total Download License Last Updated

Ecto integration for Prometheus.ex

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

Quickstart

  1. Define your instrumenter:

    defmodule MyApp.Repo.Instrumenter do
      use Prometheus.EctoInstrumenter
    end
    
  2. Call MyApp.Repo.Instrumenter.setup/0 when application starts (e.g. supervisor setup):

    MyApp.Repo.Instrumenter.setup()
    
  3. If using Ecto 2, add MyApp.Repo.Instrumenter to Repo loggers list:

    config :myapp, MyApp.Repo,
      loggers: [MyApp.Repo.Instrumenter, Ecto.LogEntry]
      # ...
    

    If using Ecto 3, attach to telemetry in your application start function:

    :ok =
      Telemetry.attach(
        "prometheus-ecto",
        [:my_app, :repo, :query],
        MyApp.Repo.Instrumenter,
        :handle_event,
        %{}
      )
    

    If using Ecto 3.1 with telemetry 0.4+:

    :ok =
      :telemetry.attach(
        "prometheus-ecto",
        [:my_app, :repo, :query],
        &MyApp.Repo.Instrumenter.handle_event/4,
        %{}
      )
    

Integrations / Collectors / Instrumenters

Installation

Available in Hex, the package can be installed as:

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

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

    def application do
      [applications: [:prometheus_ecto]]
    end
    
collector
ecto
elixir
instrumenter
monitoring
prometheus

Contributors

deadtrickster

63 commits

gmile

2 commits

tzumby

2 commits

moxley

1 commits

Languages

Elixir

92.2%

Shell

7.8%