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

Commit 58e6190

Browse files
authored
Merge pull request #311 from doitintl/feature/lior/mixpanel
Remove mixpanel, adding logs and some bugs
2 parents 4977056 + b2000e9 commit 58e6190

15 files changed

+83
-129
lines changed

CONTRIBUTING.md

Lines changed: 0 additions & 48 deletions
This file was deleted.

dist/MANIFEST.txt

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,44 @@ Hash: SHA512
99
"signedByOrgName": "DoiT International",
1010
"plugin": "doitintl-bigquery-datasource",
1111
"version": "2.0.1",
12-
"time": 1610017627530,
12+
"time": 1612960215632,
1313
"keyId": "7e4d0c6a708866e7",
1414
"files": {
1515
"LICENSE.md": "b40d79313086aafb7ab31bf033798850a20ff52daf52f9dba84f6ef169e326b2",
1616
".DS_Store": "d65165279105ca6773180500688df4bdc69a2c7b771752f0a46ef120b7fd8ec3",
17-
"doitintl-bigquery-datasource_darwin_amd64": "89d3c1769d56208894555aaeb428d4d81d227d134d521cebdf1a3ea36333f93c",
18-
"module.js.map": "c674267fa0d98e3295e8dbc225cc1f4fc563f6e59bb782088ce200219e04e27d",
17+
"doitintl-bigquery-datasource_darwin_amd64": "a1acd822aa3f859973bb4e688fa51e759f6bed2147c0665decf225429533af29",
18+
"module.js.map": "d3b797c41a13caf60b8d040592188a18d27ae7c51344d3075ee0ca9f135b65ef",
1919
"doitintl-bigquery-datasource_windows_amd64.exe": "bfaa4dd2fc271e68ece7458f7dda4eb01ed5965e23a1c9052aa925b9aa61a9b9",
20-
"plugin.json": "a1d813d29f55c189cd99b332db7361e17ee80982028b78f67ce917fb57a7ffb2",
20+
"plugin.json": "d91e99fc7614b5edaf1bc12a05422de0145782b8f31d7ddc14079f3d084e72a3",
2121
"README.md": "73f37f56e09728a0c2296279407d3735b2141bdcfd4d491cb8a03b220283d5f5",
22+
"img/QueryOptions.png": "6c9f60af993db810186741a0e6e5b935ef739f0d66fedbbc65bfab8d4df9a65f",
23+
"img/bigquery_enable_api.png": "ae19176c07db844d4561afb8c434f4804d7ac667fd64d4a8746cb164b51a7c6e",
24+
"img/InspectPanel.png": "c43a8830ed29aa97d035908cb357345452b0689fb74315c03a414f846c7c1985",
25+
"img/QueryPrioriy.png": "52ff6925a495060390de8141b9d2e1fcead526985cff565afbaad8694daaa733",
26+
"img/createserviceaccountbutton.png": "d82b2c37d3f638a043ffbc147ec85a23930a27451f2f2def0d7da620ca2aff51",
27+
"img/grafana-bigquery-demo.gif": "b82c598827c603cadfa4a56bbdc04bc62de03c57e970da32ac43fb52391dadc6",
2228
"img/logo.png": "dcd9277d3dfc4e412dc006a000d0ee5b9ff4d9f126687a01f189cea9987e2bfa",
23-
"module.js": "ba4bb31df5beb210d312a7bcd03a345c86e727933319cc9156ba73b7a603a0c2",
29+
"img/newserviceaccount.png": "3ac6ceafd68d489998d858eceb2cd16cef9dac008fb1b828df0230de71ba90ca",
30+
"img/bq__grafana_upload_key.png": "969e15250e81c781187a9c71bfac5fa463790122a8a470b2c993d0ed6dc9022e",
31+
"img/bq_grafana_key_uploaded.png": "bc56ee6155fbac29889cbb036fc31b5fe6d5ef366138491de66d6b1393d3d21c",
32+
"img/bq_service_account_choose_role.png": "b36e3a5adcea14e9d342b7b772a0d209fb1ffa117c9be755b1b0335752a3ee7b",
33+
"img/QueryBuilder.png": "dc0f6a0418b4eb6c7c3136f31df26f1af910d9d57aba889bff98f8711dbc162b",
34+
"img/QueryInspector.png": "9a6d16cee486966604cf1ba626b2c6b6ae4d032d2effe6864c01e9a5cc59ccdc",
35+
"module.js": "de9c302ab2ccbb71b0cae388de305b739fca4be19f4c26b112a0ebdcc6ec6f9a",
2436
"partials/annotations.editor.html": "c8b36fe73e7c3b13df4db94153ebd820a9bec4104c1b179db92d64dcdcf04156",
2537
"partials/query.editor.html": "b1bd544d357e006339cf14ea27802692f9e33341e385cd74fb2dcf653ab8fb1d",
26-
"partials/config.html": "31cadbac85238e8a0cb8e4766fc20329cda9d918b4140e6130626cb3631dbe8d",
38+
"partials/config.html": "962bd793de8089f3243df3703bea211757c6b89728ce3722ddbcf08388e1bdb3",
39+
"MANIFEST11.txt": "9f881831ddf59c9eff19ec564bc49d8d095162013e6071e6730116ee96df2d35",
2740
"doitintl-bigquery-datasource_linux_amd64": "be64c3ed2eff027a886d9c8b5a8c75ca4aa883c093baf15943a3df46eca20956"
2841
}
2942
}
3043
-----BEGIN PGP SIGNATURE-----
3144
Version: OpenPGP.js v4.10.1
3245
Comment: https://openpgpjs.org
3346

