This plugin enables you to use your published Tinybird APIs with Grafana.
The plugin is not yet available in the Grafana Marketplace and must be installed manually. This requires enabling the Grafana option to install unsigned plugins. To do this, you have two options (you do not need to do both!):
- Put Grafana into 'development' mode by editing
grafana.ini
and editing the following line:app_mode = development
- Add the plugin to the whitelist by editing
grafana.ini
and editing the following line:allow_loading_unsigned_plugins = tinybird-tinybird-datasource
- Find the release bundle in the GitHub releases and install using
grafana-cli
. For example:./grafana-cli --pluginsDir /var/lib/grafana/plugins --insecure --pluginUrl https://github.com/tinybirdco/grafana-tinybird-datasource/releases/download/1.2.0/tinybird-tinybird-datasource-1.2.0.zip plugins install tinybird-tinybird-datasource
- Restart Grafana to load the plugin
- Open the Data Sources page, and add a new Tinybird Data Source.
- In the Data Source config, set the Tinybird endpoint to use. This is specific to the Tinybird region you are in (e.g.
https://api.tinybird.co
orhttps://api.us-east.tinybird.co
) - In the Data Source config, set the Tinybird Auth Token to use. This token should have
READ
permissions for the API Endpoints you wish to visualize. - Save the Data Source config
- Open a dashboard and add a new panel
- Select the Tinybird Data Source
- From the
Pipe
dropdown, select the API Endpoint you wish to visualize - From the
Format
dropdown, select the format that is appropriate for your vizualization - If your API Endpoint has parameters, they will be automatically discovered and added to the parameters table. If your API Endpoint has params to accept a date range, you can configure them here to accept the Grafana date range variables. For example, if your API Endpoint accepts a param
date_from
anddate_to
, you can use the Grafana variables${__from}
and${__to}
respectively.
Configure the Data Source with a Tinybird Auth Token, and it will auto-discover the API Endpoints that the token has permissions to read. When you add a new panel, simlpy select which API Endpoint you want to use from a dropdown list.
When you select an API Endpoint in a panel, it will automatically discover the parameters that are available to pass through. You can choose which parameters to pass a value for, including sending Grafana variables.
When configuring the Data Source, you will be asked for an Auth Token. This Auth Token must have READ
access to all Pipes that you wish to use with the Data Source.
You should take care to ensure that your Pipes are optimised when adding them to Grafana, as Grafana can cause a lot of requests (e.g. with auto-refreshes).
Here are some sugggestions:
- Ensure there is a default applied to date range parameters in Tinybird (or a LIMIT on how many rows to return). When you add a new panel to Grafana, it won't apply the date filters by default. If you have no defaults, or date range params are marked as optional, you could scan the entire table and return millions of results. This is a good way to crash your browser.
- Optimise the sorting keys of your Data Sources in Tinybird, so that queries from Grafana are scanning as little data as possible. Ensure you are applying these filters appropriately in Grafana.