Add shrunk to metadata

Allow separating shrunk vs unshrunk to monitor how often shrinking
occurs.
pull/1214/head
Luke Imhoff 6 years ago
parent 2569d2595e
commit 65197f5913
  1. 2
      apps/block_scout_web/config/config.exs
  2. 2
      apps/ethereum_jsonrpc/config/config.exs
  3. 2
      apps/explorer/config/config.exs
  4. 2
      apps/indexer/config/config.exs
  5. 13
      apps/indexer/lib/indexer/block/catchup/bound_interval_supervisor.ex
  6. 6
      config/config.exs

@ -50,7 +50,7 @@ config :logger, :block_scout_web,
format: "$dateT$time $metadata[$level] $message\n",
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,
block_number step count error_count shrunk)a,
metadata_filter: [application: :block_scout_web]
config :spandex_phoenix, tracer: BlockScoutWeb.Tracer

@ -19,7 +19,7 @@ config :logger, :ethereum_jsonrpc,
format: "$dateT$time $metadata[$level] $message\n",
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,
block_number step count error_count shrunk)a,
metadata_filter: [application: :ethereum_jsonrpc]
# Import environment specific config. This must remain at the bottom

@ -52,7 +52,7 @@ config :logger, :explorer,
format: "$dateT$time $metadata[$level] $message\n",
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,
block_number step count error_count shrunk)a,
metadata_filter: [application: :explorer]
config :spandex_ecto, SpandexEcto.EctoLogger,

@ -21,7 +21,7 @@ config :logger, :indexer,
format: "$dateT$time $metadata[$level] $message\n",
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,
block_number step count error_count shrunk)a,
metadata_filter: [application: :indexer]
# Import environment specific config. This must remain at the bottom

@ -185,7 +185,7 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisor do
def handle_info(
{ref,
%{first_block_number: first_block_number, missing_block_count: missing_block_count, shrunk: false}},
%{first_block_number: first_block_number, missing_block_count: missing_block_count, shrunk: false = shrunk}},
%__MODULE__{
bound_interval: bound_interval,
task: %Task{ref: ref}
@ -198,7 +198,8 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisor do
Logger.info("Index already caught up.",
first_block_number: first_block_number,
last_block_number: 0,
missing_block_count: 0
missing_block_count: 0,
shrunk: shrunk
)
BoundInterval.increase(bound_interval)
@ -208,7 +209,8 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisor do
"Index had to catch up.",
first_block_number: first_block_number,
last_block_number: 0,
missing_block_count: missing_block_count
missing_block_count: missing_block_count,
shrunk: shrunk
)
BoundInterval.decrease(bound_interval)
@ -229,7 +231,7 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisor do
def handle_info(
{ref,
%{first_block_number: first_block_number, missing_block_count: missing_block_count, shrunk: true}},
%{first_block_number: first_block_number, missing_block_count: missing_block_count, shrunk: true = shrunk}},
%__MODULE__{
task: %Task{ref: ref}
} = state
@ -241,7 +243,8 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisor do
"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,
missing_block_count: missing_block_count
missing_block_count: missing_block_count,
shrunk: shrunk
)
send(self(), :catchup_index)

@ -34,14 +34,14 @@ config :logger, :console,
format: "$dateT$time $metadata[$level] $message\n",
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
block_number step count error_count shrunk)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 missing_block_range_count missing_block_count
block_number step count error_count)a,
block_number step count error_count shrunk)a,
metadata_filter: [application: :ecto]
config :logger, :error,
@ -50,7 +50,7 @@ config :logger, :error,
level: :error,
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
block_number step count error_count shrunk)a
# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.

Loading…
Cancel
Save