欧洲杯投注软件

Google BigQuery

Data Source

Google BigQuery datasource for Grafana

GitHub forks

Status: Production Ready

BigQuery DataSource for Grafana

A BigQuery DataSource plugin provides support for as a backend database.

Quick Start

There are multiple ways to install bigquery-grafana. See for more information.

Features:

  • Query setup
  • Raw SQL editor
  • Query formatting
  • Macros support
  • Additional functions
  • Table view
  • Annotations
  • BQ queries in variables
  • Sharded tables (tablename_YYYYMMDD)
  • Partitioned Tables
  • Granular slot allocation (Running queries in a project with flat-rate pricing)

Limitations:

  • Alerts are not yet supported due to

Plugin Demo:

plugin demo

Adding the DataSource to Grafana

  1. Open the side menu by clicking the Grafana icon in the top header.
  2. In the side menu under Dashboards 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.

NameDescription
NameThe datasource name. This is how you refer to the datasource in panels & queries.
DefaultDefault datasource means that it will be pre-selected for new panels.
Service Account KeyService Account Key File for a GCP Project. Instructions below on how to create it.

Example of Provisioning a File

You can manage DataSource via provisioning system. See the example below of a configuration file.

apiVersion: 1

datasources:
- name: <Datasource Name>
  type: doitintl-bigquery-datasource
  access: proxy
  isDefault: true
  jsonData:
       authenticationType: jwt
       clientEmail: <Service Account Email>
       defaultProject: <Default Project Name>
       tokenUri: http://oauth2.googleapis.com/token
  secureJsonData:
       privateKey: |
          -----BEGIN PRIVATE KEY-----
           <Content of the Private Key>
          -----END PRIVATE KEY-----
  version: 2
  readOnly: false

Authentication

欧洲杯投注软件There are two ways to authenticate the BigQuery plugin - either by uploading a Google JWT file, or by automatically retrieving credentials from Google's metadata server. The latter is only available when running Grafana on a 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

Go to and Enable the API:

Enable GCP APIs

Create a GCP Service Account for a Project

  1. 欧洲杯投注软件Navigate to the .

  2. Click on Create credentials and choose Service account key.

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

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

Build

The build works with Yarn:

Development Build

yarn run build:dev

Production Build

yarn run build:prod

欧洲杯投注软件Tests can be run with Jest:

yarn run test

Contributing

See the .

License

See the .

Sign in to install

Version