7 releases
0.3.2 | Jul 26, 2023 |
---|---|
0.3.1 | Jul 20, 2023 |
0.3.0 | Jun 6, 2023 |
0.2.0 | May 26, 2023 |
0.1.2 | May 25, 2023 |
30 downloads per month
54KB
1K
SLoC
Chain Pulse
Collect packets relayed to and from a given blockchain, computing which packets are effected or not and by whom they were relayed.
The collected data is stored in a SQLite database and the metrics are exported to Prometheus.
Installation
-
Clone this repository
$ git clone https://github.com/informalsystems/chainpulse
-
Build the
chainpulse
executable$ cargo build --release
-
The
chainpulse
executable can now be found intarget/release
Configuration
Create a configuration file at chainpulse.toml
with the following content:
[chains]
endpoints = [
{ name = "neutron", comet_version = "0.34", url = "wss://neutron-rpc.lavenderfive.com/websocket" },
{ name = "osmosis", comet_version = "0.34", url = "wss://rpc.osmosis.zone/websocket" },
]
[database]
path = "data.db"
[metrics]
enabled = true
port = 3000
Note: The comet_version
field is optional and defaults to "0.34".
Usage
Collect and analyze txs containing IBC messages, export the collected metrics for Prometheus
Usage: chainpulse [OPTIONS]
Options:
-c, --config <CONFIG> Path to the configuration file [default: chainpulse.toml]
-h, --help Print help
Run the collector using the configuration file above to collect packet metrics on Osmosis and Neutron:
$ chainpulse --config chainpulse.toml
2023-05-26T10:17:28.378380Z INFO Metrics server listening at http://localhost:3000/metrics
2023-05-26T10:17:28.386299Z INFO collect{chain=neutron}: Connecting to wss://neutron-rpc.lavenderfive.com/websocket...
2023-05-26T10:17:28.386951Z INFO collect{chain=osmosis}: Connecting to wss://rpc.osmosis.zone/websocket...
2023-05-26T10:17:28.932084Z INFO collect{chain=neutron}: Subscribing to NewBlock events...
2023-05-26T10:17:29.012893Z INFO collect{chain=neutron}: Waiting for new blocks...
2023-05-26T10:17:29.078725Z INFO collect{chain=osmosis}: Subscribing to NewBlock events...
2023-05-26T10:17:29.254485Z INFO collect{chain=osmosis}: Waiting for new blocks...
...
Prometheus Metrics
The built-in HTTP server at /metrics
exports the following Prometheus metrics:
ibc_effected_packets{chain_id, src_channel, src_port, dst_channel, dst_port, signer, memo}
ibc_uneffected_packets{chain_id, src_channel, src_port, dst_channel, dst_port, signer, memo}
ibc_frontrun_counter{chain_id, src_channel, src_port, dst_channel, dst_port, signer, frontrunned_by, memo, effected_memo}
ibc_stuck_packets{dst_chain,src_chain,src_channel} 1
Internal metrics
The following internal metrics are also available, for monitor Chain Pulse itself:
chainpulse_chains 2
chainpulse_packets{chain_id}
chainpulse_reconnects{chain_id}
chainpulse_txs{chain_id}
Attribution
This project is heavily inspired and partly ported from @clemensgg's relayer-metrics-exporter
License
Copyright © 2023 Informal Systems Inc. and Hermes authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use the files in this repository except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Dependencies
~73MB
~1.5M SLoC