34-
wqEEARMKAAYFAl/261sACgkQfk0ManCIZucQwAII42ki8JPco/uXnrN7TGe3
35-
5a144L2+qIbG/wCIatxSCO2E+l7qNnBjJgQJsGf3Ity53lYJaqPtPIOUgyH0
36-
Rah7wVICCQEhbIh2dpebV8N28Q4Ki3aP/r1AOPoBT3fpj2a8RF1NsHIXV6bA
37-
zUiOzScw4yJxuCHUZUqnnq1uX0wJoGUXx5Gd8A==
38-
=OlQG
47+
wqEEARMKAAYFAmAj0dcACgkQfk0ManCIZucnqQIJAcTvM87QfJzH1qnI9CBK
48+
7HC7alFPW1HGJN1XZWYTe1ckubNkAD2i6FCq4oms+eqP4rwScNt+aJqWyKs1
49+
uf7rCO7uAgjQYkSaOJchSm03uZdI2uMI5VagtZcEe2xww9A8hvgWbN9Bg7RO
50+
HpN504Z9ZJxHnz49i8hT3CgvMMMErsUE3qvwtQ==
51+
=QStB
3952
-----END PGP SIGNATURE-----
8.14 KB
Binary file not shown.

dist/module.js

Lines changed: 32 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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/partials/config.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,6 @@ <h6>Uploaded Key Details</h6>
125125
ng-change="ctrl.refresh()"></select>
126126
</div>
127127
</div>
128-
<gf-form-switch class="gf-form" label="Send anonymous usage data" label-class="width-13" checked="ctrl.current.jsonData.sendUsageData" switch-class="max-width-6"></gf-form-switch>
129-
<!-- <label class="gf-form-label query-keyword pointer">
130-
</label> -->
131-
132-
133128

134129
<p class="gf-form-label" ng-show="ctrl.current.jsonData.authenticationType !== ctrl.defaultAuthenticationType"><i class="fa fa-save"></i>
135130
Verify GCE default service account by clicking Save & Test</p>

dist/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
{ "name": "MIT License", "url": "https://github.com/doitintl/bigquery-grafana/blob/master/LICENSE.md" }
3232
],
3333
"updated": "2020-12-16",
34-
"screenshots": [{"name": "Query builder", "path":"https://raw.githubusercontent.com/doitintl/bigquery-grafana/master/img/QueryBuilder.png"}],
34+
"screenshots": [{"name": "Query builder", "path":"img/QueryBuilder.png"}],
3535
"version": "2.0.1"
3636
},
3737
"routes": [
-25.3 MB
Binary file not shown.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"testg": "grafana-toolkit plugin:test",
1414
"dev": "grafana-toolkit plugin:dev",
1515
"watch": "grafana-toolkit plugin:dev --watch",
16-
"sign": "grafana-toolkit plugin:sign"
16+
"sign": "grafana-toolkit plugin:sign",
17+
"build:sign" : "yarn run build:prod && yarn run sign"
1718
},
1819
"author": "DoiT International",
1920
"license": "MIT",

pkg/plugin.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"context"
55
"encoding/json"
6+
"errors"
67
"fmt"
78
"net/http"
89
"time"
@@ -24,7 +25,7 @@ type queryResult struct {
2425
// Transformed BigQuery results for Grafana
2526
type TransformedResults struct {
2627
Time []time.Time
27-
Values []int64
28+
Values []int64 //string //
2829
}
2930
type queryModel struct {
3031
Format string `json:"format"`
@@ -36,7 +37,7 @@ type queryModel struct {
3637
OrderBySort string/*int32*/ `json:"orderBySort"`
3738
Partitioned bool `json:"partitioned"`
3839
PartitionedField string `json:"partitionedField"`
39-
Project string `json:"project"`
40+
ProjectID string `json:"project"`
4041
RawQuery bool `json:"rawQuery"`
4142
RawSQL string `json:"rawSql"`
4243
RefID string `json:"refId"`
@@ -166,11 +167,14 @@ func (s *instanceSettings) Dispose() {
166167
// to cleanup.
167168
}
168169

169-
// BigQueryRun: Run the query againt BigQuery
170+
// BigQueryRun ... Run the query against BigQuery
170171
func BigQueryRun(ctx context.Context, query queryModel) (*TransformedResults, error) {
171-
projectID := query.Project
172+
projectID := query.ProjectID
172173
var tr TransformedResults
173-
174+
log.DefaultLogger.Info("projectID: " + projectID)
175+
if projectID == "" {
176+
return nil, errors.New("No projectID")
177+
}
174178
client, err := bigquery.NewClient(ctx, projectID)
175179
if err != nil {
176180
return nil, fmt.Errorf("bigquery.NewClient: %v", err)
@@ -181,10 +185,10 @@ func BigQueryRun(ctx context.Context, query queryModel) (*TransformedResults, er
181185
// Location must match that of the dataset(s) referenced in the query.
182186
q.Location = query.Location
183187
// Run the query and print results when the query job is completed.
188+
log.DefaultLogger.Info("The query to run: " + query.RawSQL)
184189
job, err := q.Run(ctx)
185-
186190
if err != nil {
187-
log.DefaultLogger.Info("Query run error", "Error", err)
191+
log.DefaultLogger.Error("Query run error: ", "Error", err)
188192
return nil, err
189193
}
190194
status, err := job.Wait(ctx)
@@ -193,7 +197,7 @@ func BigQueryRun(ctx context.Context, query queryModel) (*TransformedResults, er
193197
return nil, err
194198
}
195199
if err := status.Err(); err != nil {
196-
log.DefaultLogger.Info("Query status error", "Error", err)
200+
log.DefaultLogger.Info("Query status error: ", "Error", err)
197201
return nil, err
198202
}
199203
it, err := job.Read(ctx)

0 commit comments

Comments
 (0)