Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
a948dfe5
Commit
a948dfe5
authored
Nov 10, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(influxdb): fixes broken raw query usage
parent
9f7d0862
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
1 deletions
+5
-1
pkg/tsdb/influxdb/model_parser.go
+2
-0
pkg/tsdb/influxdb/models.go
+1
-0
pkg/tsdb/influxdb/query_builder.go
+1
-1
pkg/tsdb/influxdb/query_builder_test.go
+1
-0
No files found.
pkg/tsdb/influxdb/model_parser.go
View file @
a948dfe5
...
@@ -12,6 +12,7 @@ type InfluxdbQueryParser struct{}
...
@@ -12,6 +12,7 @@ type InfluxdbQueryParser struct{}
func
(
qp
*
InfluxdbQueryParser
)
Parse
(
model
*
simplejson
.
Json
,
dsInfo
*
tsdb
.
DataSourceInfo
)
(
*
Query
,
error
)
{
func
(
qp
*
InfluxdbQueryParser
)
Parse
(
model
*
simplejson
.
Json
,
dsInfo
*
tsdb
.
DataSourceInfo
)
(
*
Query
,
error
)
{
policy
:=
model
.
Get
(
"policy"
)
.
MustString
(
"default"
)
policy
:=
model
.
Get
(
"policy"
)
.
MustString
(
"default"
)
rawQuery
:=
model
.
Get
(
"query"
)
.
MustString
(
""
)
rawQuery
:=
model
.
Get
(
"query"
)
.
MustString
(
""
)
useRawQuery
:=
model
.
Get
(
"rawQuery"
)
.
MustBool
(
false
)
alias
:=
model
.
Get
(
"alias"
)
.
MustString
(
""
)
alias
:=
model
.
Get
(
"alias"
)
.
MustString
(
""
)
measurement
:=
model
.
Get
(
"measurement"
)
.
MustString
(
""
)
measurement
:=
model
.
Get
(
"measurement"
)
.
MustString
(
""
)
...
@@ -54,6 +55,7 @@ func (qp *InfluxdbQueryParser) Parse(model *simplejson.Json, dsInfo *tsdb.DataSo
...
@@ -54,6 +55,7 @@ func (qp *InfluxdbQueryParser) Parse(model *simplejson.Json, dsInfo *tsdb.DataSo
RawQuery
:
rawQuery
,
RawQuery
:
rawQuery
,
Interval
:
interval
,
Interval
:
interval
,
Alias
:
alias
,
Alias
:
alias
,
UseRawQuery
:
useRawQuery
,
},
nil
},
nil
}
}
...
...
pkg/tsdb/influxdb/models.go
View file @
a948dfe5
...
@@ -8,6 +8,7 @@ type Query struct {
...
@@ -8,6 +8,7 @@ type Query struct {
GroupBy
[]
*
QueryPart
GroupBy
[]
*
QueryPart
Selects
[]
*
Select
Selects
[]
*
Select
RawQuery
string
RawQuery
string
UseRawQuery
bool
Alias
string
Alias
string
Interval
string
Interval
string
...
...
pkg/tsdb/influxdb/query_builder.go
View file @
a948dfe5
...
@@ -17,7 +17,7 @@ var (
...
@@ -17,7 +17,7 @@ var (
type
QueryBuilder
struct
{}
type
QueryBuilder
struct
{}
func
(
qb
*
QueryBuilder
)
Build
(
query
*
Query
,
queryContext
*
tsdb
.
QueryContext
)
(
string
,
error
)
{
func
(
qb
*
QueryBuilder
)
Build
(
query
*
Query
,
queryContext
*
tsdb
.
QueryContext
)
(
string
,
error
)
{
if
query
.
RawQuery
!=
""
{
if
query
.
UseRawQuery
&&
query
.
RawQuery
!=
""
{
q
:=
query
.
RawQuery
q
:=
query
.
RawQuery
q
=
strings
.
Replace
(
q
,
"$timeFilter"
,
qb
.
renderTimeFilter
(
query
,
queryContext
),
1
)
q
=
strings
.
Replace
(
q
,
"$timeFilter"
,
qb
.
renderTimeFilter
(
query
,
queryContext
),
1
)
...
...
pkg/tsdb/influxdb/query_builder_test.go
View file @
a948dfe5
...
@@ -79,6 +79,7 @@ func TestInfluxdbQueryBuilder(t *testing.T) {
...
@@ -79,6 +79,7 @@ func TestInfluxdbQueryBuilder(t *testing.T) {
GroupBy
:
[]
*
QueryPart
{
groupBy1
,
groupBy3
},
GroupBy
:
[]
*
QueryPart
{
groupBy1
,
groupBy3
},
Interval
:
"10s"
,
Interval
:
"10s"
,
RawQuery
:
"Raw query"
,
RawQuery
:
"Raw query"
,
UseRawQuery
:
true
,
}
}
rawQuery
,
err
:=
builder
.
Build
(
query
,
queryContext
)
rawQuery
,
err
:=
builder
.
Build
(
query
,
queryContext
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment