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

Commit 2b4dfd9

Browse files
authored
Merge pull request #250 from doitintl/feature/lior/alerts
Feature/lior/alerts
2 parents d244fe8 + bdd3052 commit 2b4dfd9

16 files changed

+1051
-18
lines changed

README.md

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ There are multiple ways to install bigquery-grafana. See [INSTALL](https://doiti
1818

1919
* Query setup
2020
* Raw SQL editor
21-
* Query formatting
21+
* Query builder
2222
* Macros support
2323
* Additional functions
2424
* Table view
@@ -28,10 +28,6 @@ There are multiple ways to install bigquery-grafana. See [INSTALL](https://doiti
2828
* Partitioned Tables
2929
* Granular slot allocation (Running queries in a project with flat-rate pricing)
3030

31-
### Limitations:
32-
33-
* Alerts are not yet supported due to [#6841](https://github.com/grafana/grafana/issues/6841)
34-
3531
**Plugin Demo:**
3632

3733
![plugin demo](https://raw.githubusercontent.com/doitintl/bigquery-grafana/master/img/grafana-bigquery-demo.gif)
@@ -124,6 +120,42 @@ If Grafana is running on a Google Compute Engine (GCE) virtual machine, it is po
124120

125121
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).
126122

123+
### Using the Query Builder
124+
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:
125+
1. The table you want to query from
126+
2. The time field and metric field
127+
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:
128+
129+
a. Macro $__timeFiler with last 7 days example:
130+
```
131+
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'
132+
```
133+
b. Macro $__timeFrom with last 7 days example:
134+
```
135+
WHERE `createDate` > TIMESTAMP_MILLIS (1592223758609) AND _PARTITIONTIME >= '2020-06-15 15:22:38' AND _PARTITIONTIME < '2020-06-22 15:22:38'
136+
```
137+
c. Macro $__timeTo with last 7 days example:
138+
```
139+
WHERE `createDate` < TIMESTAMP_MILLIS (1592828659681) AND _PARTITIONTIME >= '2020-06-15 15:24:19' AND _PARTITIONTIME < '2020-06-22 15:24:19'
140+
```
141+
142+
4. GROUP BY option - You can use a pre-defined macro or use one of the fields from your query
143+
a. time ($__interval,none)
144+
5. ORDER BY option
145+
146+
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
147+
148+
### Troubleshooting
149+
Viewing your Query
150+
1. Use The Query Inspector located at the top of the query builder
151+
![](https://raw.githubusercontent.com/doitintl/bigquery-grafana/master/img/QueryInspector.png)
152+
2. The query Inspector enables you to see the clean query and troubleshoot SQL errors
153+
![](https://raw.githubusercontent.com/doitintl/bigquery-grafana/master/img/InspectPanel.png)
154+
The Query builder comes with a set of defaults which are control from the top of the Query Builder
155+
![](https://raw.githubusercontent.com/doitintl/bigquery-grafana/master/img/QueryBuilder.png)
156+
157+
![](https://raw.githubusercontent.com/doitintl/bigquery-grafana/master/img/QueryOptions.png)
158+
127159
### Build
128160

129161
The build works with Yarn:

dist/README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[![Code Climate](https://codeclimate.com/github/doitintl/bigquery-grafana/badges/gpa.svg)](https://codeclimate.com/github/doitintl/bigquery-grafana/coverage)
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/)
8+
[![Automated Release Notes by gren](https://img.shields.io/badge/%F0%9F%A4%96-release%20notes-00B2EE.svg)](https://github-tools.github.io/github-release-notes/)
89
## Status: Production Ready
910
# BigQuery DataSource for Grafana
1011

@@ -27,10 +28,6 @@ There are multiple ways to install bigquery-grafana. See [INSTALL](https://doiti
2728
* Partitioned Tables
2829
* Granular slot allocation (Running queries in a project with flat-rate pricing)
2930

30-
### Limitations:
31-
32-
* Alerts are not yet supported due to [#6841](https://github.com/grafana/grafana/issues/6841)
33-
3431
**Plugin Demo:**
3532

3633
![plugin demo](https://raw.githubusercontent.com/doitintl/bigquery-grafana/master/img/grafana-bigquery-demo.gif)
18.7 MB
Binary file not shown.
18.7 MB
Binary file not shown.
Binary file not shown.

dist/module.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59623,6 +59623,9 @@ var _response_parser2 = _interopRequireDefault(_response_parser);
5962359623

5962459624
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
5962559625

59626+
// import { validate } from "@babel/types";
59627+
// import { sheets } from "googleapis/build/src/apis/sheets";
59628+
// import { countBy, size } from "lodash-es";
5962659629
var Shifted = "_shifted";
5962759630

5962859631
function sleep(ms) {
@@ -62053,8 +62056,7 @@ function () {
6205362056
var r = [];
6205462057
(0, _lodashEs.each)(ser, function (v) {
6205562058
for (var i = 0; i < v.length; i++) {
62056-
var val = ResponseParser._convertValues(v[i].v, columns[i].type);
62057-
62059+
var val = v[i].v ? ResponseParser._convertValues(v[i].v, columns[i].type) : "";
6205862060
r.push(val);
6205962061
}
6206062062
});

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.

dist/plugin.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"metrics": true,
66
"tables": true,
77
"annotations": true,
8-
"alerting": false,
8+
"alerting": true,
9+
"backend": true,
10+
"executable": "doitintl-bigquery-datasource",
911

1012
"queryOptions": {
1113
"maxDataPoints": true
@@ -26,7 +28,7 @@
2628
{"name": "GitHub", "url": "https://github.com/doitintl/bigquery-grafana"},
2729
{"name": "MIT License", "url": "https://github.com/doitintl/bigquery-grafana/blob/master/LICENSE.md"}
2830
],
29-
"version": "1.0.8"
31+
"version": "2.0.0"
3032
},
3133
"routes": [
3234
{

go.mod

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//module github.com/repo/module
2+
module github.com/grafana/simple-datasource-backend
3+
4+
go 1.14
5+
6+
require (
7+
cloud.google.com/go v0.58.0 // indirect
8+
cloud.google.com/go/bigquery v1.8.0
9+
github.com/bitly/go-simplejson v0.5.0
10+
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
11+
github.com/go-delve/delve v1.4.1 // indirect
12+
github.com/googleapis/gax-go v1.0.3 // indirect
13+
github.com/grafana/grafana-plugin-model v0.0.0-20190930120109-1fc953a61fb4
14+
github.com/grafana/grafana-plugin-sdk-go v0.67.0
15+
github.com/hashicorp/go-hclog v0.9.2
16+
github.com/hashicorp/go-plugin v1.2.2
17+
github.com/kr/pretty v0.1.0 // indirect
18+
golang.org/x/net v0.0.0-20200602114024-627f9648deb9
19+
golang.org/x/sys v0.0.0-20200610111108-226ff32320da // indirect
20+
golang.org/x/tools v0.0.0-20200612220849-54c614fe050c // indirect
21+
//golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e
22+
google.golang.org/api v0.26.0
23+
google.golang.org/genproto v0.0.0-20200612171551-7676ae05be11 // indirect
24+
)

0 commit comments

Comments
 (0)