Skip to content

Commit

Permalink
Start Prometheus server at the end of the first slot.
Browse files Browse the repository at this point in the history
So no "metrics at 0" is emitted
  • Loading branch information
nalepae committed Oct 25, 2023
1 parent cd8bcc9 commit 9d58a5a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions eth_validator_watcher/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,6 @@ def _handler(
else None
)

start_http_server(8000)

beacon = Beacon(beacon_url)
execution = Execution(execution_url) if execution_url is not None else None
coinbase = Coinbase()
Expand All @@ -248,7 +246,7 @@ def _handler(

genesis = beacon.get_genesis()

for slot, slot_start_time_sec in slots(genesis.data.genesis_time):
for idx, (slot, slot_start_time_sec) in enumerate(slots(genesis.data.genesis_time)):
if slot < 0:
chain_start_in_sec = -slot * NB_SECOND_PER_SLOT
days, hours, minutes, seconds = convert_seconds_to_dhms(chain_start_in_sec)
Expand Down Expand Up @@ -438,3 +436,6 @@ def _handler(

if liveness_file is not None:
write_liveness_file(liveness_file)

if idx == 0:
start_http_server(8000)

0 comments on commit 9d58a5a

Please sign in to comment.