Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ecadlabs/tezos-grafana-datasource

A Grafana backend data source plugin for the Tezos blockchain
https://github.com/ecadlabs/tezos-grafana-datasource

grafana tezos

Last synced: 26 days ago
JSON representation

A Grafana backend data source plugin for the Tezos blockchain

Awesome Lists containing this project

README

        

# Tezos Grafana Data Source Backend Plugin

[![Build](https://github.com/grafana/grafana-starter-datasource-backend/workflows/CI/badge.svg)](https://github.com/grafana/grafana-datasource-backend/actions?query=workflow%3A%22CI%22)

## 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][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
8. Enter the http URL of the RPC node you want to use.
9. Specify `main` in the "Chain" input box.
10. 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][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.

--

[cuelang]: https://cuelang.org/