Blockchain-RPC-Exporter

所属分类:区块链开发
开发工具:Python
文件大小:42KB
下载次数:0
上传日期:2023-03-03 21:35:53
上 传 者sh-1993
说明:  区块链RPC导出器,用于EVM兼容RPC端点的普罗米修斯导出器。
(Blockchain-RPC-Exporter,Prometheus exporter for EVM compatible RPC endpoints.)

文件列表:
.pre-commit-config.yaml (283, 2023-03-04)
CHANGELOG.md (325, 2023-03-04)
Dockerfile (498, 2023-03-04)
LICENSE (1071, 2023-03-04)
config (0, 2023-03-04)
config\exporter_example (0, 2023-03-04)
config\exporter_example\config.yml (1440, 2023-03-04)
config\exporter_example\validation.yml (334, 2023-03-04)
config\grafana (0, 2023-03-04)
config\grafana\provisioning (0, 2023-03-04)
config\grafana\provisioning\dashboards (0, 2023-03-04)
config\grafana\provisioning\dashboards\dashboard.yml (224, 2023-03-04)
config\grafana\provisioning\dashboards\demo.json (19340, 2023-03-04)
config\grafana\provisioning\datasources (0, 2023-03-04)
config\grafana\provisioning\datasources\datasources.yml (192, 2023-03-04)
config\prometheus (0, 2023-03-04)
config\prometheus\prometheus.yml (259, 2023-03-04)
docker-compose.yml (1551, 2023-03-04)
requirements-dev.txt (84, 2023-03-04)
requirements.txt (126, 2023-03-04)
src (0, 2023-03-04)
src\cache.py (753, 2023-03-04)
src\collectors.py (13542, 2023-03-04)
src\configuration.py (3805, 2023-03-04)
src\exporter.py (1113, 2023-03-04)
src\helpers.py (1790, 2023-03-04)
src\interfaces.py (12405, 2023-03-04)
src\log.py (275, 2023-03-04)
src\metrics.py (7290, 2023-03-04)
src\registries.py (3723, 2023-03-04)
src\test_cache.py (1766, 2023-03-04)
src\test_collectors.py (29850, 2023-03-04)
src\test_configuration.py (5014, 2023-03-04)
... ...

# Blockchain RPC Exporter The exporter is used to scrape metrics from blockchain RPC endpoints. The purpose of this exporter is to perform black-box testing on RPC endpoints. ## Metrics Exporter currently supports all EVM-compatible chains. In addition, there is limited support for the following chains: - Cardano (wss) - Conflux (wss) - Solana (https & wss) - Bitcoin (https) - Dogecoin (https) - Filecoin (https) - Starkware (https) ## Available Metrics # Disclaimer Please note that this tool is in the early development stage and should not be used to influence critical business decisions. The project in its current form suits our short-term needs and will receive limited support. We encourage you to fork the project and extend it with additional functionality you might need. ## Development You should install [pre-commit](https://pre-commit.com/) so that automated linting and formatting checks are performed before each commit. Run: ```bash pip install pre-commit pre-commit install ``` ### Running locally 1. Make sure you have python3 installed (>3.11) 2. Set up your python environment ```bash pip3 install virtualenv virtualenv venv source venv/bin/activate pip install -r requirements.txt pip install -r requirements-dev.txt ``` 1. Generate valid exporter config and validation file. For example see [config example](config/exporter_example/config.yml) and [validation example](config/exporter_example/validation.yml). 2. Export paths of generated configuration files relative to `src/exporter.py`: ```bash export VALIDATION_FILE_PATH="validation.yml" # For example if we saved validation config file in src/validation.yml export CONFIG_FILE_PATH="config.yml" # For example if we saved config file in src/config.yml ``` 3. Finally you can run the exporter ```bash python exporter.py ``` ### Run with docker-compose 1. Generate valid exporter config and validation file. For example see [config example](config/exporter_example/config.yml) and [validation example](config/exporter_example/validation.yml). 2. Export paths of generated configuration files relative to `docker-compose.yml`: ```bash export VALIDATION_FILE_PATH="src/validation.yml" # For example if we saved validation config file in src/validation.yml export CONFIG_FILE_PATH="src/config.yml" # For example if we saved config file in src/config.yml ``` 3. Execute ```bash docker-compose build docker-compose up curl localhost:8000/metrics # Exporter curl localhost:3000 # Grafana curl localhost:9090 # Prometheus ``` ### Testing Testing is performed using [pytest](https://docs.pytest.org/) run by [coverage.py](https://coverage.readthedocs.io/) to generate test coverage reporting. [pylint](https://pylint.readthedocs.io/) is used to lint the pyhton code. These dependencies can be found in the [requirements-dev.txt](requirements-dev.txt) file. Unit testing and linting is performed on every commit push to the repository. 90% test coverage and no linter errors/warnings are a requirement for the tests to pass. #### Testing Locally (venv) Tests can be run locally in the virtual environment. 1. Run the unit tests with coverage.py from within the `src` directory. ```bash coverage run --branch -m pytest ``` 2. Generate the coverage report. To view the report open the generated `index.html` file in a browser. ```bash coverage html ``` 3. Run the linter to find any errors/warnings. ```bash pylint src/*py ``` #### Testing Locally (docker) The tests and linter can be run using docker by building the `test` docker stage. 1. Build the `test` stage in the `Dockerfile`. ```bash docker build --target test . ```

近期下载者

相关文件


收藏者