Skip to content

ecadlabs/tezos-grafana-datasource

Repository files navigation

Tezos Grafana Data Source Backend Plugin

Build

What is Tezos Grafana Data Source Backend Plugin?

This plugin allows users to present data from the Tezos chain using only a Tezos node. It does not depend on any external indexers. The plugin allows users to write expressions using the Cuelang language.

Getting started

Prerequiste: a functioning docker installation, the jq command line tool, and a Tezos RPC node

The fastest way to install and run the plugin is to use the official Grafana docker image as follows:

docker run -it \
      -p 3000:3000 \
      --name=tezos-grafana \
      -e "GF_INSTALL_PLUGINS=$(curl -sH "Accept: application/vnd.github.v3+json" https://api.github.com/repos/ecadlabs/tezos-grafana-datasource/releases | jq -r '[.[] | select(.draft == false and .prerelease == false)][0].assets[0].browser_download_url');ecad-labs-tezos-datasource" \
      -e "GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=ecad-labs-tezos-datasource" \
      grafana/grafana:latest

Configuring your first Tezos plugin datasource

  1. Navigate to http://localhost:3000/ and login to your Grafana instance using username: admin and password: admin.
  2. In the Grafana web interface, go "Configuration" -> "Data Sources"
  3. Click the "Add data source" button
  4. Either enter "tezos" in the search bar, or scroll to the bottom of the list
  5. When hovering your cursor over the "tezos-datasource" plugin entry, click the "Select" button.
  6. Name the Data Source entry appropriatley. Example "tezos-datasource mainnet" is sensible if you are using a mainnet node
  7. Enter the http URL of the RPC node you want to use.
  8. Specify main in the "Chain" input box.
  9. Click "Save & Test"

Importing the example Dashboard as a starting point

  1. In Grafana, click "Import" From the "Create" menu (shows as a + symbol when the left menu is collapsed).
  2. In the "Import via grafana.com" text field type the number 15174 or the full URL https://grafana.com/grafana/dashboards/15174, click "Load".
  3. On the next screen, select the data-source you created in the previous step.
  4. Click "Import"
  5. You should have a new dashboard.

Query expressions

The plugin uses Cuelang for its query syntax.

Queries should appear between square brackets [...], and ther first element is typically a time value.

Example queries are:

Number of endorsements per block over time

[block.header.timestamp, block.statistics.n_ops.endorsement]

Number of operations per block over time

[block.header.timestamp, block.statistics.n_ops_total]

Block delay over time

[block.header.timestamp, block.delay / block.minimal_delay]

Multiple items can be added to a single query. The following example shows

[
 block.header.timestamp, 
 block.statistics.n_ops.endorsement,
 block.statistics.n_ops.reveal,
 block.statistics.n_ops.transaction,
 block.statistics.n_ops.origination,
 block.statistics.n_ops.delegation
]

Limitations

The Tezos Grafana Plugin must query blocks from the node. It caches data as it goes, but the plugin will take a long time for longer time spans as querying many blocks from a Tezos node is a slow process. Narrow your time range to smaller units for best results, such as 15 minutes or 3 hours.

--