chainpulse

Crates.iochainpulse
lib.rschainpulse
version0.4.1
sourcesrc
created_at2023-05-25 10:06:07.726524
updated_at2023-11-14 21:40:52.037625
descriptionChainpulse is a monitoring tool for IBC relayers
homepage
repositoryhttps://github.com/informalsystems/chainpulse
max_upload_size
id874187
size176,904
Romain Ruetschi (romac)

documentation

README

Cosmos ecosystem

Crates.io Build Status Apache 2.0 Licensed Rust Stable Rust 1.69+

ChainPulse

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

  1. Clone this repository

    $ git clone https://github.com/informalsystems/chainpulse
    
  2. Build the chainpulse executable

    $ cargo build --release
    
  3. The chainpulse executable can now be found in target/release

Configuration

Create a configuration file at chainpulse.toml with the following content:

[chains.osmosis-1]
url = "https://rpc.osmosis.zone"
comet_version = "0.34"

[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:

$ chainpulse --config chainpulse.toml
2023-05-26T10:17:28.378380Z  INFO Metrics server listening at http://localhost:3000/metrics
2023-05-26T10:17:28.386951Z  INFO collect{chain=osmosis}: Connecting to https://rpc.osmosis.zone...
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_pending_packets The number of packets pending on an IBC channel
# TYPE ibc_pending_packets gauge
ibc_pending_packets{src_chain,src_channel,dst_channel} 42

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_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.

Commit count: 105

cargo fmt