Feat/watchdog tick metrics file#24
Conversation
Give operators a Prometheus textfile per tick so they can push or scrape watchdog health without parsing logs. Includes chain/app labels, exit-code mapping, divergence kind on failure, docs, golden fixtures, and tests.
|
Tested it using the instructions at https://github.com/cartesi/sequencer/blob/main/docs/watchdog/getting-started.md#path-b--interactive-sequencer--watchdog-two-terminals and when running tick I get It should be |
|
Another round of tests on my side, and now I'm getting this CURL error and I can't solve it. The error message is not clear to me at where it's trying to connect to. At least I could see that the .prom file is populated with the |
|
@endersonmaia Hey Enderson — pushed fixes for both. chain="unknown" — devnet exports didn't include CARTESI_WATCHDOG_BLOCKCHAIN_ID, and your existing state dir had no chain id from init. Now: just devnet-for-watchdog exports CARTESI_WATCHDOG_BLOCKCHAIN_ID=31337 CURL error — improved the message to include the URL, e.g.: GET http://127.0.0.1:.../finalized_state/inclusion_block failed: [CURL-EASY][COULDNT_CONNECT] ... Your second run looks like the sequencer wasn't reachable (stack stopped or wrong CARTESI_WATCHDOG_SEQUENCER_URL from stale exports). state=warning in .prom is correct for that — tick failed after retries but it's not a divergence. Let me know if it works on your side after pulling. |
Populate status.prom chain from env, persisted config, or eth_chainId; export CARTESI_WATCHDOG_BLOCKCHAIN_ID from devnet-for-watchdog. Include the request URL in curl failures so tick connection errors are actionable.
aff2dde to
cec3c60
Compare
endersonmaia
left a comment
There was a problem hiding this comment.
It's working. Just small comments.
I'm not sure if these two metrics are necessary, but won't block for it.
cartesi_watchdog_last_tick_unix_seconds
Be it pull based or push based, prometheus already awaits for a timestamp attached to every metric. Unless it's an information that's relevant to the sequencer itself.
cartesi_watchdog_exit_code
If this is already mapped to the status, it's redundant and not necessary.
Ex.:
exit_code = 0 -> state=ok
exit_code = 1 -> state=watning
exit_code = 2 -> state=failed
This would reduce the number of metrics we need to keep around and less code to manage.
|
While testing, I noticed that the the services started by Not sure if we should be worried, but it would be nive to have some logs about it and do some long duration tests just to be sure. For ex., I let this running and left for lunch and came back trying to run a couple of Since the port information was kept in the .json, I had to remove and run |
|
@endersonmaia, thanks for the update. I'm going to investigate deeper into the issues you brought up! Thanks for the review — good catch on the redundant gauges. I dropped cartesi_watchdog_last_tick_unix_seconds and cartesi_watchdog_exit_code. Status is just state=ok|warning|failed (+ divergence_info on failed). Exit codes still map the same way for the process itself. On the silent devnet-for-watchdog death: that was the local harness only waiting on Ctrl+C, so when the sequencer child died overnight/lunch the parent just sat there. Terminal 1 now polls the child, prints exit status + log path + a log tail, and exits. Also a 1-minute heartbeat so it's clearer the stack is still alive. On ports after restart: yes — ephemeral ports + new Anvil history. Tick now honors CARTESI_WATCHDOG_SEQUENCER_URL from the environment even after init, so you can paste the new exports without editing config.json. Fresh Anvil history still needs a clean state dir + init (rm -rf /tmp/watchdog-state-devnet). Pull latest and you should see the slimmed .prom + clearer stack exit logging. |
Drop redundant last_tick/exit_code gauges (state already maps exit codes; Prometheus timestamps samples). Allow tick-time SEQUENCER_URL override for ephemeral ports, and make devnet-stack report child exits with log paths instead of going quiet after a lunch leave.
No description provided.