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
8cef4cc7
Commit
8cef4cc7
authored
Dec 21, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(influxdb): handles time(auto) like time($interval)
closes #6997
parent
497a1fce
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
pkg/tsdb/influxdb/query_part.go
+1
-1
pkg/tsdb/influxdb/query_part_test.go
+9
-1
No files found.
pkg/tsdb/influxdb/query_part.go
View file @
8cef4cc7
...
@@ -111,7 +111,7 @@ func getDefinedInterval(query *Query, queryContext *tsdb.QueryContext) string {
...
@@ -111,7 +111,7 @@ func getDefinedInterval(query *Query, queryContext *tsdb.QueryContext) string {
func
functionRenderer
(
query
*
Query
,
queryContext
*
tsdb
.
QueryContext
,
part
*
QueryPart
,
innerExpr
string
)
string
{
func
functionRenderer
(
query
*
Query
,
queryContext
*
tsdb
.
QueryContext
,
part
*
QueryPart
,
innerExpr
string
)
string
{
for
i
,
param
:=
range
part
.
Params
{
for
i
,
param
:=
range
part
.
Params
{
if
param
==
"$interval"
{
if
param
==
"$interval"
||
param
==
"auto"
{
if
query
.
Interval
!=
""
{
if
query
.
Interval
!=
""
{
part
.
Params
[
i
]
=
getDefinedInterval
(
query
,
queryContext
)
part
.
Params
[
i
]
=
getDefinedInterval
(
query
,
queryContext
)
}
else
{
}
else
{
...
...
pkg/tsdb/influxdb/query_part_test.go
View file @
8cef4cc7
...
@@ -37,7 +37,7 @@ func TestInfluxdbQueryPart(t *testing.T) {
...
@@ -37,7 +37,7 @@ func TestInfluxdbQueryPart(t *testing.T) {
So
(
res
,
ShouldEqual
,
"bottom(value, 3)"
)
So
(
res
,
ShouldEqual
,
"bottom(value, 3)"
)
})
})
Convey
(
"render time"
,
func
()
{
Convey
(
"render time
with $interval
"
,
func
()
{
part
,
err
:=
NewQueryPart
(
"time"
,
[]
string
{
"$interval"
})
part
,
err
:=
NewQueryPart
(
"time"
,
[]
string
{
"$interval"
})
So
(
err
,
ShouldBeNil
)
So
(
err
,
ShouldBeNil
)
...
@@ -45,6 +45,14 @@ func TestInfluxdbQueryPart(t *testing.T) {
...
@@ -45,6 +45,14 @@ func TestInfluxdbQueryPart(t *testing.T) {
So
(
res
,
ShouldEqual
,
"time(200ms)"
)
So
(
res
,
ShouldEqual
,
"time(200ms)"
)
})
})
Convey
(
"render time with auto"
,
func
()
{
part
,
err
:=
NewQueryPart
(
"time"
,
[]
string
{
"auto"
})
So
(
err
,
ShouldBeNil
)
res
:=
part
.
Render
(
query
,
queryContext
,
""
)
So
(
res
,
ShouldEqual
,
"time(200ms)"
)
})
Convey
(
"render time interval >10s"
,
func
()
{
Convey
(
"render time interval >10s"
,
func
()
{
part
,
err
:=
NewQueryPart
(
"time"
,
[]
string
{
"$interval"
})
part
,
err
:=
NewQueryPart
(
"time"
,
[]
string
{
"$interval"
})
So
(
err
,
ShouldBeNil
)
So
(
err
,
ShouldBeNil
)
...
...
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