Open woylie opened 1 year ago
Have similar situation:
MainApp.Repo
Admin.Endpoint
and routerUser.Endpoint
and routerI tried doing it like this (stuff omitted for brevity):
Main app
defmodule MainApp.Application do
def start(_type, _args) do
children = [
# Telemetry supervisor
MainApp.Telemetry,
# Start before Ecto, to be able to capture init events
MainApp.Observability.PromEx,
MainApp.Repo
]
OpentelemetryEcto.setup(MainApp.Repo.config()[:telemetry_prefix])
end
end
defmodule MainApp.Observability.PromEx do
use PromEx, otp_app: :main_app
def plugins do
[
Plugins.Application,
Plugins.Beam,
Plugins.Ecto
]
end
def dashboards do
[
{:prom_ex, "application.json"},
{:prom_ex, "beam.json"},
{:prom_ex, "ecto.json"},
{:prom_ex, "plug_cowboy.json"},
{:prom_ex, "plug_router.json"},
{:prom_ex, "phoenix.json"}
]
end
end
Admin Web
defmodule AdminWeb.Application do
def start(_type, _args) do
children = [
AdminWeb.Endpoint,
# Start after the Endpoint, to avoid unnecessary error messages
AdminWeb.Observability.PromEx
]
OpentelemetryPhoenix.setup(adapter: :cowboy, endpoint_prefix: [:phoenix, :endpoint, :admin_web])
end
end
defmodule AdminWeb.Observability.PromEx do
use PromEx, otp_app: :admin_web
def plugins do
[
{Plugins.PlugRouter, routers: [AdminWeb.Router], event_prefix: [:admin_web, :router], ignore_routes: ["/metrics"]},
{Plugins.Phoenix, router: AdminWeb.Router, endpoint: AdminWeb.Endpoint},
Plugins.PhoenixLiveView
]
end
def dashboards do
[
{:prom_ex, "application.json"},
{:prom_ex, "beam.json"},
{:prom_ex, "ecto.json"},
{:prom_ex, "plug_cowboy.json"},
{:prom_ex, "plug_router.json"},
{:prom_ex, "phoenix.json"}
]
end
end
User Web
defmodule UserWeb.Application do
def start(_type, _args) do
children = [
UserWeb.Endpoint,
# Start after the Endpoint, to avoid unnecessary error messages
UserWeb.Observability.PromEx
]
OpentelemetryPhoenix.setup(adapter: :cowboy, endpoint_prefix: [:phoenix, :endpoint, :user_web])
end
end
defmodule UserWeb.Observability.PromEx do
use PromEx, otp_app: :user_web
def plugins do
[
{Plugins.PlugRouter, routers: [UserWeb.Router], event_prefix: [:user_web, :router], ignore_routes: ["/metrics"]},
{Plugins.Phoenix, router: UserWeb.Router, endpoint: UserWeb.Endpoint},
Plugins.PhoenixLiveView
]
end
def dashboards do
[
{:prom_ex, "application.json"},
{:prom_ex, "beam.json"},
{:prom_ex, "ecto.json"},
{:prom_ex, "plug_cowboy.json"},
{:prom_ex, "plug_router.json"},
{:prom_ex, "phoenix.json"}
]
end
end
Each PromEx
is configured the same, with grafana host details and each it's own configuration block.
I see dashboard folders for each app.
However, data is empty. E.g. no repo to choose for Ecto dashboard, and no instance either.
I see only metrics for :user_web
app and only phoenix and phoenix live ones.
Any ideas what may be wrong? Is it even possible to set it up for such an umbrella setup? Thank you 🙇🏼
Update: the :user_web
app indeed has option to choose e.g. the repo for Ecto dashboard, but again no data. Other Ecto dashboards totally empty, filters included.
Is there any update on supporting this?
We're having trouble making our Ecto repos appear in the dashboard in an umbrella application.
We have these apps:
my_app
: includesMyApp.Repo
my_app_web
: includes the Phoenix applicationWe put the prom_ex module into
my_app_web
, so that we can start it after the Phoenix endpoint. However, it seems that you are also expected to start prom_ex before the repo, so that it can getmy_app_prom_ex_ecto_repo_init_status_info
.Is there a workaround for umbrella applications that we can use? Or would we have to add two separate prom_ex modules, one for each app?
Related issue: https://github.com/akoutmos/prom_ex/issues/190