Closed trinityXmontoya closed 4 years ago
I've only run this against a stable, long-running node, so I haven't had a chance to see the errors you describe.
I'll put in some work to reproduce it this week. Thanks for the report!
yo sweet work w this project tho, and np!
I think this should be resolved on the master branch now. I pushed jvstein/bitcoin-prometheus-exporter:issue-2
to Docker Hub built off the latest commit. Can you give it a test?
I'm pretty confident this is fixed. I've been testing with the docker-compose setup in 22feca181f33eb3fce5dd807065abea0ff91f126. Feel free to reopen if it's not fixed.
👋 as discussed here the bitcoin daemon will return
if you haven't yet downloaded enough transactions. because python throws a
KeyError
when accessing a key in a dict using square-bracket notation, pulling metrics will fail for lines 117-120, and stop execution (until you have seen enough transactions). If you switched to using thedict.get(key)
notation instead it would at least returnNone
as a default. I don't use Python often so i'm not sure if that affects something later on in your code but this is a major PITB to have to wait until the blockchain is seeded enough to run metrics, esp when running testnet or regtest. Based off this comment even if you started a node completely synced to the chain this may still not return values until you've been running the node a certain amount of time.I understand you may not want to switch to using
.get
everywhere because it's basically arescue nil
& could obfuscate other issues but in the event of metrics (such asestimatesmartfee
) where it's known the expected key won't exist, i'd consider different error handling.