fix: Repair /metrics endpoint (#10813)
* fix: Repair /metrics endpoint * Return back change in the application.exnp-fix-forever-pending-verification
parent
5e4b8d856d
commit
e897070d84
@ -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 |
@ -1,29 +1,31 @@ |
||||
defmodule Indexer.Prometheus.Collector.FilecoinPendingAddressOperations do |
||||
@moduledoc """ |
||||
Custom collector to count number of records in filecoin_pending_address_operations table. |
||||
""" |
||||
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. |
||||
""" |
||||
|
||||
use Prometheus.Collector |
||||
use Prometheus.Collector |
||||
|
||||
alias Explorer.Chain.Filecoin.PendingAddressOperation |
||||
alias Explorer.Repo |
||||
alias Prometheus.Model |
||||
alias Explorer.Chain.Filecoin.PendingAddressOperation |
||||
alias Explorer.Repo |
||||
alias Prometheus.Model |
||||
|
||||
def collect_mf(_registry, callback) do |
||||
callback.( |
||||
create_gauge( |
||||
:filecoin_pending_address_operations, |
||||
"Number of records in filecoin_pending_address_operations table", |
||||
Repo.aggregate(PendingAddressOperation, :count, timeout: :infinity) |
||||
def collect_mf(_registry, callback) do |
||||
callback.( |
||||
create_gauge( |
||||
:filecoin_pending_address_operations, |
||||
"Number of records in filecoin_pending_address_operations table", |
||||
Repo.aggregate(PendingAddressOperation, :count, timeout: :infinity) |
||||
) |
||||
) |
||||
) |
||||
end |
||||
end |
||||
|
||||
def collect_metrics(:filecoin_pending_address_operations, count) do |
||||
Model.gauge_metrics([{count}]) |
||||
end |
||||
def collect_metrics(:filecoin_pending_address_operations, count) do |
||||
Model.gauge_metrics([{count}]) |
||||
end |
||||
|
||||
defp create_gauge(name, help, data) do |
||||
Model.create_mf(name, help, :gauge, __MODULE__, data) |
||||
defp create_gauge(name, help, data) do |
||||
Model.create_mf(name, help, :gauge, __MODULE__, data) |
||||
end |
||||
end |
||||
end |
||||
|
Loading…
Reference in new issue