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
2b81bfe9
Commit
2b81bfe9
authored
Apr 05, 2017
by
Alexander Zobnin
Committed by
Torkel Ödegaard
Apr 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
alerting: fix $timeFilter cannot be used twice (#7969) (#8037)
parent
308d46e4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
pkg/tsdb/influxdb/query.go
+9
-4
No files found.
pkg/tsdb/influxdb/query.go
View file @
2b81bfe9
...
...
@@ -34,13 +34,18 @@ func (query *Query) Build(queryContext *tsdb.QueryContext) (string, error) {
return
""
,
err
}
res
=
strings
.
Replace
(
res
,
"$timeFilter"
,
query
.
renderTimeFilter
(
queryContext
),
1
)
res
=
strings
.
Replace
(
res
,
"$interval"
,
interval
.
Text
,
1
)
res
=
strings
.
Replace
(
res
,
"$__interval_ms"
,
strconv
.
FormatInt
(
interval
.
Value
.
Nanoseconds
()
/
int64
(
time
.
Millisecond
),
10
),
1
)
res
=
strings
.
Replace
(
res
,
"$__interval"
,
interval
.
Text
,
1
)
res
=
replaceVariable
(
res
,
"$timeFilter"
,
query
.
renderTimeFilter
(
queryContext
)
)
res
=
replaceVariable
(
res
,
"$interval"
,
interval
.
Text
)
res
=
replaceVariable
(
res
,
"$__interval_ms"
,
strconv
.
FormatInt
(
interval
.
Value
.
Nanoseconds
()
/
int64
(
time
.
Millisecond
),
10
)
)
res
=
replaceVariable
(
res
,
"$__interval"
,
interval
.
Text
)
return
res
,
nil
}
func
replaceVariable
(
str
string
,
variable
string
,
value
string
)
string
{
count
:=
strings
.
Count
(
str
,
variable
)
return
strings
.
Replace
(
str
,
variable
,
value
,
count
)
}
func
getDefinedInterval
(
query
*
Query
,
queryContext
*
tsdb
.
QueryContext
)
(
*
tsdb
.
Interval
,
error
)
{
defaultInterval
:=
tsdb
.
CalculateInterval
(
queryContext
.
TimeRange
)
...
...
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