diff --git a/apps/block_scout_web/config/config.exs b/apps/block_scout_web/config/config.exs index 76f3a14dd1..15cd489653 100644 --- a/apps/block_scout_web/config/config.exs +++ b/apps/block_scout_web/config/config.exs @@ -49,7 +49,8 @@ config :logger, :block_scout_web, # keep synced with `config/config.exs` format: "$dateT$time $metadata[$level] $message\n", metadata: - ~w(application fetcher request_id first_block_number last_block_number block_number step count error_count)a, + ~w(application fetcher request_id first_block_number last_block_number missing_block_range_count missing_block_count + block_number step count error_count)a, metadata_filter: [application: :block_scout_web] config :spandex_phoenix, tracer: BlockScoutWeb.Tracer diff --git a/apps/ethereum_jsonrpc/config/config.exs b/apps/ethereum_jsonrpc/config/config.exs index 7d7cae1a2a..b19e259f87 100644 --- a/apps/ethereum_jsonrpc/config/config.exs +++ b/apps/ethereum_jsonrpc/config/config.exs @@ -18,7 +18,8 @@ config :logger, :ethereum_jsonrpc, # keep synced with `config/config.exs` format: "$dateT$time $metadata[$level] $message\n", metadata: - ~w(application fetcher request_id first_block_number last_block_number block_number step count error_count)a, + ~w(application fetcher request_id first_block_number last_block_number missing_block_range_count missing_block_count + block_number step count error_count)a, metadata_filter: [application: :ethereum_jsonrpc] # Import environment specific config. This must remain at the bottom diff --git a/apps/explorer/config/config.exs b/apps/explorer/config/config.exs index c646f20772..93bef3fa36 100644 --- a/apps/explorer/config/config.exs +++ b/apps/explorer/config/config.exs @@ -51,7 +51,8 @@ config :logger, :explorer, # keep synced with `config/config.exs` format: "$dateT$time $metadata[$level] $message\n", metadata: - ~w(application fetcher request_id first_block_number last_block_number block_number step count error_count)a, + ~w(application fetcher request_id first_block_number last_block_number missing_block_range_count missing_block_count + block_number step count error_count)a, metadata_filter: [application: :explorer] config :spandex_ecto, SpandexEcto.EctoLogger, diff --git a/apps/indexer/config/config.exs b/apps/indexer/config/config.exs index 1253c81bfb..efdff5b833 100644 --- a/apps/indexer/config/config.exs +++ b/apps/indexer/config/config.exs @@ -20,7 +20,8 @@ config :logger, :indexer, # keep synced with `config/config.exs` format: "$dateT$time $metadata[$level] $message\n", metadata: - ~w(application fetcher request_id first_block_number last_block_number block_number step count error_count)a, + ~w(application fetcher request_id first_block_number last_block_number missing_block_range_count missing_block_count + block_number step count error_count)a, metadata_filter: [application: :indexer] # Import environment specific config. This must remain at the bottom diff --git a/apps/indexer/lib/indexer/block/catchup/bound_interval_supervisor.ex b/apps/indexer/lib/indexer/block/catchup/bound_interval_supervisor.ex index cd745e5b08..42df80c7cb 100644 --- a/apps/indexer/lib/indexer/block/catchup/bound_interval_supervisor.ex +++ b/apps/indexer/lib/indexer/block/catchup/bound_interval_supervisor.ex @@ -195,21 +195,20 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisor do new_bound_interval = case missing_block_count do 0 -> - Logger.info(fn -> "Index already caught up." end, first_block_number: first_block_number, last_block_number: 0) + Logger.info("Index already caught up.", + first_block_number: first_block_number, + last_block_number: 0, + missing_block_count: 0 + ) BoundInterval.increase(bound_interval) _ -> Logger.info( - fn -> - [ - "Index had to catch up ", - to_string(missing_block_count), - " blocks." - ] - end, + "Index had to catch up.", first_block_number: first_block_number, - last_block_number: 0 + last_block_number: 0, + missing_block_count: missing_block_count ) BoundInterval.decrease(bound_interval) @@ -239,15 +238,10 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisor do Process.demonitor(ref, [:flush]) Logger.info( - fn -> - [ - "Index had to catch up ", - to_string(missing_block_count), - " blocks, but the sequence was shrunk to save memory, so retrying immediately." - ] - end, + "Index had to catch up, but the sequence was shrunk to save memory, so retrying immediately.", first_block_number: first_block_number, - last_block_number: 0 + last_block_number: 0, + missing_block_count: missing_block_count ) send(self(), :catchup_index) diff --git a/apps/indexer/lib/indexer/block/catchup/fetcher.ex b/apps/indexer/lib/indexer/block/catchup/fetcher.ex index 5b2e4bd31c..f7206dc094 100644 --- a/apps/indexer/lib/indexer/block/catchup/fetcher.ex +++ b/apps/indexer/lib/indexer/block/catchup/fetcher.ex @@ -82,9 +82,10 @@ defmodule Indexer.Block.Catchup.Fetcher do |> Stream.map(&Enum.count/1) |> Enum.sum() - Logger.debug(fn -> - [to_string(missing_block_count), " missed blocks in ", to_string(range_count), " ranges"] - end) + Logger.debug(fn -> "Missed blocks in ranges." end, + missing_block_range_count: range_count, + missing_block_count: missing_block_count + ) shrunk = case missing_block_count do diff --git a/config/config.exs b/config/config.exs index d6f5430e59..65975fc60e 100644 --- a/config/config.exs +++ b/config/config.exs @@ -32,20 +32,25 @@ config :logger, config :logger, :console, # Use same format for all loggers, even though the level should only ever be `:error` for `:error` backend format: "$dateT$time $metadata[$level] $message\n", - metadata: ~w(application fetcher request_id first_block_number last_block_number block_number step count error_count)a + metadata: + ~w(application fetcher request_id first_block_number last_block_number missing_block_range_count missing_block_count + block_number step count error_count)a config :logger, :ecto, # Use same format for all loggers, even though the level should only ever be `:error` for `:error` backend format: "$dateT$time $metadata[$level] $message\n", metadata: - ~w(application fetcher request_id first_block_number last_block_number block_number step count error_count)a, + ~w(application fetcher request_id first_block_number last_block_number missing_block_range_count missing_block_count + block_number step count error_count)a, metadata_filter: [application: :ecto] config :logger, :error, # Use same format for all loggers, even though the level should only ever be `:error` for `:error` backend format: "$dateT$time $metadata[$level] $message\n", level: :error, - metadata: ~w(application fetcher request_id first_block_number last_block_number block_number step count error_count)a + metadata: + ~w(application fetcher request_id first_block_number last_block_number missing_block_range_count missing_block_count + block_number step count error_count)a # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above.