Updated docs in prom_ex module
This commit is contained in:
parent
721fece9ba
commit
28c8f30788
1 changed files with 1 additions and 51 deletions
|
|
@ -1,55 +1,6 @@
|
||||||
defmodule Pinchflat.PromEx do
|
defmodule Pinchflat.PromEx do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Be sure to add the following to finish setting up PromEx:
|
Configuration for the PromEx library which provides Prometheus metrics
|
||||||
|
|
||||||
1. Update your configuration (config.exs, dev.exs, prod.exs, releases.exs, etc) to
|
|
||||||
configure the necessary bit of PromEx. Be sure to check out `PromEx.Config` for
|
|
||||||
more details regarding configuring PromEx:
|
|
||||||
```
|
|
||||||
config :pinchflat, Pinchflat.PromEx,
|
|
||||||
disabled: false,
|
|
||||||
manual_metrics_start_delay: :no_delay,
|
|
||||||
drop_metrics_groups: [],
|
|
||||||
grafana: :disabled,
|
|
||||||
metrics_server: :disabled
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Add this module to your application supervision tree. It should be one of the first
|
|
||||||
things that is started so that no Telemetry events are missed. For example, if PromEx
|
|
||||||
is started after your Repo module, you will miss Ecto's init events and the dashboards
|
|
||||||
will be missing some data points:
|
|
||||||
```
|
|
||||||
def start(_type, _args) do
|
|
||||||
children = [
|
|
||||||
Pinchflat.PromEx,P
|
|
||||||
|
|
||||||
...
|
|
||||||
]
|
|
||||||
|
|
||||||
...
|
|
||||||
end
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Update your `endpoint.ex` file to expose your metrics (or configure a standalone
|
|
||||||
server using the `:metrics_server` config options). Be sure to put this plug before
|
|
||||||
your `Plug.Telemetry` entry so that you can avoid having calls to your `/metrics`
|
|
||||||
endpoint create their own metrics and logs which can pollute your logs/metrics given
|
|
||||||
that Prometheus will scrape at a regular interval and that can get noisy:
|
|
||||||
```
|
|
||||||
defmodule PinchflatWeb.Endpoint do
|
|
||||||
use Phoenix.Endpoint, otp_app: :pinchflat
|
|
||||||
|
|
||||||
...
|
|
||||||
|
|
||||||
plug PromEx.Plug, prom_ex_module: Pinchflat.PromEx
|
|
||||||
|
|
||||||
...
|
|
||||||
end
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Update the list of plugins in the `plugins/0` function return list to reflect your
|
|
||||||
application's dependencies. Also update the list of dashboards that are to be uploaded
|
|
||||||
to Grafana in the `dashboards/0` function.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
use PromEx, otp_app: :pinchflat
|
use PromEx, otp_app: :pinchflat
|
||||||
|
|
@ -71,7 +22,6 @@ defmodule Pinchflat.PromEx do
|
||||||
@impl true
|
@impl true
|
||||||
def dashboard_assigns do
|
def dashboard_assigns do
|
||||||
[
|
[
|
||||||
# datasource_id: "prometheus",
|
|
||||||
default_selected_interval: "30s"
|
default_selected_interval: "30s"
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue