10 unstable releases (3 breaking)
0.4.1 | Nov 14, 2023 |
---|---|
0.4.0 | Oct 31, 2023 |
0.3.2 | Jul 26, 2023 |
0.3.0 | Jun 6, 2023 |
0.1.2 | May 25, 2023 |
#11 in #relayer
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:
# HELP ibc_effected_packets The number of IBC packets that are effected
# TYPE ibc_effected_packets counter
ibc_effected_packets{chain_id, src_channel, src_port, dst_channel, dst_port, signer, memo}
# HELP ibc_uneffected_packets The number of IBC packets that are not effected
# TYPE ibc_uneffected_packets counter
ibc_uneffected_packets{chain_id, src_channel, src_port, dst_channel, dst_port, signer, memo}
# HELP ibc_frontrun_counter The number of times a signer gets frontrun by the original signer
# TYPE ibc_frontrun_counter counter
ibc_frontrun_counter{chain_id, src_channel, src_port, dst_channel, dst_port, signer, frontrunned_by, memo, effected_memo}
# HELP ibc_stuck_packets The number of packets stuck on an IBC channel
# TYPE ibc_stuck_packets gauge
ibc_stuck_packets{dst_chain,src_chain,src_channel} 1
Internal metrics
The following internal metrics are also available, for monitor Chain Pulse itself:
# HELP chainpulse_chains The number of chains being monitored
# TYPE chainpulse_chains gauge
chainpulse_chains 2
# HELP chainpulse_packets The number of packets processed
# TYPE chainpulse_packets counter
chainpulse_packets{chain_id}
# HELP chainpulse_reconnects The number of times we had to reconnect to the WebSocket
# TYPE chainpulse_reconnects counter
chainpulse_reconnects{chain_id}
# HELP chainpulse_txs The number of txs processed
# TYPE chainpulse_txs counter
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
~80MB
~1.5M SLoC