Status: Ready for Beta Testing
BigQuery datasource for Grafana
BigQuery datasource plugin provide support for BigQuery as a backend database.
There are multiple ways to install bigquery-grafana go to INSTALL for more infromation.
- Query setup
- Raw SQL editor
- Query formatting
- Macros support
- Additional functions
- Table view
- BQ queries in variables
- Sharded tables (
- Partitioned Tables
Adding the data source to Grafana
- Open the side menu by clicking the Grafana icon in the top header.
- In the side menu under the
Dashboardslink you should find a link named
- Click the
+ Add data sourcebutton in the top header.
BigQueryfrom the Type dropdown.
- Upload or paste in the Service Account Key file. See below for steps on how to create a Service Account Key file.
NOTE: If you're not seeing the
Data Sourceslink in your side menu it means that your current user does not have the
Adminrole for the current organization.
|Name||The datasource name. This is how you refer to the datasource in panels & queries.|
|Default||Default datasource means that it will be pre-selected for new panels.|
|Service Account Key||Service Account Key File for a GCP Project. Instructions below on how to create it.|
There are two ways to authenticate the BigQuery plugin - either by uploading a Google JWT file, or by automatically retrieving credentials from Google metadata server. The latter option is only available when running Grafana on GCE virtual machine.
Using a Google Service Account Key File
To authenticate with the BigQuery API, you need to create a Google Cloud Platform (GCP) Service Account for the Project you want to show data for. A Grafana datasource integrates with one GCP Project. If you want to visualize data from multiple GCP Projects then you can give the service account permissions in each project or create one datasource per GCP Project.
The following APIs need to be enabled first:
Click on the links above and click the
Create a GCP Service Account for a Project
Navigate to the APIs & Services Credentials page.
Click on the
Create credentialsdropdown/button and choose the
Service account keyoption.
Create service account keypage, choose key type
JSON. Then in the
Service Accountdropdown, choose the
New service accountoption:
Some new fields will appear. Fill in a name for the service account in the
Service account namefield and then choose the
Monitoring Viewerrole from the
Click the Create button. A JSON key file will be created and downloaded to your computer. Store this file in a secure place as it allows access to your Stackdriver data.
Upload it to Grafana on the datasource Configuration page. You can either upload the file or paste in the contents of the file.
The file contents will be encrypted and saved in the Grafana database. Don't forget to save after uploading the file!
Using GCE Default Service Account
If Grafana is running on a Google Compute Engine (GCE) virtual machine, it is possible for Grafana to automatically retrieve default credentials from the metadata server. This has the advantage of not needing to generate a private key file for the service account and also not having to upload the file to Grafana. However for this to work, there are a few preconditions that need to be met.
- First of all, you need to create a Service Account that can be used by the GCE virtual machine. See detailed instructions on how to do that here.
- Make sure the GCE virtual machine instance is being run as the service account that you just created. See instructions here.
- Allow access to the
Stackdriver Monitoring APIscope. See instructions here.
Read more about creating and enabling service accounts for GCE VM instances here.
The build works with Yarn:
yarn run build:dev
yarn run build:prod
Tests can be run with Jest:
yarn run test
See the Contribution Guide.
See the License File. **