Skip to content
This repository was archived by the owner on Dec 11, 2022. It is now read-only.

Commit a30b351

Browse files
authored
Merge pull request #152 from doitintl/issue-151
Fixes #151
2 parents 131a8e1 + 05ad5cc commit a30b351

File tree

4 files changed

+25
-23
lines changed

4 files changed

+25
-23
lines changed

dist/README.md

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
[![Issue Count](https://codeclimate.com/github/doitintl/bigquery-grafana/badges/issue_count.svg)](https://codeclimate.com/github/doitintl/bigquery-grafana)
77
[![CodeCpv](https://codecov.io/gh/doitintl/bigquery-grafana/branch/master/graph/badge.svg)](https://codecov.io/gh/doitintl/bigquery-grafana/)
88
## Status: Production Ready
9-
# BigQuery datasource for Grafana
9+
# BigQuery DataSource for Grafana
1010

11-
BigQuery datasource plugin provide support for [BigQuery](https://cloud.google.com/bigquery/) as a backend database.
11+
A BigQuery DataSource plugin provides support for [BigQuery](https://cloud.google.com/bigquery/) as a backend database.
1212

13-
### Quick start
14-
There are multiple ways to install bigquery-grafana go to [INSTALL](https://raw.githubusercontent.com/doitintl/bigquery-grafana/master/INSTALL.md) for more infromation.
13+
### Quick Start
14+
There are multiple ways to install bigquery-grafana. See [INSTALL](https://raw.githubusercontent.com/doitintl/bigquery-grafana/master/INSTALL.md) for more information.
1515

1616
### Features:
1717

@@ -28,17 +28,17 @@ There are multiple ways to install bigquery-grafana go to [INSTALL](https://raw.
2828

2929
### Limitations:
3030

31-
* Alerts are not supported yet due to [#6841](https://github.com/grafana/grafana/issues/6841)
31+
* Alerts are not yet supported due to [#6841](https://github.com/grafana/grafana/issues/6841)
3232

3333
**Plugin Demo:**
3434

3535
![plugin demo](https://raw.githubusercontent.com/doitintl/bigquery-grafana/master/img/grafana-bigquery-demo.gif)
3636

3737

38-
## Adding the data source to Grafana
38+
## Adding the DataSource to Grafana
3939

4040
1. Open the side menu by clicking the Grafana icon in the top header.
41-
2. In the side menu under the `Dashboards` link you should find a link named `Data Sources`.
41+
2. In the side menu under `Dashboards` you should find a link named `Data Sources`.
4242
3. Click the `+ Add data source` button in the top header.
4343
4. Select `BigQuery` from the _Type_ dropdown.
4444
5. Upload or paste in the Service Account Key file. See below for steps on how to create a Service Account Key file.
@@ -51,9 +51,9 @@ There are multiple ways to install bigquery-grafana go to [INSTALL](https://raw.
5151
| _Default_ | Default datasource means that it will be pre-selected for new panels. |
5252
| _Service Account Key_ | Service Account Key File for a GCP Project. Instructions below on how to create it. |
5353

54-
### Example of provisioning file
54+
### Example of Provisioning a File
5555

56-
It's possible to manage datasource via [provisioning system](https://grafana.com/docs/administration/provisioning/#datasources). See below example of configuration file.
56+
You can manage DataSource via [provisioning system](https://grafana.com/docs/administration/provisioning/#datasources). See the example below of a configuration file.
5757
```
5858
apiVersion: 1
5959
@@ -78,27 +78,22 @@ datasources:
7878

7979
## Authentication
8080

81-
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.
81+
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.
8282

8383
### Using a Google Service Account Key File
8484

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

8787
#### Enable APIs
8888

89-
The following APIs need to be enabled first:
90-
91-
* [BigQuery API](https://console.cloud.google.com/apis/library/bigquery-json.googleapis.com)
92-
93-
94-
Click on the links above and click the `Enable` button:
89+
Go to [BigQuery API](https://console.cloud.google.com/apis/library/bigquery-json.googleapis.com) and `Enable` the API:
9590

9691
![Enable GCP APIs](https://raw.githubusercontent.com/doitintl/bigquery-grafana/master/img/bigquery_enable_api.png)
9792

9893
#### Create a GCP Service Account for a Project
9994

10095
1. Navigate to the [APIs & Services Credentials page](https://console.cloud.google.com/apis/credentials).
101-
2. Click on the `Create credentials` dropdown/button and choose the `Service account key` option.
96+
2. Click on `Create credentials` and choose `Service account key`.
10297

10398
![](https://raw.githubusercontent.com/doitintl/bigquery-grafana/master/img/createserviceaccountbutton.png)
10499
3. On the `Create service account key` page, choose key type `JSON`. Then in the `Service Account` dropdown, choose the `New service account` option:
@@ -108,7 +103,7 @@ Click on the links above and click the `Enable` button:
108103
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:
109104

110105
![](https://raw.githubusercontent.com/doitintl/bigquery-grafana/master/img/bq_service_account_choose_role.png)
111-
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.
106+
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.
112107
6. Upload it to Grafana on the datasource Configuration page. You can either upload the file or paste in the contents of the file.
113108

114109
![](https://raw.githubusercontent.com/doitintl/bigquery-grafana/master/img/bq__grafana_upload_key.png)
@@ -131,12 +126,12 @@ Read more about creating and enabling service accounts for GCE VM instances [her
131126

132127
The build works with Yarn:
133128

134-
#### Development build
129+
#### Development Build
135130
```
136131
yarn run build:dev
137132
```
138133

139-
#### Production build
134+
#### Production Build
140135
```
141136
yarn run build:prod
142137
```

dist/module.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59270,9 +59270,9 @@ function () {
5927059270
})();
5927159271

5927259272
this.mixpanel = __webpack_require__(/*! mixpanel-browser */ "../node_modules/mixpanel-browser/build/mixpanel.cjs.js");
59273-
this.mixpanel.init("86fa5c838013959cc6867dc884958f7e");
5927459273

5927559274
if (this.jsonData.sendUsageData !== false) {
59275+
this.mixpanel.init("86fa5c838013959cc6867dc884958f7e");
5927659276
this.mixpanel.track("datasource.create");
5927759277
}
5927859278
}
@@ -59883,6 +59883,10 @@ function () {
5988359883
return _this.doQueryRequest(query, requestId, maxRetries - 1);
5988459884
}
5988559885

59886+
if (error.cancelled === true) {
59887+
return [];
59888+
}
59889+
5988659890
return BigQueryDatasource._handleError(error);
5988759891
})];
5988859892
});

dist/module.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/datasource.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ export class BigQueryDatasource {
170170
(await this.getDefaultProject());
171171
})();
172172
this.mixpanel = require("mixpanel-browser");
173-
this.mixpanel.init("86fa5c838013959cc6867dc884958f7e");
174173
if (this.jsonData.sendUsageData !== false) {
174+
this.mixpanel.init("86fa5c838013959cc6867dc884958f7e");
175175
this.mixpanel.track("datasource.create");
176176
}
177177
}
@@ -477,6 +477,9 @@ export class BigQueryDatasource {
477477
if (maxRetries > 0) {
478478
return this.doQueryRequest(query, requestId, maxRetries - 1);
479479
}
480+
if (error.cancelled === true) {
481+
return [];
482+
}
480483
return BigQueryDatasource._handleError(error);
481484
});
482485
}

0 commit comments

Comments
 (0)