diff --git a/apps/explorer/lib/explorer/chain/metrics.ex b/apps/explorer/lib/explorer/chain/metrics.ex index be425b5e49a9..9958ea04cc2c 100644 --- a/apps/explorer/lib/explorer/chain/metrics.ex +++ b/apps/explorer/lib/explorer/chain/metrics.ex @@ -28,9 +28,12 @@ defmodule Explorer.Chain.Metrics do end def init(_) do - send(self(), :set_metrics) - - {:ok, %{}} + if Application.get_env(:explorer, __MODULE__, :disabled?) do + :ignore + else + send(self(), :set_metrics) + {:ok, %{}} + end end def handle_info(:set_metrics, state) do diff --git a/config/runtime.exs b/config/runtime.exs index 1674d7f57622..dfd8531baf29 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -594,6 +594,8 @@ config :explorer, Explorer.Chain.TokenTransfer, whitelisted_weth_contracts: ConfigHelper.parse_list_env_var("WHITELISTED_WETH_CONTRACTS", ""), weth_token_transfers_filtering_enabled: ConfigHelper.parse_bool_env_var("WETH_TOKEN_TRANSFERS_FILTERING_ENABLED") +config :explorer, Explorer.Chain.Metrics, disabled?: ConfigHelper.parse_bool_env_var("METRICS_DISABLE_PUBLIC", "false") + ############### ### Indexer ### ############### diff --git a/docker-compose/envs/common-blockscout.env b/docker-compose/envs/common-blockscout.env index 71ec80526a9d..23611894a5d9 100644 --- a/docker-compose/envs/common-blockscout.env +++ b/docker-compose/envs/common-blockscout.env @@ -383,4 +383,5 @@ TENDERLY_CHAIN_PATH= # WETH_TOKEN_TRANSFERS_FILTERING_ENABLED=false # WHITELISTED_WETH_CONTRACTS= # SANITIZE_INCORRECT_WETH_BATCH_SIZE=100 -# SANITIZE_INCORRECT_WETH_CONCURRENCY=1 \ No newline at end of file +# SANITIZE_INCORRECT_WETH_CONCURRENCY=1 +# METRICS_DISABLE_PUBLIC= \ No newline at end of file