Grafana

Connect Grafana to your Tinybird RawTree deployment and run a SQL query in Explore.

Connect Grafana to Tinybird RawTree

Grafana can query your RawTree tables through the deployment’s direct HTTPS endpoint. Tinybird RawTree is protocol-compatible with ClickHouse® and you can take advantage of ClickHouse's data source from Grafana Labs.

Get the deployment hostname and API key

This setup requires your deployment-specific hostname and a direct HTTPS endpoint for SQL on port 8443.

For a cloud deployment, use the Database SQL interface that matches your cluster’s deployment ID.

Cloud regionDatabase SQL interface
N. Virginia (us-east-1)https://api.765eb5f5.us-east-1.aws.rawtree.com:8443/
Ireland (eu-west-1)https://api.78d4d9f2.eu-west-1.aws.rawtree.com:8443/
  1. Open your cluster in the Tinybird RawTree dashboard.
  2. Open Connect → App (API/SDK).
  3. Copy the Regional API hostname that matches api.<deployment_id>.<cloud_region>.aws.rawtree.com.
  4. Create a key for Grafana with Read only access under API keys.

You can also obtain the regional ID using the CLI or API. Set RAWTREE_API_KEY to the read-only key you created for Grafana. Both examples use jq to show the deployment ID and cloud region for your cluster.

curl -fsS "https://api.rawtree.com/v1/clusters" \
  -H "Authorization: Bearer $RAWTREE_API_KEY" |
  jq '.clusters[] | {deployment_id, cloud_region}'
rtree cluster list --api-url https://api.rawtree.com --json |
  jq '.clusters[] | {deployment_id, cloud_region}'

Configure the Grafana data source

  1. Open Connections → Add new connection in Grafana.
  2. Select ClickHouse by Grafana Labs.
  3. Install the plugin if Grafana prompts you.
  4. Select Add new data source.
  5. Enter the connection settings below.
Grafana settingValue
Server addressThe deployment hostname only. Omit https://, the port, and the path.
ProtocolHTTP
Secure ConnectionOn
Server port8443
Skip TLS VerifyOff
HTTP URL PathLeave empty to use /.
Username and PasswordLeave both empty.

Set the bearer token under Custom HTTP Headers.

  1. Select Add Header.
  2. Enter Authorization in Header Name.
  3. Enable Secure.
  4. Enter Bearer <API_KEY> in Secure Header Value, substituting your read-only key for <API_KEY>.
  5. Select Save & test.

Grafana reports Data source is working.

Run a query

  1. Open Explore in Grafana.
  2. Select the data source you just configured.
  3. Select SQL Editor.
  4. Run this query in Table format.
SELECT 1 AS connected

The result contains one row with 1 in the connected column.

If Grafana reports 401 Unauthorized, check the bearer header and the key’s expiration. If the connection times out, check that the Grafana server can reach the deployment hostname on TCP port 8443.