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 either the
grafana.ini
ordefaults.ini
file. Note: When installing Grafana 10 from a tar file, there is nografana.in
and instead there is a./conf/defaults.ini
file. Either way, edit the following line:app_mode = development
- Or, add the plugin to the whitelist by editing that same file and update this 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 <YOUR-PLUGIN-PATH> --insecure --pluginUrl https://github.com/tinybirdco/grafana-tinybird-datasource/releases/download/2.0.0/grafana-tinybird-datasource-2.0.0.zip plugins install tinybird-tinybird-datasource
- Notes:
- Your
<YOUR-PLUGIN-PATH>
depends... In some cases, it is/var/lib/grafana/plugins
. Thedefaults.ini
file references adata/plugins
folder. When running the Grafana CLI from itsbin
folder, setting the plugin path to../data/plugins
did the trick and Grafana server was able to find and load the plugin. YMMV. - You'll know it loaded as expected when you see this
WARN
message when starting Grafana server:WARN [06-29|14:48:06] Permitting unsigned plugin. This is not recommended logger=plugin.signature.validator pluginID=tinybird-tinybird-datasource
- With this release the zip file name has a new pattern:
grafana-tinybird-datasource
instead oftinybird-tinybird-datasource
- Your
- 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.
BE:
- Install mage
- Build binaries & start docker container
mage -v && docker compose up
FE:
- Install dependencies
yarn install
- Run in development mode
yarn run dev
- Build for production
yarn run build