You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 11, 2022. It is now read-only.
Contributions take the form of pull requests that will be reviewed by the core team.
6
5
7
-
* If you are a new contributor see: [Steps to Contribute](#steps-to-contribute)
8
-
9
-
* If you have a trivial fix or improvement, go ahead and create a pull request.
6
+
- If you are a new contributor see: [Steps to Contribute](#steps-to-contribute)
10
7
11
-
* If you plan to do something more involved, discuss your idea on the respective [issue](https://github.com/doitintl/bigquery-grafana/issues) or create a [new issue](https://github.com/doitintl/bigquery-grafana/issues/new/choose) if it does not exist. This will avoid unnecessary work and surely give you and us a good deal of inspiration.
8
+
- If you have a trivial fix or improvement, go ahead and create a pull request.
12
9
10
+
- If you plan to do something more involved, discuss your idea on the respective [issue](https://github.com/doitintl/bigquery-grafana/issues) or create a [new issue](https://github.com/doitintl/bigquery-grafana/issues/new/choose) if it does not exist. This will avoid unnecessary work and surely give you and us a good deal of inspiration.
13
11
14
12
## Steps to Contribute
15
13
16
14
Should you wish to work on a GitHub issue, check first if it is not already assigned to someone. If it is free, you claim it by commenting on the issue that you want to work on it. This is to prevent duplicated efforts from contributors on the same issue.
17
15
18
16
Please check the [`beginner friendly`](https://github.com/doitintl/bigquery-grafana/issues?q=is%3Aopen+is%3Aissue+label%3A%22beginner+friendly%22) and [`help wanted`](https://github.com/doitintl/bigquery-grafana/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) labels to find issues that are good for getting started. If you have questions about one of the issues, with or without the tag, please comment on them and one of the core team or the original poster will clarify it.
19
17
20
-
21
-
22
18
## Pull Request Checklist
23
19
24
-
* Branch from the master branch and, if needed, rebase to the current master branch before submitting your pull request. If it doesn't merge cleanly with master you may be asked to rebase your changes.
20
+
- Branch from the master branch and, if needed, rebase to the current master branch before submitting your pull request. If it doesn't merge cleanly with master you may be asked to rebase your changes.
25
21
26
-
* If your patch is not getting reviewed or you need a specific person to review it, you can @-reply a reviewer asking for a review in the pull request or a comment.
22
+
- If your patch is not getting reviewed or you need a specific person to review it, you can @-reply a reviewer asking for a review in the pull request or a comment.
27
23
28
-
* Add tests relevant to the fixed bug or new feature.
24
+
- Add tests relevant to the fixed bug or new feature.
29
25
30
26
### Pull requests with new features
27
+
31
28
Commits should be as small as possible, while ensuring that each commit is correct independently (i.e., each commit should compile and pass tests).
32
29
33
30
Make sure to include `Closes #<issue number>` or `Fixes #<issue number>` in the pull request description.
34
31
35
32
### Pull requests with bug fixes
33
+
36
34
Please make all changes in one commit if possible. Include `Closes #<issue number>` in bottom of the commit message.
37
35
A commit message for a bug fix should look something like this.
38
36
@@ -48,4 +46,3 @@ Closes #12864
48
46
```
49
47
50
48
If the pull request needs changes before its merged the new commits should be rebased into one commit before its merged.
[](https://github-tools.github.io/github-release-notes/)
8
+
9
9
## Status: Production Ready
10
+
10
11
# BigQuery DataSource for Grafana
11
12
12
13
A BigQuery DataSource plugin provides support for [BigQuery](https://cloud.google.com/bigquery/) as a backend database.
13
14
14
15
### Quick Start
16
+
15
17
There are multiple ways to install bigquery-grafana. See [INSTALL](https://doitintl.github.io/bigquery-grafana/INSTALL) for more information.
16
18
17
19
### Features:
18
20
19
-
* Query setup
20
-
* Raw SQL editor
21
-
* Query builder
22
-
* Macros support
23
-
* Additional functions
24
-
* Table view
25
-
* Annotations
26
-
* BQ queries in variables
27
-
* Sharded tables (`tablename_YYYYMMDD`)
28
-
* Partitioned Tables
29
-
* Granular slot allocation (Running queries in a project with flat-rate pricing)
30
-
31
-
**Plugin Demo:**
21
+
- Query setup
22
+
- Raw SQL editor
23
+
- Query builder
24
+
- Macros support
25
+
- Additional functions
26
+
- Table view
27
+
- Annotations
28
+
- BQ queries in variables
29
+
- Sharded tables (`tablename_YYYYMMDD`)
30
+
- Partitioned Tables
31
+
- Granular slot allocation (Running queries in a project with flat-rate pricing)
@@ -57,6 +58,7 @@ You can now set query priority "INTERACTIVE" or "BATCH" per datasouce
57
58
### Example of Provisioning a File
58
59
59
60
You can manage DataSource via [provisioning system](https://grafana.com/docs/administration/provisioning/#datasources). See the example below of a configuration file.
61
+
60
62
```
61
63
apiVersion: 1
62
64
@@ -85,7 +87,7 @@ There are two ways to authenticate the BigQuery plugin - either by uploading a G
85
87
86
88
### Using a Google Service Account Key File
87
89
88
-
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.
90
+
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.
89
91
90
92
#### Enable APIs
91
93
@@ -98,22 +100,24 @@ Go to [BigQuery API](https://console.cloud.google.com/apis/library/bigquery.goog
98
100
1. Navigate to the [APIs & Services Credentials page](https://console.cloud.google.com/apis/credentials).
99
101
2. Click on `Create credentials` and choose `Service account key`.
4. Some new fields will appear. Fill in a name for the service account in the `Service account name` field and then choose the `BigQuery Data Viewer` and `BigQuery Job User` roles 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.
110
114
6. Upload it to Grafana on the datasource Configuration page. You can either upload the file or paste in the contents of the file.
@@ -126,40 +130,49 @@ If Grafana is running on a Google Compute Engine (GCE) virtual machine, it is po
126
130
Read more about creating and enabling service accounts for GCE VM instances [here](https://cloud.google.com/compute/docs/access/create-enable-service-accounts-for-instances).
127
131
128
132
### Using the Query Builder
133
+
129
134
The query builder provides a simple yet a user-friendly interface to help you quickly compose a query. The builder enables you to define the basic parts of your query, The common ones are:
135
+
130
136
1. The table you want to query from
131
137
2. The time field and metric field
132
138
3. WHERE clause - Either use one of the pre-defined macros, to speed your writing time, or set up your own expression. Existing supported Macros are:
133
-
134
-
a. Macro $__timeFiler with last 7 days example:
139
+
140
+
a. Macro $__timeFiler with last 7 days example:
141
+
135
142
```
136
143
WHERE `createDate` BETWEEN TIMESTAMP_MILLIS (1592147699012) AND TIMESTAMP_MILLIS (1592752499012) AND _PARTITIONTIME >= '2020-06-14 18:14:59' AND _PARTITIONTIME < '2020-06-21 18:14:59'
137
-
```
138
-
b. Macro $__timeFrom with last 7 days example:
144
+
```
145
+
146
+
b. Macro $__timeFrom with last 7 days example:
147
+
139
148
```
140
149
WHERE `createDate` > TIMESTAMP_MILLIS (1592223758609) AND _PARTITIONTIME >= '2020-06-15 15:22:38' AND _PARTITIONTIME < '2020-06-22 15:22:38'
141
150
```
142
-
c. Macro $__timeTo with last 7 days example:
151
+
152
+
c. Macro $__timeTo with last 7 days example:
153
+
143
154
```
144
155
WHERE `createDate` < TIMESTAMP_MILLIS (1592828659681) AND _PARTITIONTIME >= '2020-06-15 15:24:19' AND _PARTITIONTIME < '2020-06-22 15:24:19'
145
156
```
146
157
147
158
You can now use timeFilter macro in raw sql mode
148
159
149
160
4. GROUP BY option - You can use a pre-defined macro or use one of the fields from your query
150
-
a. time ($__interval,none)
161
+
a. time ($__interval,none)
151
162
5. ORDER BY option
152
163
153
164
Note: If your processing location is not the Default US one set your location from the processing Location drop-down at the top right bottom of the query builder
154
165
155
166
### Troubleshooting
156
-
Viewing your Query
157
-
1. Use The Query Inspector located at the top of the query builder
0 commit comments