diff --git a/apps/indexer/config/dev.exs b/apps/indexer/config/dev.exs index 7124cbf521..5e5eab86d9 100644 --- a/apps/indexer/config/dev.exs +++ b/apps/indexer/config/dev.exs @@ -31,6 +31,11 @@ config :logger, :empty_blocks_to_refetch, path: Path.absname("logs/dev/indexer/empty_blocks_to_refetch.log"), metadata_filter: [fetcher: :empty_blocks_to_refetch] +config :logger, :block_import_timings, + level: :debug, + path: Path.absname("logs/dev/indexer/block_import_timings.log"), + metadata_filter: [fetcher: :block_import_timings] + variant = if is_nil(System.get_env("ETHEREUM_JSONRPC_VARIANT")) do "ganache" diff --git a/apps/indexer/config/prod.exs b/apps/indexer/config/prod.exs index 0fa704c5a6..3bbb721c52 100644 --- a/apps/indexer/config/prod.exs +++ b/apps/indexer/config/prod.exs @@ -37,6 +37,11 @@ config :logger, :empty_blocks_to_refetch, metadata_filter: [fetcher: :empty_blocks_to_refetch], rotate: %{max_bytes: 52_428_800, keep: 19} +config :logger, :block_import_timings, + level: :debug, + path: Path.absname("logs/prod/indexer/block_import_timings.log"), + metadata_filter: [fetcher: :block_import_timings] + variant = if is_nil(System.get_env("ETHEREUM_JSONRPC_VARIANT")) do "parity" diff --git a/apps/indexer/lib/indexer/block/realtime/fetcher.ex b/apps/indexer/lib/indexer/block/realtime/fetcher.ex index be14d1e684..5dacd07a7d 100644 --- a/apps/indexer/lib/indexer/block/realtime/fetcher.ex +++ b/apps/indexer/lib/indexer/block/realtime/fetcher.ex @@ -364,7 +364,9 @@ defmodule Indexer.Block.Realtime.Fetcher do defp log_import_timings(%{blocks: [%{number: number, timestamp: timestamp}]}, fetch_duration, time_before) do node_delay = Timex.diff(time_before, timestamp, :seconds) - Logger.info("Block #{number} fetching duration: #{fetch_duration / 1_000_000}s. Node delay: #{node_delay}s.") + Logger.debug("Block #{number} fetching duration: #{fetch_duration / 1_000_000}s. Node delay: #{node_delay}s.", + fetcher: :block_import_timings + ) end defp log_import_timings(_inserted, _duration, _time_before), do: nil diff --git a/config/config.exs b/config/config.exs index edd96d5c06..ffdbc80032 100644 --- a/config/config.exs +++ b/config/config.exs @@ -34,7 +34,8 @@ config :logger, {LoggerFileBackend, :reading_token_functions}, {LoggerFileBackend, :pending_transactions_to_refetch}, {LoggerFileBackend, :empty_blocks_to_refetch}, - {LoggerFileBackend, :api} + {LoggerFileBackend, :api}, + {LoggerFileBackend, :block_import_timings} ] config :logger, :console,