Skip to content

Commit

Permalink
feat: Public metrics toggler (blockscout#10279)
Browse files Browse the repository at this point in the history
* Public metrics toggler

* Update apps/explorer/lib/explorer/chain/metrics.ex

Co-authored-by: Qwerty5Uiop <[email protected]>

---------

Co-authored-by: Qwerty5Uiop <[email protected]>
  • Loading branch information
vbaranov and Qwerty5Uiop authored Jun 19, 2024
1 parent 18c41a0 commit 33bf9ea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
9 changes: 6 additions & 3 deletions apps/explorer/lib/explorer/chain/metrics.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ###
###############
Expand Down
3 changes: 2 additions & 1 deletion docker-compose/envs/common-blockscout.env
Original file line number Diff line number Diff line change
Expand Up @@ -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
# SANITIZE_INCORRECT_WETH_CONCURRENCY=1
# METRICS_DISABLE_PUBLIC=

0 comments on commit 33bf9ea

Please sign in to comment.