Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pinax-network/substreams-sink-prometheus
Substreams Prometheus CLI Node.js
https://github.com/pinax-network/substreams-sink-prometheus
pinax streamingfast substreams thegraph
Last synced: about 15 hours ago
JSON representation
Substreams Prometheus CLI Node.js
- Host: GitHub
- URL: https://github.com/pinax-network/substreams-sink-prometheus
- Owner: pinax-network
- License: apache-2.0
- Created: 2023-03-01T22:51:45.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-13T06:05:26.000Z (8 months ago)
- Last Synced: 2024-11-10T20:41:58.225Z (4 days ago)
- Topics: pinax, streamingfast, substreams, thegraph
- Language: TypeScript
- Homepage: https://npmjs.com/package/substreams-sink-prometheus
- Size: 33.2 MB
- Stars: 0
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
- awesome-substreams - Prometheus Sink
README
# [`Substreams`](https://substreams.streamingfast.io/) [Prometheus](https://prometheus.io/) CLI `Node.js`
[](https://github.com/pinax-network/substreams-sink-prometheus)
[](https://www.npmjs.com/package/substreams-sink-prometheus)
[](https://github.com/pinax-network/substreams-sink-prometheus/actions?query=branch%3Amain)> `substreams-sink-prometheus` is a tool that allows developers to pipe data extracted metrics from a blockchain into a Prometheus time series database.
## 📖 Documentation
### https://www.npmjs.com/package/substreams-sink-prometheus
### Further resources
- [**Substreams** documentation](https://substreams.streamingfast.io)
- [**Prometheus** documentation](https://prometheus.io)
- [**Substreams Sink Prometheus** `Rust`](https://github.com/pinax-network/substreams-sink-prometheus.rs)### Protobuf
- [`pinax.substreams.sink.prometheus.v1.PrometheusOperations`](https://github.com/pinax-network/substreams-sink-prometheus.rs/blob/main/proto/substreams/sink/prometheus/v1/prometheus.proto)
## Docker environment
Pull from GitHub Container registry
```bash
docker pull ghcr.io/pinax-network/substreams-sink-prometheus:latest
```Build from source
```bash
docker build -t substreams-sink-prometheus .
```Run with `.env` file
```bash
docker run -it --rm --env-file .env substreams-sink-prometheus run
```**Install** globally via npm
```
$ npm install -g substreams-sink-prometheus
```**Run**
```console
Substreams Prometheus sink moduleOptions:
-e --substreams-endpoint Substreams gRPC endpoint to stream data from (env: SUBSTREAMS_ENDPOINT)
--manifest URL of Substreams package (env: MANIFEST)
--module-name Name of the output module (declared in the manifest) (env: MODULE_NAME)
-s --start-block Start block to stream from (defaults to -1, which means the initialBlock of the first module you are streaming) (default: "-1", env: START_BLOCK)
-t --stop-block Stop block to end stream at, inclusively (env: STOP_BLOCK)
-p, --params Set a params for parameterizable modules. Can be specified multiple times. (ex: -p module1=valA -p module2=valX&valY) (default: [], env: PARAMS)
--substreams-api-token API token for the substream endpoint (default: "", env: SUBSTREAMS_API_TOKEN)
--delay-before-start [OPERATOR] Amount of time in milliseconds (ms) to wait before starting any internal processes, can be used to perform to maintenance on the pod before actually letting it starts (default: 0,
env: DELAY_BEFORE_START)
--cursor-file Cursor lock file (default: "cursor.lock", env: CURSOR_FILE)
--disable-production-mode Disable production mode, allows debugging modules logs, stops high-speed parallel processing (default: true, env: PRODUCTION_MODE)
--restart-inactivity-seconds If set, the sink will restart when inactive for over a certain amount of seconds (default: 60, env: RESTART_INACTIVITY_SECONDS)
--hostname The process will listen on this hostname for any HTTP and Prometheus metrics requests (default: "localhost", env: HOSTNAME)
--port The process will listen on this port for any HTTP and Prometheus metrics requests (default: 9102, env: PORT)
--metrics-labels [string...] To apply generic labels to all default metrics (ex: --labels foo=bar) (default: {}, env: METRICS_LABELS)
--collect-default-metrics Collect default metrics (default: false, env: COLLECT_DEFAULT_METRICS)
--verbose Enable verbose logging (default: false, env: VERBOSE)
-h, --help display help for command
```> Open the browser at [http://localhost:9102](http://localhost:9102)
## Features
- [x] Consume `*.spkg` from:
- [x] Load URL or IPFS
- [x] Read from `*.spkg` local filesystem
- [x] Read from `substreams.yaml` local filesystem
- [x] Prometheus metrics
- [x] COUNTER
- [x] GAUGE
- [ ] ~~HISTOGRAM~~
- [ ] ~~SUMMARY~~
- [x] Handle `cursor` on restart (saves `cursor.lock` file on disk)