Skip to content

astraly-labs/pragma-monitoring

Repository files navigation

Pragma Monitoring

OTEL Exporter

This service runs an OTEL exporter.

This service polls at a regular interval the database that is filled by our indexers. It then processes the data and computes the following metrics:

  • time_since_last_update_seconds{network, publisher, typr}: Time since a publisher has published any data. (in seconds)
  • pair_price{network, pair, source, type}: Latest price of an asset for a given source and pair. (normalized to asset's decimals)
  • time_since_last_update_pair_id{network, pair, type}: Time since an update has been published for a given pair. (in seconds)
  • price_deviation{network, pair, source, type}: Deviation of the price from a reference price (DefiLlama API) given source and pair. (in percents)
  • price_deviation_source{network, pair, source, type}: Deviation of the price from the on-chain aggregated median price given source and pair. (in percents)
  • publisher_balance{network, publisher}: Balance of a publisher. (in ETH)

Shared Public Access

Monitoring is not publicicly available yet but databases will soon be in read-only mode.

Self-Hosting

We have created a docker-compose.yml file to help with self-hosting setup:

docker compose up -d

You can then access prometheus dashboard at http://localhost:9000 and grafana at http://localhost:3000.

Make sure to first fill the envirronement file with your own config parameters:

# The database URL the application will use to connect to the database.
DATABASE_URL='postgres://postgres:postgres@localhost:5432/postgres'

# The OTEL endpoint to send metrics to.
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317

# (Optional) Defillama API Key
DEFILLAMA_API_KEY=

# Pragma API key
PRAGMA_API_KEY=

# RPC URL
RPC_URL=

# Indexer Service URL
INDEXER_SERVICE_URL=

# Config
NETWORK=testnet
ORACLE_ADDRESS=0x
VRF_ADDRESS=0x
PAIRS=BTC/USD,ETH/USD
IGNORE_SOURCES=BITSTAMP,DEFILLAMA
IGNORE_PUBLISHERS=BINANCE

In order for the full flow to work you will need to have tables following the table schemas defined here.

You can use our indexer service on this repository to spin off your indexer in a few commands very easily.