Giter Club home page Giter Club logo

cosmos-exporter's Introduction

cosmos-exporter

Latest release Actions Status

cosmos-exporter is a Prometheus scraper that fetches the data from a full node of a Cosmos-based blockchain via gRPC.

What can I use it for?

You can run a full node, run cosmos-exporter on the same host, set up Prometheus to scrape the data from it (see below for instructions), then set up Grafana to visualize the data coming from the exporter and probably add some alerting. Here are some examples of Grafana dashboards we created for ourselves:

Validator dashboard Validators dashboard Wallet dashboard

How can I set it up?

First of all, you need to download the latest release from the releases page. After that, you should unzip it and you are ready to go:

wget <the link from the releases page>
tar xvfz cosmos-exporter-*
./cosmos-exporter

That's not really interesting, what you probably want to do is to have it running in the background. For that, first of all, we have to copy the file to the system apps folder:

sudo cp ./cosmos-exporter /usr/bin

Then we need to create a systemd service for our app:

sudo nano /etc/systemd/system/cosmos-exporter.service

You can use this template (change the user to whatever user you want this to be executed from. It's advised to create a separate user for that instead of running it from root):

[Unit]
Description=Cosmos Exporter
After=network-online.target

[Service]
User=<username>
TimeoutStartSec=0
CPUWeight=95
IOWeight=95
ExecStart=cosmos-exporter
Restart=always
RestartSec=2
LimitNOFILE=800000
KillSignal=SIGTERM

[Install]
WantedBy=multi-user.target

Then we'll add this service to the autostart and run it:

sudo systemctl enable cosmos-exporter
sudo systemctl start cosmos-exporter
sudo systemctl status cosmos-exporter # validate it's running

If you need to, you can also see the logs of the process:

sudo journalctl -u cosmos-exporter -f --output cat

How can I scrape data from it?

Here's the example of the Prometheus config you can use for scraping data:

scrape-configs:
  # specific validator(s)
  - job_name:       'validator'
    scrape_interval: 15s
    metrics_path: /metrics/validator
    static_configs:
      - targets:
        - <list of validators you want to monitor>
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_address
      - source_labels: [__param_address]
        target_label: instance
      - target_label: __address__
        replacement: <node hostname or IP>:9300
  # specific wallet(s)
  - job_name:       'wallet'
    scrape_interval: 15s
    metrics_path: /metrics/wallet
    static_configs:
      - targets:
        - <list of wallets>
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_address
      - source_labels: [__param_address]
        target_label: instance
      - target_label: __address__
        replacement: <node hostname or IP>:9300

  # all validators
  - job_name:       'validators'
    scrape_interval: 15s
    metrics_path: /metrics/validators
    static_configs:
      - targets:
        - <node hostname or IP>:9300

Then restart Prometheus and you're good to go!

All of the metrics provided by cosmos-exporter have the following prefixes:

  • cosmos_validator_* - metrics related to a single validator
  • cosmos_validators_* - metrics related to a validator set
  • cosmos_wallet_* - metrics related to a single wallet

How does it work?

It queries the full node via gRPC and returns it in the format Prometheus can consume.

How can I configure it?

You can pass the artuments to the executable file to configure it. Here is the parameters list:

  • --bech-prefix - the global prefix for addresses. Defaults to persistence
  • --denom - the currency, for example, uatom for Cosmos. Defaults to uxprt
  • --denom-coefficient - the number of decimals, 1000000 for cosmos. Defaults to 1. Can't provide along with --denom-exponent
  • --denom-exponent - the denom exponent, 6 for cosmos. Defaults to 0. Can't provide along with --denom-coefficient
  • --listen-address - the address with port the node would listen to. For example, you can use it to redefine port or to make the exporter accessible from the outside by listening on 127.0.0.1. Defaults to :9300 (so it's accessible from the outside on port 9300)
  • --node - the gRPC node URL. Defaults to localhost:9090
  • --tendermint-rpc - Tendermint RPC URL to query node stats (specifically chain-id). Defaults to http://localhost:26657
  • --log-devel - logger level. Defaults to info. You can set it to debug to make it more verbose.
  • --limit - pagination limit for gRPC requests. Defaults to 1000.
  • --json - output logs as JSON. Useful if you don't read it on servers but instead use logging aggregation solutions such as ELK stack.

You can also specify custom Bech32 prefixes for wallets, validators, consensus nodes, and their pubkeys by using the following params:

  • --bech-account-prefix
  • --bech-account-pubkey-prefix
  • --bech-validator-prefix
  • --bech-validator-pubkey-prefix
  • --bech-consensus-node-prefix
  • --bech-consensus-node-pubkey-prefix

By default, if not specified, it defaults to the next values (as it works this way for the most of the networks):

  • --bech-account-prefix = --bech-prefix
  • --bech-account-pubkey-prefix = --bech-prefix + "pub"
  • --bech-validator-prefix = --bech-prefix + "valoper"
  • --bech-validator-pubkey-prefix = --bech-prefix + "valoperpub"
  • --bech-consensus-node-prefix = --bech-prefix + "valcons"
  • --bech-consensus-node-pubkey-prefix = --bech-prefix + "valconspub"

An example of the network where you have to specify all the prefixes manually is Iris, check out the flags example below.

Additionally, you can pass a --config flag with a path to your config file (I use .toml, but anything supported by viper should work).

Which networks this is guaranteed to work?

In theory, it should work on a Cosmos-based blockchains with cosmos-sdk >= 0.40.0 (that's when they added gRPC and IBC support). If this doesn't work on some chains, please file and issue and let's see what's up.

How can I contribute?

Bug reports and feature requests are always welcome! If you want to contribute, feel free to open issues or PRs.

cosmos-exporter's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

cosmos-exporter's Issues

Empty reply for validators metrics

Hi!

On Entangle blockchain there is a problem with validators metrics, metrics for specific validator is working but for all validators is not working. EOF error in Prometheus.

https://github.com/Entangle-Protocol/entangle-blockchain

Debug:
2023/09/17 19:26:30 http: panic serving 127.0.0.1:43612: Int64() out of bound
goroutine 66 [running]:
net/http.(*conn).serve.func1(0xc0001b45a0)
/opt/hostedtoolcache/go/1.16.5/x64/src/net/http/server.go:1824 +0x153
panic(0x131b540, 0x184db20)
/opt/hostedtoolcache/go/1.16.5/x64/src/runtime/panic.go:971 +0x499
github.com/cosmos/cosmos-sdk/types.Int.Int64(0xc000eb7a00, 0xc000df5620)
/home/runner/go/pkg/mod/github.com/cosmos/[email protected]/types/int.go:156 +0xab
main.ValidatorsHandler(0x18908e0, 0xc0001d0380, 0xc0001cc300, 0xc000d13180)
/home/runner/work/cosmos-exporter/cosmos-exporter/validators.go:256 +0x1e38
main.Execute.func3(0x18908e0, 0xc0001d0380, 0xc0001cc300)
/home/runner/work/cosmos-exporter/cosmos-exporter/main.go:169 +0x48
net/http.HandlerFunc.ServeHTTP(0xc0000a6890, 0x18908e0, 0xc0001d0380, 0xc0001cc300)
/opt/hostedtoolcache/go/1.16.5/x64/src/net/http/server.go:2069 +0x44
net/http.(*ServeMux).ServeHTTP(0x2186320, 0x18908e0, 0xc0001d0380, 0xc0001cc300)
/opt/hostedtoolcache/go/1.16.5/x64/src/net/http/server.go:2448 +0x1ad
net/http.serverHandler.ServeHTTP(0xc00017a380, 0x18908e0, 0xc0001d0380, 0xc0001cc300)
/opt/hostedtoolcache/go/1.16.5/x64/src/net/http/server.go:2887 +0xa3
net/http.(*conn).serve(0xc0001b45a0, 0x1893db8, 0xc0001babc0)
/opt/hostedtoolcache/go/1.16.5/x64/src/net/http/server.go:1952 +0x8cd
created by net/http.(*Server).Serve
/opt/hostedtoolcache/go/1.16.5/x64/src/net/http/server.go:3013 +0x39b
panic: Int64() out of bound
goroutine 77 [running]:
github.com/cosmos/cosmos-sdk/types.Dec.RoundInt64(0xc000eb7a20, 0x40e0f8)
/home/runner/go/pkg/mod/github.com/cosmos/[email protected]/types/decimal.go:554 +0xb3
main.ValidatorsHandler.func1.1(0x0, 0x11, 0x14367e0)
/home/runner/work/cosmos-exporter/cosmos-exporter/validators.go:155 +0x50
sort.medianOfThree_func(0xc000ddff90, 0xc000fc1200, 0x0, 0x11, 0x21)
/opt/hostedtoolcache/go/1.16.5/x64/src/sort/zfuncversion.go:53 +0x3e
sort.doPivot_func(0xc000ddff90, 0xc000fc1200, 0x0, 0x22, 0xfa523e, 0x7ff4dd9c0b40)
/opt/hostedtoolcache/go/1.16.5/x64/src/sort/zfuncversion.go:80 +0x88
sort.quickSort_func(0xc000ddff90, 0xc000fc1200, 0x0, 0x22, 0xc)
/opt/hostedtoolcache/go/1.16.5/x64/src/sort/zfuncversion.go:143 +0x97
sort.Slice(0x1301460, 0xc000efa0d8, 0xc000ddff90)
/opt/hostedtoolcache/go/1.16.5/x64/src/sort/slice.go:20 +0xe8
main.ValidatorsHandler.func1(0xc000117500, 0xc000eda8a0, 0xc000d13180, 0xc000119e18)
/home/runner/work/cosmos-exporter/cosmos-exporter/validators.go:154 +0x3bd
created by main.ValidatorsHandler
/home/runner/work/cosmos-exporter/cosmos-exporter/validators.go:129 +0x1336

Debug part two:
panic: Int64() out of bound
goroutine 31 [running]:
github.com/cosmos/cosmos-sdk/types.Dec.RoundInt64(0xc000dfa0e0, 0x40e0f8)
/home/runner/go/pkg/mod/github.com/cosmos/[email protected]/types/decimal.go:554 +0xb3
main.ValidatorsHandler.func1.1(0x0, 0x11, 0x14367e0)
/home/runner/work/cosmos-exporter/cosmos-exporter/validators.go:155 +0x50
sort.medianOfThree_func(0xc000e33f90, 0xc000fb7ad0, 0x0, 0x11, 0x21)
/opt/hostedtoolcache/go/1.16.5/x64/src/sort/zfuncversion.go:53 +0x3e
sort.doPivot_func(0xc000e33f90, 0xc000fb7ad0, 0x0, 0x22, 0x1f4, 0x7fa3895d49d8)
/opt/hostedtoolcache/go/1.16.5/x64/src/sort/zfuncversion.go:80 +0x88
sort.quickSort_func(0xc000e33f90, 0xc000fb7ad0, 0x0, 0x22, 0xc)
/opt/hostedtoolcache/go/1.16.5/x64/src/sort/zfuncversion.go:143 +0x97
sort.Slice(0x1301460, 0xc000de4348, 0xc000e33f90)
/opt/hostedtoolcache/go/1.16.5/x64/src/sort/slice.go:20 +0xe8
main.ValidatorsHandler.func1(0xc0005a9110, 0xc0005fe840, 0xc000537c00, 0xc0010e0300)
/home/runner/work/cosmos-exporter/cosmos-exporter/validators.go:154 +0x3bd
created by main.ValidatorsHandler
/home/runner/work/cosmos-exporter/cosmos-exporter/validators.go:129 +0x1336

Prometheus config:

  • job_name: 'validator'
    scrape_interval: 15s
    metrics_path: /metrics/validator
    static_configs:

    • targets:
      • ethmvaloper19j4pje5sljgta7t79c0xh6uduc8u7ra0s97pz0
        relabel_configs:
    • source_labels: [address]
      target_label: __param_address
    • source_labels: [__param_address]
      target_label: instance
    • target_label: address
      replacement: localhost:9300
  • job_name: 'validators'
    scrape_interval: 15s
    metrics_path: /metrics/validators
    static_configs:

    • targets: ['localhost:9300']

http: panic serving 127.0.0.1:xxxxx: Int64() out of bound

Hi,
I'm facing an error on fetchhub-2 (fetch.ai)
image

Here is the full error log:
image

The error comes from cosmos-sdk dependency's Int64() function:
https://github.com/cosmos/cosmos-sdk/blob/c4864e9f85011b3e971885ea995a0021c01a885d/types/int.go#L154

the function is triggered here:

}).Set(float64(validator.Validator.Tokens.Int64()) / DenomCoefficient)

I've tried to find out what's happening and added some logs to check validator token values:
image
resulting with:
image

I suppose the error comes from token's absolute value: 81
I don't have much knowledge in this area. Could anyone tell me why this error occurred and if it is possible to fix it?

Pagination for QueryValidatorDelegationsRequest

Hello, I am a validator on Kujira, and due to a recent change, many people have over 100 delegations now. These are mostly small fractional numbers, but it appears to have passed a limit used by the cosmos-exporter.

# curl -s cosmos-exporter:9300/metrics/validator?address=kujiravaloper1dnmz4yzv73lr3lmauuaa0wpwn8zm8s20memec4 | grep -v "#" |gr
ep cosmos_validator_delegations | wc -l
100

I believe the default pagination limit is 100

It looks like you support pagination in a few staking types like
QueryValidatorsRequest - source

but not for others like
QueryValidatorDelegationsRequest

Any chance you can add pagination support here:

https://github.com/solarlabsteam/cosmos-exporter/blob/master/validator.go#L281

panic: Int64() out of bound for Rebus

Hello

I have compiled the package from main with last commit (PR #18) and I receive the following error (please see below).
The daemon successfully starts and works until prometheus makes the request.

Please fix it if possible.

I could not find how to see the version of current cosmos-exporter (not seen in --help, -V or -v or version)
Here is the md5 hash
9dc766fa92cb370fbbc39932b1b10298 /usr/local/bin/cosmos-exporter

11:30PM INF Started with following parameters --bech-account-prefix=rebus --bech-account-pubkey-prefix=rebuspub --bech-consensus-node-prefix=rebusvalcons --bech-consensus-node-pubkey-prefix=rebusvalconspub --bech-validator-prefix=rebusvaloper --bech-validator-pubkey-prefix=rebusvaloperpub --denom=rebus --denom-cofficient=1000000000000000000.000000 --denom-exponent=0 --listen-address=0.0.0.0:17300 --log-level=info --node=localhost:17090
11:30PM INF Got network status from Tendermint network=reb_3333-1
11:30PM INF Using provided denom and coefficient. coefficient=1000000000000000000 denom=rebus
11:30PM INF Listening address=0.0.0.0:17300
panic: Int64() out of bound
goroutine 81 [running]:
github.com/cosmos/cosmos-sdk/types.Dec.RoundInt64({0xc000d0e335?})
	/home/rebus/go/pkg/mod/github.com/cosmos/[email protected]/types/decimal.go:554 +0x8b
main.ValidatorsHandler.func1.1(0xc001170150?, 0x47)
	/home/rebus/cosmos-exporter/validators.go:156 +0x71
sort.medianOfThree_func({0xc001003fb8?, 0xc001170150?}, 0xc00055fb90?, 0x0?, 0xd8?)
	/usr/local/go/src/sort/zfuncversion.go:53 +0x4a
sort.doPivot_func({0xc001003fb8?, 0xc001170150?}, 0x0, 0x238)
	/usr/local/go/src/sort/zfuncversion.go:76 +0x8a
sort.quickSort_func({0xc001003fb8?, 0xc001170150?}, 0xc00055fb90?, 0x0?, 0xc0b6783e9354476c?)
	/usr/local/go/src/sort/zfuncversion.go:143 +0x85
sort.Slice({0x10cb380, 0xc00055fb90}, 0x368?)
	/usr/local/go/src/sort/slice.go:20 +0x9f
main.ValidatorsHandler.func1()
	/home/rebus/cosmos-exporter/validators.go:155 +0x313
created by main.ValidatorsHandler
	/home/rebus/cosmos-exporter/validators.go:130 +0x15b3
cosmos-exporter-rebus.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
cosmos-exporter-rebus.service: Failed with result 'exit-code'.
cosmos-exporter-rebus.service: Scheduled restart job, restart counter is at 17375.
Stopped Cosmos Exporter.
Started Cosmos Exporter.

Evmos /metrics/validators not support

Evmos is a highly customized chain. /metrics/wallet and /metrics/validator are fine.

Is it possible to support /metrics/validators?

This is my error message

Started Cosmos Exporter.
8:54AM INF Config file not provided
8:54AM INF Started with following parameters --bech-account-prefix=evmos --bech-account-pubkey-prefix=evmospub --bech-consensus-node-prefix=evmosvalcons --bech-consensus-node-pubkey-prefix=evmxxxx
8:54AM INF Got network status from Tendermint network=evmos_9001-1
8:54AM INF Using provided denom and coefficient. coefficient=6 denom=aevmos
8:54AM INF Listening address=:9300
8:54AM INF Request processed endpoint=/metrics/wallet?address=xxxxxxxxxxxxx method=GET request-id=exxxx request-time=0.002631239
panic: Int64() out of bound
goroutine 56 [running]:
github.com/cosmos/cosmos-sdk/types.Dec.RoundInt64(0xc000f121a0, 0x31262df1be46351f)
        /home/runner/go/pkg/mod/github.com/cosmos/[email protected]/types/decimal.go:554 +0xb3
main.ValidatorsHandler.func1.1(0x3f, 0x30, 0x1435700)
        /home/runner/work/cosmos-exporter/cosmos-exporter/validators.go:155 +0x50
sort.medianOfThree_func(0xc00009bf90, 0xc000f20f60, 0x3f, 0x30, 0x4e)
        /opt/hostedtoolcache/go/1.16.5/x64/src/sort/zfuncversion.go:53 +0x3e
sort.doPivot_func(0xc00009bf90, 0xc000f20f60, 0x0, 0x7e, 0xfa523e, 0x7f82357328c0)
        /opt/hostedtoolcache/go/1.16.5/x64/src/sort/zfuncversion.go:77 +0x53d
sort.quickSort_func(0xc00009bf90, 0xc000f20f60, 0x0, 0x7e, 0xe)
        /opt/hostedtoolcache/go/1.16.5/x64/src/sort/zfuncversion.go:143 +0x97
sort.Slice(0x1300460, 0xc000ddc888, 0xc00009bf90)
        /opt/hostedtoolcache/go/1.16.5/x64/src/sort/slice.go:20 +0xe8
main.ValidatorsHandler.func1(0xc000cfe5d4, 0xc000db2a80, 0xc000c64a80, 0xc000ddc5d0)
        /home/runner/work/cosmos-exporter/cosmos-exporter/validators.go:154 +0x3bd
created by main.ValidatorsHandler
        /home/runner/work/cosmos-exporter/cosmos-exporter/validators.go:129 +0x1336
cosmos-exporter.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
cosmos-exporter.service: Failed with result 'exit-code'.
cosmos-exporter.service: Scheduled restart job, restart counter is at 1.

It seems some issue about Cosmos SDK panic about int64

/metric/validators net showing any results

When running the /metric/validators command on a new evmosd based chain it's not showing any results. The logs show the following error:

panic: Int64() out of bound
goroutine 101 [running]:
github.com/cosmos/cosmos-sdk/types.Dec.RoundInt64(0xc0010da100, 0x0)
        /home/runner/go/pkg/mod/github.com/cosmos/[email protected]/types/decimal.go:554 +0xb3
main.ValidatorsHandler.func1.1(0x6, 0x0, 0x133b8e0)
        /home/runner/work/cosmos-exporter/cosmos-exporter/validators.go:155 +0x50
sort.quickSort_func(0xc0005cdf90, 0xc0010cd650, 0x0, 0x7, 0x6)
        /opt/hostedtoolcache/go/1.16.5/x64/src/sort/zfuncversion.go:154 +0x1b8
sort.Slice(0x1300460, 0xc000123a70, 0xc0005cdf90)
        /opt/hostedtoolcache/go/1.16.5/x64/src/sort/slice.go:20 +0xe8
main.ValidatorsHandler.func1(0xc000701404, 0xc00125c420, 0xc000db9180, 0xc000711ed8)
        /home/runner/work/cosmos-exporter/cosmos-exporter/validators.go:154 +0x3bd
created by main.ValidatorsHandler
        /home/runner/work/cosmos-exporter/cosmos-exporter/validators.go:129 +0x1336
cosmos-exporter.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
cosmos-exporter.service: Failed with result 'exit-code'.
cosmos-exporter.service: Service hold-off time over, scheduling restart.
cosmos-exporter.service: Scheduled restart job, restart counter is at 324.
Stopped Cosmos Exporter.```

panic: runtime error: index out of range [0] with length 0

Can't start cosmos-explorer, getting an error and program stopped.
Any idea how I can debug this?

$ /usr/local/bin/cosmos-exporter --node="127.0.0.11:9090" --tendermint-rpc="http://127.0.0.11:26657" --bech-prefix="rizon" --denom="uatolo"
7:24AM INF Config file not provided
7:24AM INF Started with following parameters --bech-account-prefix=rizon --bech-account-pubkey-prefix=rizonpub --bech-consensus-node-prefix=rizonvalcons --bech-consensus-node-pubkey-prefix=rizonvalconspub --bech-validator-prefix=rizonvaloper --bech-validator-pubkey-prefix=rizonvaloperpub --denom=uatolo --listen-address=:9300 --log-level=info --node=127.0.0.11:9090
7:24AM INF Got network status from Tendermint network=titan-1
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
main.setDenom(0xc000d82700)
        /home/runner/work/cosmos-exporter/cosmos-exporter/main.go:230 +0x610
main.Execute(0x216f220, 0xc0001b3ec0, 0x0, 0x4)
        /home/runner/work/cosmos-exporter/cosmos-exporter/main.go:162 +0x725
github.com/spf13/cobra.(*Command).execute(0x216f220, 0xc000180060, 0x4, 0x4, 0x216f220, 0xc000180060)
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:854 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0x216f220, 0x217bce0, 0x1527680, 0x21)
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:958 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:895
main.main()
        /home/runner/work/cosmos-exporter/cosmos-exporter/main.go:272 +0x5f5
$

What should be used for the list of validators

For the list of validators I would want to monitor, should I add their ip addesses or some other identifier:

  • job_name: 'validator'
    scrape_interval: 15s
    metrics_path: /metrics/validator
    static_configs:
    • targets:
    relabel_configs:
    • source_labels: [address]
      target_label: __param_address
    • source_labels: [__param_address]
      target_label: instance
    • target_label: address
      replacement: :9300

Service Crashes after some time

Hello, we were testing this exporter within some tender mint chains and we have noticed that it crashes on some after some time running with the error below:

Mar 22 16:26:15 val01-umee-t cosmos-exporter[1144781]: sync.(*WaitGroup).Add(0xc0006306d4, 0xffffffffffffffff)
Mar 22 16:26:15 val01-umee-t cosmos-exporter[1144781]:         /opt/hostedtoolcache/go/1.16.5/x64/src/sync/waitgroup.go:74 +0x147
Mar 22 16:26:15 val01-umee-t cosmos-exporter[1144781]: sync.(*WaitGroup).Done(0xc0006306d4)
Mar 22 16:26:15 val01-umee-t cosmos-exporter[1144781]:         /opt/hostedtoolcache/go/1.16.5/x64/src/sync/waitgroup.go:99 +0x34
Mar 22 16:26:15 val01-umee-t cosmos-exporter[1144781]: main.ValidatorsHandler.func3(0xc0006306d4, 0xc0017a52c0, 0xc000d7ee00, 0xc0006306d0)
Mar 22 16:26:15 val01-umee-t cosmos-exporter[1144781]:         /home/runner/work/cosmos-exporter/cosmos-exporter/validators.go:209 +0x2e7
Mar 22 16:26:15 val01-umee-t cosmos-exporter[1144781]: created by main.ValidatorsHandler
Mar 22 16:26:15 val01-umee-t cosmos-exporter[1144781]:         /home/runner/work/cosmos-exporter/cosmos-exporter/validators.go:188 +0x1405
Mar 22 16:26:15 val01-umee-t systemd[1]: cosmos-exporter.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Mar 22 16:26:15 val01-umee-t systemd[1]: cosmos-exporter.service: Failed with result 'exit-code'.

It is running with these parameters:

ExecStart=/usr/local/bin/cosmos-exporter --denom=uumee --denom-coefficient=1000000

Any insight why does this happen? It works for some time, like hours but eventually crashes.

When executing ./cosmos-exporter

I got the following error messages.

./cosmos-exporter 4:41PM INF Config file not provided 4:41PM INF Started with following parameters --bech-account-prefix=persistence --bech-account-pubkey-prefix=persistencepub --bech-consensus-node-prefix=persistencevalcons --bech-consensus-node-pubkey-prefix=persistencevalconspub --bech-validator-prefix=persistencevaloper --bech-validator-pubkey-prefix=persistencevaloperpub --denom= --listen-address=:9300 --log-level=info --node=localhost:9090 4:41PM INF Got network status from Tendermint network=stargaze-1 4:41PM FTL No denom infos. Try running the binary with --denom and --denom-coefficient to set them manually.

The error log shows that there is no such process even though I move cosmos-exporter to /usr/bin/ directory (/usr/bin/cosmos-exporter)

Invalid moniker causes comsos-exporter to crash

Hi, when someone adds an invalid moniker (not UTF-8 compliant), then cosmos-exporter seems to crash:

cosmos-exporter[125650]: 2022/06/10 17:27:49 http: panic serving 18.216.70.73:48308: label moniker: value "\xd0penton7" is not valid UTF-8

Perhaps it makes sense to try/catch this type of error and report a metric for "unable_to_get_metric"

Handle big size exponent

I saw same issues about panic errors when calculating big numbers which cannot be handled by int64.
Since chains like Sifchain, Evmos are using denom exponent of 10^18, exporter have to process them based on bigInt.

Created a new PR to fix this bug so would you please check this out?
PR: #23

UTF8 moniker names

Hello

The cosmos exporter does not validate non-utf8 moniker names correctly during the requests to /validators
So if any validator in chain uses non-utf8 character in the moniker - there is no validator who could use your cosmos-exporter tool to monitor his or her node.

Example:
https://empower.explorers.guru/validator/empowervaloper1a35zftt7z3huc47a35cx2cmdy6yyhqzf2nwtws
Error:
2022/10/23 16:51:07 http: panic serving 157.90.120.132:51016: label moniker: value "\xd1metil" is not valid UTF-8
goroutine 1723524 [running]:
net/http.(*conn).serve.func1(0xc001cba000)
/opt/hostedtoolcache/go/1.16.5/x64/src/net/http/server.go:1824 +0x153
panic(0x1351100, 0xc001a250a0)
/opt/hostedtoolcache/go/1.16.5/x64/src/runtime/panic.go:971 +0x499
github.com/prometheus/client_golang/prometheus.(*GaugeVec).With(0xc0017b0290, 0xc001929bf0, 0x1506d61, 0x7)
/home/runner/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/gauge.go:228 +0xe5
main.ValidatorsHandler(0x188f820, 0xc001cbe000, 0xc0022f6400, 0xc000fb0e00)
/home/runner/work/cosmos-exporter/cosmos-exporter/validators.go:228 +0x2e2f
main.Execute.func3(0x188f820, 0xc001cbe000, 0xc0022f6400)
/home/runner/work/cosmos-exporter/cosmos-exporter/main.go:167 +0x48
net/http.HandlerFunc.ServeHTTP(0xc000f9de70, 0x188f820, 0xc001cbe000, 0xc0022f6400)
/opt/hostedtoolcache/go/1.16.5/x64/src/net/http/server.go:2069 +0x44
net/http.(*ServeMux).ServeHTTP(0x2185320, 0x188f820, 0xc001cbe000, 0xc0022f6400)
/opt/hostedtoolcache/go/1.16.5/x64/src/net/http/server.go:2448 +0x1ad
net/http.serverHandler.ServeHTTP(0xc000194460, 0x188f820, 0xc001cbe000, 0xc0022f6400)
/opt/hostedtoolcache/go/1.16.5/x64/src/net/http/server.go:2887 +0xa3
net/http.(*conn).serve(0xc001cba000, 0x1892cf8, 0xc001cb0240)
/opt/hostedtoolcache/go/1.16.5/x64/src/net/http/server.go:1952 +0x8cd
created by net/http.(*Server).Serve
/opt/hostedtoolcache/go/1.16.5/x64/src/net/http/server.go:3013 +0x39b

Sifchain Integer Issue

Sifchain's decimal precision appears to generate a panic:

panic: Int64() out of bound

panic: Int64() out of bound for Cosmos SDK v0.46.10

On latest version (v0.3.0) service crashes with following error:

11:19PM INF Started with following parameters --bech-account-prefix=cascadia --bech-account-pubkey-prefix=cascadiapub --bech-consensus-node-prefix=cascadiavalcons --bech-consensus-node-pubkey-prefix=cascadiavalconspub --bech-validator-prefix=cascadiavaloper --bech-validator-pubkey-prefix=cascadiavaloperpub --denom=aCC --listen-address=:9300 --log-level=info --node=localhost:9190
panic: Int64() out of bound
goroutine 89 [running]:
github.com/cosmos/cosmos-sdk/types.Dec.RoundInt64(0xc00013dd20, 0x1bc16d6713136a8a)
        /home/runner/go/pkg/mod/github.com/cosmos/[email protected]/types/decimal.go:554 +0xb3
main.ValidatorsHandler.func1.1(0x0, 0x60, 0x14367e0)
        /home/runner/work/cosmos-exporter/cosmos-exporter/validators.go:155 +0x85
sort.medianOfThree_func(0xc00156df90, 0xc000e27590, 0x0, 0x60, 0xc0)
        /opt/hostedtoolcache/go/1.16.5/x64/src/sort/zfuncversion.go:53 +0x3e
sort.doPivot_func(0xc00156df90, 0xc000e27590, 0x0, 0x303, 0xfa523e, 0x7f1a0212a2a0)
        /opt/hostedtoolcache/go/1.16.5/x64/src/sort/zfuncversion.go:76 +0x4fc
sort.quickSort_func(0xc00156df90, 0xc000e27590, 0x0, 0x303, 0x14)
        /opt/hostedtoolcache/go/1.16.5/x64/src/sort/zfuncversion.go:143 +0x97
sort.Slice(0x1301460, 0xc00000d350, 0xc00156df90)
        /opt/hostedtoolcache/go/1.16.5/x64/src/sort/slice.go:20 +0xe8
main.ValidatorsHandler.func1(0xc00059c474, 0xc0005aeb40, 0xc000d62e00, 0xc0011029d8)
        /home/runner/work/cosmos-exporter/cosmos-exporter/validators.go:154 +0x3bd
created by main.ValidatorsHandler
        /home/runner/work/cosmos-exporter/cosmos-exporter/validators.go:129 +0x1336
cosmos-exporter.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
cosmos-exporter.service: Failed with result 'exit-code'.
cosmos-exporter.service: Scheduled restart job, restart counter is at 31.
Stopped Cosmos Exporter.
Started Cosmos Exporter.

node running on cosmos_sdk_version: v0.46.10 / tendermint v0.34.26

[new feature req] add options for limiting delegation(and etc) count ( /validator endpooint)

tested with cosmos chains
1 - mainnet - comoshub-4
2 - testnet - theta-testnet-001

/validator endpoint for testnet is pretty fast, but for mainnet it is extremely slow
I found that cosmoshub-4 has bunch of 'delegations', 'redelegations', 'unbondings' set and exporter has to list all of those which is costing bunch of time.

So it would be useful if there is some options to limit that lists.

Kava /metrics/validator not working

I tried to use it with my Kava node. Everything works except the scraping of validator metrics with a specific address.

Query: MY_IP:9300/metrics/validator?address=kavavaloper16wmsum8eaf6sqmj97k9ayvh3c28u00nuuyt9xt

This is the log output. It seems like the query for delegations never finishes. It has a Started querying validator delegations but no end.

2:27AM DBG Started querying validator address=kavavaloper16wmsum8eaf6sqmj97k9ayvh3c28u00nuuyt9xt request-id=570860da-06bb-4a87-bab2-f9059747f043
2:27AM DBG Finished querying validator address=kavavaloper16wmsum8eaf6sqmj97k9ayvh3c28u00nuuyt9xt request-id=570860da-06bb-4a87-bab2-f9059747f043 request-time=1.277257541
2:27AM DBG Started querying validator other validators address=kavavaloper16wmsum8eaf6sqmj97k9ayvh3c28u00nuuyt9xt request-id=570860da-06bb-4a87-bab2-f9059747f043
2:27AM DBG Started querying validator delegations address=kavavaloper16wmsum8eaf6sqmj97k9ayvh3c28u00nuuyt9xt request-id=570860da-06bb-4a87-bab2-f9059747f043
2:27AM DBG Started querying validator commission address=kavavaloper16wmsum8eaf6sqmj97k9ayvh3c28u00nuuyt9xt request-id=570860da-06bb-4a87-bab2-f9059747f043
2:27AM DBG Started querying validator rewards address=kavavaloper16wmsum8eaf6sqmj97k9ayvh3c28u00nuuyt9xt request-id=570860da-06bb-4a87-bab2-f9059747f043
2:27AM DBG Started querying validator unbonding delegations address=kavavaloper16wmsum8eaf6sqmj97k9ayvh3c28u00nuuyt9xt request-id=570860da-06bb-4a87-bab2-f9059747f043
2:27AM DBG Started querying validator redelegations address=kavavaloper16wmsum8eaf6sqmj97k9ayvh3c28u00nuuyt9xt request-id=570860da-06bb-4a87-bab2-f9059747f043
2:27AM DBG Started querying validator signing info address=kavavaloper16wmsum8eaf6sqmj97k9ayvh3c28u00nuuyt9xt request-id=570860da-06bb-4a87-bab2-f9059747f043
2:27AM DBG Finished querying validator signing info address=kavavaloper16wmsum8eaf6sqmj97k9ayvh3c28u00nuuyt9xt request-id=570860da-06bb-4a87-bab2-f9059747f043 request-time=0.092198156
2:27AM DBG Finished querying validator signing info address=kavavaloper16wmsum8eaf6sqmj97k9ayvh3c28u00nuuyt9xt missedBlocks=0 request-id=570860da-06bb-4a87-bab2-f9059747f043
2:27AM DBG Finished querying validator commission address=kavavaloper16wmsum8eaf6sqmj97k9ayvh3c28u00nuuyt9xt request-id=570860da-06bb-4a87-bab2-f9059747f043 request-time=0.289733001
2:27AM DBG Finished querying validator rewards address=kavavaloper16wmsum8eaf6sqmj97k9ayvh3c28u00nuuyt9xt request-id=570860da-06bb-4a87-bab2-f9059747f043 request-time=0.489137674
2:27AM DBG Finished querying validator redelegations address=kavavaloper16wmsum8eaf6sqmj97k9ayvh3c28u00nuuyt9xt request-id=570860da-06bb-4a87-bab2-f9059747f043 request-time=1.916307469
2:27AM DBG Finished querying validator unbonding delegations address=kavavaloper16wmsum8eaf6sqmj97k9ayvh3c28u00nuuyt9xt request-id=570860da-06bb-4a87-bab2-f9059747f043 request-time=2.01117766

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.