ethereum/trinity

AttributeError: 'NoopMetricsRegistry' object has no attribute 'host'

gsalgado opened this issue · 1 comments

<bound method AsyncioIsolatedComponent._do_run of <trinity.components.builtin.syncer.component.SyncerComponent object at 0x7f550ddb0970>> raised an unexpected exception
Traceback (most recent call last):
  File "/home/salgado/virtualenvs/trinity/lib/python3.8/site-packages/asyncio_run_in_process/_child.py", line 205, in run_process
    runner(async_fn, args, to_parent)
  File "/home/salgado/virtualenvs/trinity/lib/python3.8/site-packages/asyncio_run_in_process/_child.py", line 168, in _run_on_asyncio
    result: Any = loop.run_until_complete(_do_async_fn(async_fn, args, to_parent, loop))
  File "uvloop/loop.pyx", line 1456, in uvloop.loop.Loop.run_until_complete
  File "/home/salgado/virtualenvs/trinity/lib/python3.8/site-packages/asyncio_run_in_process/_child.py", line 160, in _do_async_fn
    return await async_fn_task
  File "/home/salgado/virtualenvs/trinity/lib/python3.8/site-packages/asyncio_run_in_process/_child.py", line 85, in _handle_coro
    return await coro_task
  File "/home/salgado/src/snakecharmers/trinity/trinity/extensibility/asyncio.py", line 79, in _do_run
    await wait_first(
  File "/home/salgado/src/snakecharmers/trinity/p2p/asyncio_utils.py", line 69, in wait_first
    raise done_task.exception()
  File "/home/salgado/src/snakecharmers/trinity/trinity/components/builtin/syncer/component.py", line 391, in do_run
    await wait_first(tasks, max_wait_after_cancellation=2)
  File "/home/salgado/src/snakecharmers/trinity/p2p/asyncio_utils.py", line 69, in wait_first
    raise done_task.exception()
  File "/home/salgado/src/snakecharmers/trinity/trinity/components/builtin/syncer/component.py", line 399, in launch_sync
    await strategy.sync(
  File "/home/salgado/src/snakecharmers/trinity/trinity/components/builtin/syncer/component.py", line 232, in sync
    await manager.wait_finished()
  File "/home/salgado/virtualenvs/trinity/lib/python3.8/site-packages/async_generator/_util.py", line 42, in __aexit__
    await self._agen.asend(None)
  File "/home/salgado/virtualenvs/trinity/lib/python3.8/site-packages/async_service/asyncio.py", line 441, in background_asyncio_service
    raise MultiError(
  File "/home/salgado/virtualenvs/trinity/lib/python3.8/site-packages/async_service/base.py", line 300, in _run_and_manage_task
    await task.run()
  File "/home/salgado/virtualenvs/trinity/lib/python3.8/site-packages/async_service/asyncio.py", line 35, in run
    await self._async_fn(*self._async_fn_args)
  File "/home/salgado/src/snakecharmers/trinity/trinity/sync/beam/service.py", line 60, in run
    await self._pivot_loop()
  File "/home/salgado/src/snakecharmers/trinity/trinity/sync/beam/service.py", line 80, in _pivot_loop
    await self.sync_metrics_registry.record_pivot(latest_block)
  File "/home/salgado/src/snakecharmers/trinity/trinity/components/builtin/metrics/sync_metrics_registry.py", line 21, in record_pivot
    f'events title="beam pivot @ block {block_number}",'
AttributeError: 'NoopMetricsRegistry' object has no attribute 'host'

I guess this was introduced in 0b83cc1, @njgheorghita ?

@njgheorghita I left a commend here how I think this should be resolved 0b83cc1#r42618309