- giro_client: remove verify: :verify_none, default to OTP :verify_peer - map_live: validate recovered_band against BandConfig and recovered_time against time_in_window?/2 to prevent stale-state breakage - prom_ex: local fork of Plugins.Phoenix that normalizes transport tag values to prevent telemetry_metrics_prometheus_core dropping series
56 lines
2 KiB
Elixir
56 lines
2 KiB
Elixir
defmodule Microwaveprop.PromEx do
|
|
@moduledoc """
|
|
Prometheus metrics exporter. Combines PromEx's built-in plugins for
|
|
Application/BEAM/Phoenix/Ecto/Oban with our own custom metrics
|
|
(Microwaveprop.Instrument spans, Oban queue-depth gauges).
|
|
|
|
A dedicated Prometheus server outside the Kubernetes cluster scrapes
|
|
`/metrics` over the app's normal HTTP endpoint. The `MicrowavepropWeb.Router`
|
|
is responsible for making that route reachable.
|
|
"""
|
|
use PromEx, otp_app: :microwaveprop
|
|
|
|
alias PromEx.Plugins
|
|
|
|
@impl true
|
|
def plugins do
|
|
# Oban plugin's queue-depth metric is a telemetry_poller that runs
|
|
# an Ecto query every 5 s; in the test env that poller has no
|
|
# sandbox connection and crashes with DBConnection.OwnershipError,
|
|
# so it's skipped there.
|
|
oban_plugin =
|
|
if Application.get_env(:microwaveprop, :prom_ex_include_oban_plugin, true),
|
|
do: [Plugins.Oban],
|
|
else: []
|
|
|
|
[
|
|
# Defaults: VM memory, process counts, scheduler util, app version.
|
|
Plugins.Application,
|
|
Plugins.Beam,
|
|
|
|
# Phoenix: request duration by route/status, channel/socket events.
|
|
# Uses a local fork that normalizes transport tag values so
|
|
# non-String.Chars transports (e.g., Phoenix.ChannelTest tuples)
|
|
# are not dropped by telemetry_metrics_prometheus_core.
|
|
{Microwaveprop.PromEx.Plugins.Phoenix, router: MicrowavepropWeb.Router, endpoint: MicrowavepropWeb.Endpoint},
|
|
|
|
# Ecto: query duration, queue time, pool size.
|
|
{Plugins.Ecto, otp_app: :microwaveprop, repos: [Microwaveprop.Repo]},
|
|
|
|
# Our own spans: Instrument.span/3 emits [:microwaveprop | suffix]
|
|
# events; this plugin converts them to Prometheus histograms.
|
|
Microwaveprop.PromEx.InstrumentPlugin
|
|
] ++ oban_plugin
|
|
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"}
|
|
]
|
|
end
|
|
end
|