Repository navigation
rpc-extractor: add uptime and getnettotals support - #302
Conversation
|
i'll make other PR addingPrometheus metrics support for the new uptime and getnettotals RPCs. |
|
Awesome, thanks. Did a first pass and code looks good. I want to play around with this a bit.
You might need to add a stub, otherwise the compilation and tests will fail: |
|
feel free to just add a match arm similar to: &shared::protobuf::rpc::rpc_event::Event::Uptime(_) | &shared::protobuf::rpc::rpc_event::Event::NetTotals(_) => {},in metrics for now. As for metrics, uptime should probably just be a prometheus IntGauge. For |
|
You probably also want to add the new command line flag in the tests. See CI failure :) You can run the build and tests locally with Additionally, it would be good to have tests for these events similar to the other RPC tests. See e.g. peer-observer/extractors/rpc/tests/integration.rs Lines 120 to 144 in 3b4b091 |
|
Hi @0xB10C, Apologies for the CI spam! I've now addressed all the issues: Changes Made:
Test Results:✅ test_integration_rpc_getmempoolinfo ... ok All 40 metrics integration tests also pass. Ready for another look when you have time. Thanks for the feedback! |
| // total_bytes_received and total_bytes_sent are u64, so they're always >= 0 | ||
| // Just verify the event was received correctly |
There was a problem hiding this comment.
I don't think that's true. u64 can be 0!
|
Thanks! I see a few minor things to fixup. Will do them myself and push them here to save on the extra review-roundtrip. Afterwards, this should be ready for merge. |
a18b21f to
6638cb3
Compare
|
I split this up into two clean commits, ran |
Implements two new RPC queries to the rpc-extractor:
Both RPCs follow the established pattern with:
The uptime RPC is particularly lightweight (4-5ms response time) and
provides a simple metric for node health monitoring. The getnettotals
RPC exposes network traffic statistics useful for bandwidth analysis.
Partially addresses #199.