fix: Repair /metrics endpoint (#10813)

* fix: Repair /metrics endpoint

* Return back change in the application.ex
np-fix-forever-pending-verification
Victor Baranov 2 months ago committed by GitHub
parent 5e4b8d856d
commit e897070d84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 11
      apps/block_scout_web/test/block_scout_web/controllers/metrics_contoller_test.exs
  2. 21
      apps/indexer/lib/indexer/application.ex
  3. 2
      apps/indexer/lib/indexer/prometheus/collector/filecoin_pending_address_operations_collector.ex

@ -0,0 +1,11 @@
defmodule BlockScoutWeb.MetricsControllerTest do
use BlockScoutWeb.ConnCase
describe "/metrics page" do
test "renders /metrics page", %{conn: conn} do
conn = get(conn, "/metrics")
assert text_response(conn, 200)
end
end
end

@ -14,29 +14,8 @@ defmodule Indexer.Application do
alias Indexer.Memory
alias Prometheus.Registry
@default_prometheus_collectors [
Indexer.Prometheus.Collector.PendingBlockOperations
]
case Application.compile_env(:explorer, :chain_type) do
:filecoin ->
@chain_type_prometheus_collectors [
Indexer.Prometheus.Collector.FilecoinPendingAddressOperations
]
_ ->
@chain_type_prometheus_collectors []
end
@prometheus_collectors @default_prometheus_collectors ++
@chain_type_prometheus_collectors
@impl Application
def start(_type, _args) do
for collector <- @prometheus_collectors do
Registry.register_collector(collector)
end
memory_monitor_options =
case Application.get_env(:indexer, :memory_limit) do
nil -> %{}

@ -1,3 +1,4 @@
if Application.compile_env(:explorer, :chain_type) == :filecoin do
defmodule Indexer.Prometheus.Collector.FilecoinPendingAddressOperations do
@moduledoc """
Custom collector to count number of records in filecoin_pending_address_operations table.
@ -27,3 +28,4 @@ defmodule Indexer.Prometheus.Collector.FilecoinPendingAddressOperations do
Model.create_mf(name, help, :gauge, __MODULE__, data)
end
end
end

Loading…
Cancel
Save