Skip to content
Google BigQuery Datasource Plugin for Grafana
Branch: master
Clone or download
avivl Merge pull request #42 from doitintl/aviv/issue37
Add support for tables partitioned by filed
Latest commit 57d3f72 Apr 23, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci fix build on circle Mar 20, 2019
.github
dist
img plugin demo Apr 7, 2019
src Add support for tables partitioned by filed Apr 23, 2019
.coveralls.yml
.gcpprj POC based on REST API Mar 12, 2019
.gitignore Happy linting - more to come.... Apr 1, 2019
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Mar 21, 2019
CONTRIBUTING.md docs Mar 27, 2019
INSTALL.md 0.3.0 Apr 4, 2019
LICENSE.md
README.md Adding plugin demo image Apr 7, 2019
_config.yml Update _config.yml Apr 2, 2019
babel.config.js POC based on REST API Mar 12, 2019
bigquery_enable_api.png Readme first draft. Mar 17, 2019
bq__grafana_upload_key.png Readme Mar 20, 2019
bq_grafana_key_uploaded.png Readme Mar 20, 2019
bq_service_account_choose_role.png Readme Mar 20, 2019
createserviceaccountbutton.png Updating Readme Mar 19, 2019
jest.config.js
newserviceaccount.png Updating Readme Mar 19, 2019
package.json
tsconfig.json
tslint.json Happy linting - more to come.... Apr 1, 2019
webpack.config.js docs Mar 27, 2019
webpack.config.prod.js POC based on REST API Mar 12, 2019

README.md

GitHub stars GitHub forks Circle CI Code Climate Issue Count CodeCpv

Status: Ready for Beta Testing

BigQuery datasource for Grafana

BigQuery datasource plugin provide support for BigQuery as a backend database.

Quick start

There are multiple ways to install bigquery-grafana go to INSTALL for more infromation.

Features:

  • Query setup
  • Raw SQL editor
  • Query formatting
  • Macros support
  • Additional functions
  • Table view
  • Annotations
  • Sharded tables (tablename_YYYYMMDD)
  • Partitioned Tables

Plugin Demo:

plugin demo

Adding the data source to Grafana

  1. Open the side menu by clicking the Grafana icon in the top header.
  2. In the side menu under the Dashboards link you should find a link named Data Sources.
  3. Click the + Add data source button in the top header.
  4. Select BigQuery from the Type dropdown.
  5. 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 Sources link in your side menu it means that your current user does not have the Admin role for the current organization.

Name Description
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.

Authentication

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.

Enable APIs

The following APIs need to be enabled first:

Click on the links above and click the Enable button:

Enable GCP APIs

Create a GCP Service Account for a Project

  1. Navigate to the APIs & Services Credentials page.

  2. Click on the Create credentials dropdown/button and choose the Service account key option.

  3. On the Create service account key page, choose key type JSON. Then in the Service Account dropdown, choose the New service account option:

  4. Some new fields will appear. Fill in a name for the service account in the Service account name field and then choose the Monitoring Viewer role from the Role dropdown:

  5. 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.

  6. Upload it to Grafana on the datasource Configuration page. You can either upload the file or paste in the contents of the file.

  7. 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.

  1. 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.
  2. Make sure the GCE virtual machine instance is being run as the service account that you just created. See instructions here.
  3. Allow access to the Stackdriver Monitoring API scope. See instructions here.

Read more about creating and enabling service accounts for GCE VM instances here.

Build

The build works with Yarn:

Development build

yarn run run build:dev

Production build

yarn run run build:prod

Tests can be run with Jest:

yarn run test

Contributing

See the Contribution Guide.

License

See the License File.

You can’t perform that action at this time.