Write block timing logs to a separate file

pull/5684/head
Qwerty5Uiop 2 years ago
parent b59985eb53
commit f49d3e2142
  1. 5
      apps/indexer/config/dev.exs
  2. 5
      apps/indexer/config/prod.exs
  3. 4
      apps/indexer/lib/indexer/block/realtime/fetcher.ex
  4. 3
      config/config.exs

@ -31,6 +31,11 @@ config :logger, :empty_blocks_to_refetch,
path: Path.absname("logs/dev/indexer/empty_blocks_to_refetch.log"), path: Path.absname("logs/dev/indexer/empty_blocks_to_refetch.log"),
metadata_filter: [fetcher: :empty_blocks_to_refetch] 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 = variant =
if is_nil(System.get_env("ETHEREUM_JSONRPC_VARIANT")) do if is_nil(System.get_env("ETHEREUM_JSONRPC_VARIANT")) do
"ganache" "ganache"

@ -37,6 +37,11 @@ config :logger, :empty_blocks_to_refetch,
metadata_filter: [fetcher: :empty_blocks_to_refetch], metadata_filter: [fetcher: :empty_blocks_to_refetch],
rotate: %{max_bytes: 52_428_800, keep: 19} 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 = variant =
if is_nil(System.get_env("ETHEREUM_JSONRPC_VARIANT")) do if is_nil(System.get_env("ETHEREUM_JSONRPC_VARIANT")) do
"parity" "parity"

@ -364,7 +364,9 @@ defmodule Indexer.Block.Realtime.Fetcher do
defp log_import_timings(%{blocks: [%{number: number, timestamp: timestamp}]}, fetch_duration, time_before) do defp log_import_timings(%{blocks: [%{number: number, timestamp: timestamp}]}, fetch_duration, time_before) do
node_delay = Timex.diff(time_before, timestamp, :seconds) 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 end
defp log_import_timings(_inserted, _duration, _time_before), do: nil defp log_import_timings(_inserted, _duration, _time_before), do: nil

@ -34,7 +34,8 @@ config :logger,
{LoggerFileBackend, :reading_token_functions}, {LoggerFileBackend, :reading_token_functions},
{LoggerFileBackend, :pending_transactions_to_refetch}, {LoggerFileBackend, :pending_transactions_to_refetch},
{LoggerFileBackend, :empty_blocks_to_refetch}, {LoggerFileBackend, :empty_blocks_to_refetch},
{LoggerFileBackend, :api} {LoggerFileBackend, :api},
{LoggerFileBackend, :block_import_timings}
] ]
config :logger, :console, config :logger, :console,

Loading…
Cancel
Save