Repository navigation
Add basic RPC extractor with getpeerinfo support - #191
Merged
Merged
Conversation
This was referenced Jul 30, 2025
Collaborator
Author
|
CI failure: (that should be extended for extractors too!) |
0xB10C
force-pushed
the
2025-07-rpc-extractor
branch
from
July 31, 2025 09:13
eb6aab6 to
b21e152
Compare
This is being used in the next commit by the metrics exporter and allows to confirm that the RPC exporter is working. However, it isn't nesscessary for the functionallity of the RPC exporter and not strictly needed in this PR. We don't maintain a text file list of the IP addresses, as LinkingLion has 3x IPv4 /24 and 1x IPv6 /64 networks. Putting these into a text file, especially the /64, would be wasteful. Rather, use starts_with to reduce the functions footprint.
0xB10C
force-pushed
the
2025-07-rpc-extractor
branch
2 times, most recently
from
July 31, 2025 10:42
8075bcc to
7935e44
Compare
0xB10C
commented
Jul 31, 2025
| interval.tick().await; | ||
|
|
||
| if let Err(e) = getpeerinfo(&rpc_client, &nats_client).await { | ||
| log::error!("Could not fetch and publish 'getpeerinfo': {}", e) |
Collaborator
Author
There was a problem hiding this comment.
This looks something like
ERROR [rpc] Could not fetch and publish 'getpeerinfo': RPC error: JSON-RPC error: transport error: http (status: 401, body: )
0xB10C
commented
Jul 31, 2025
0xB10C
commented
Jul 31, 2025
| lazy_static = "1.5.0" | ||
| # for the rpc exporter | ||
| # TODO: when #310 is merged and 0.9.0 is release, switch to that. | ||
| corepc-client = { git = "https://github.com/0xb10c/corepc.git", branch = "2025-07-peer-observer-rpc-extractor", features = ["client-sync"]} |
Collaborator
Author
There was a problem hiding this comment.
PR 310 is merged, but we still need to wait for version 0.9.0 to be able to use it without patches
0xB10C
force-pushed
the
2025-07-rpc-extractor
branch
from
July 31, 2025 10:50
7935e44 to
ea6952f
Compare
Collaborator
Author
|
Would be cool to support bitcoin/bitcoin#31672 too - but that would be a temporary field and require a change in corepc, and running a custom Bitcoin Core node. Not something to be done here. |
0xB10C
force-pushed
the
2025-07-rpc-extractor
branch
from
July 31, 2025 12:14
ea6952f to
19b70d6
Compare
0xB10C
marked this pull request as ready for review
July 31, 2025 12:15
Collaborator
Author
|
I'm considering this PR ready feature-wise and will start testing it on some of my nodes now. |
This adds an RPC extractor that connects to a Bitcoin Core node and queries RPCs for data in an interval (currently 10s). The data is then send into NATS and can be consumed by tools. As a start, getpeerinfo is implemented. It uses rust-bitcoin/corepc and their non-production, sync RPC client. A custom RPC client can be implemented in the future, if needed. It requires rust-bitcoin/corepc#310 to be merged and released. Until then, a custom branch is being used. Basic logger, websocket, and metrics tool support has been implemented. The websocket web pages can be updated to use data the and the metric tool can be built out to allow for more metrics.
0xB10C
force-pushed
the
2025-07-rpc-extractor
branch
from
July 31, 2025 16:24
19b70d6 to
0d1b10c
Compare
Collaborator
Author
|
renamed the binary from |
Collaborator
Author
|
I've tested the logger, metrics and websocket tool with this. I think this is ready for merge. I'll open issues for the open tasks. |
This was referenced Aug 1, 2025
This was referenced Aug 1, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds an RPC extractor that connects to a Bitcoin Core node and queries RPCs for data in an interval (currently 10s). The data is then send into NATS and can be consumed by tools. As a start, the
getpeerinfoRPC is implemented.It uses rust-bitcoin/corepc and their non-production, sync RPC client. A custom RPC client can be implemented in the future, if needed. It requires rust-bitcoin/corepc#310 to be merged and released. Until then, a custom branch is being used.
Basic logger, websocket, and metrics tool support has been implemented. The websocket web pages can be updated to use data the and the metric tool can be built out to allow for more metrics.
Required before merge:
To be done as followups (best tracked in their own issues)
corepccreate once they do a release #196 )netinfo.htmlpage that uses the RPC events #197)metrics(metrics tool: add more metrics based on the getpeerinfo RPC event data #198)uptime, for example (rpc-extractor: add more RPCs (uptime, getmemoryinfo, ...) #199)cpu_loadfrom bitcoin/bitcoin #31672 #200)as part of the RPC event oras prometheus metrics (rpc-extractor: offer RPC fetch timings and errors via a prometheus server #201)