mirror of
https://github.com/kieraneglin/pinchflat.git
synced 2026-01-23 02:24:24 +00:00
[Enhancement] Add Prometheus support (#556)
* Added prometheus to deps list * WIP - screwing around with Prometheus and grafana * Added basic prometheus config * Updated docs in prom_ex module * Updated README
This commit is contained in:
parent
8a40d296c4
commit
fb27988963
9 changed files with 83 additions and 23 deletions
|
|
@ -11,6 +11,7 @@ defmodule Pinchflat.Application do
|
|||
check_and_update_timezone()
|
||||
|
||||
children = [
|
||||
Pinchflat.PromEx,
|
||||
PinchflatWeb.Telemetry,
|
||||
Pinchflat.Repo,
|
||||
# Must be before startup tasks
|
||||
|
|
|
|||
40
lib/pinchflat/prom_ex.ex
Normal file
40
lib/pinchflat/prom_ex.ex
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
defmodule Pinchflat.PromEx do
|
||||
@moduledoc """
|
||||
Configuration for the PromEx library which provides Prometheus metrics
|
||||
"""
|
||||
|
||||
use PromEx, otp_app: :pinchflat
|
||||
|
||||
alias PromEx.Plugins
|
||||
|
||||
@impl true
|
||||
def plugins do
|
||||
[
|
||||
Plugins.Application,
|
||||
Plugins.Beam,
|
||||
{Plugins.Phoenix, router: PinchflatWeb.Router, endpoint: PinchflatWeb.Endpoint},
|
||||
Plugins.Ecto,
|
||||
Plugins.Oban,
|
||||
Plugins.PhoenixLiveView
|
||||
]
|
||||
end
|
||||
|
||||
@impl true
|
||||
def dashboard_assigns do
|
||||
[
|
||||
default_selected_interval: "30s"
|
||||
]
|
||||
end
|
||||
|
||||
@impl true
|
||||
def dashboards do
|
||||
[
|
||||
{:prom_ex, "application.json"},
|
||||
{:prom_ex, "beam.json"},
|
||||
{:prom_ex, "phoenix.json"},
|
||||
{:prom_ex, "ecto.json"},
|
||||
{:prom_ex, "oban.json"},
|
||||
{:prom_ex, "phoenix_live_view.json"}
|
||||
]
|
||||
end
|
||||
end
|
||||
|
|
@ -32,6 +32,8 @@ defmodule PinchflatWeb.Endpoint do
|
|||
plug Phoenix.Ecto.CheckRepoStatus, otp_app: :pinchflat
|
||||
end
|
||||
|
||||
plug PromEx.Plug, prom_ex_module: Pinchflat.PromEx
|
||||
|
||||
plug Phoenix.LiveDashboard.RequestLogger,
|
||||
param_key: "request_logger",
|
||||
cookie_key: "request_logger"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue