Skip to content

Commit

Permalink
fix: Add /metrics handler for indexer mode (blockscout#11672)
Browse files Browse the repository at this point in the history
  • Loading branch information
Qwerty5Uiop authored Jan 16, 2025
1 parent 0966d66 commit 9fb7db3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion apps/block_scout_web/lib/block_scout_web/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ defmodule BlockScoutWeb.Application do
end

if @disable_api? do
defp setup_and_define_children, do: []
defp setup_and_define_children do
BlockScoutWeb.Prometheus.Exporter.setup()
[]
end
else
defp setup_and_define_children do
alias BlockScoutWeb.API.APILogger
Expand Down
1 change: 1 addition & 0 deletions apps/block_scout_web/lib/block_scout_web/endpoint.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ defmodule BlockScoutWeb.Endpoint do
end

if @disable_api? do
plug(BlockScoutWeb.Prometheus.Exporter)
plug(BlockScoutWeb.HealthRouter)
else
socket("/socket", BlockScoutWeb.UserSocket, websocket: [timeout: 45_000])
Expand Down
3 changes: 2 additions & 1 deletion apps/block_scout_web/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ defmodule BlockScoutWeb.Mixfile do
"lib/block_scout_web/application.ex",
"lib/block_scout_web/endpoint.ex",
"lib/block_scout_web/health_router.ex",
"lib/block_scout_web/controllers/api/v1/health_controller.ex"
"lib/block_scout_web/controllers/api/v1/health_controller.ex",
"lib/block_scout_web/prometheus/exporter.ex"
]

defp elixirc_paths(_, _), do: elixirc_paths()
Expand Down

0 comments on commit 9fb7db3

Please sign in to comment.