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
a3b0fbca
Commit
a3b0fbca
authored
Nov 17, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(influxdb): fixes broken tag rendering for influxdb alerting
closes #6626 ref #6523
parent
7ce33c31
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
pkg/tsdb/influxdb/query.go
+2
-4
pkg/tsdb/influxdb/query_test.go
+10
-4
No files found.
pkg/tsdb/influxdb/query.go
View file @
a3b0fbca
...
...
@@ -2,7 +2,6 @@ package influxdb
import
(
"fmt"
"strconv"
"strings"
"regexp"
...
...
@@ -58,13 +57,12 @@ func (query *Query) renderTags() []string {
}
textValue
:=
""
numericValue
,
err
:=
strconv
.
ParseFloat
(
tag
.
Value
,
64
)
// quote value unless regex or number
if
tag
.
Operator
==
"=~"
||
tag
.
Operator
==
"!~"
{
textValue
=
tag
.
Value
}
else
if
err
==
nil
{
textValue
=
fmt
.
Sprintf
(
"%v"
,
numericValue
)
}
else
if
tag
.
Operator
==
"<"
||
tag
.
Operator
==
">"
{
textValue
=
tag
.
Value
}
else
{
textValue
=
fmt
.
Sprintf
(
"'%s'"
,
tag
.
Value
)
}
...
...
pkg/tsdb/influxdb/query_test.go
View file @
a3b0fbca
...
...
@@ -106,13 +106,19 @@ func TestInfluxdbQueryBuilder(t *testing.T) {
Convey
(
"can render number tags"
,
func
()
{
query
:=
&
Query
{
Tags
:
[]
*
Tag
{
&
Tag
{
Operator
:
"="
,
Value
:
"10001"
,
Key
:
"key"
}}}
So
(
strings
.
Join
(
query
.
renderTags
(),
""
),
ShouldEqual
,
`"key" =
10001
`
)
So
(
strings
.
Join
(
query
.
renderTags
(),
""
),
ShouldEqual
,
`"key" =
'10001'
`
)
})
Convey
(
"can render number
tags with decimal
s"
,
func
()
{
query
:=
&
Query
{
Tags
:
[]
*
Tag
{
&
Tag
{
Operator
:
"
="
,
Value
:
"10001.
1"
,
Key
:
"key"
}}}
Convey
(
"can render number
s less then condition tag
s"
,
func
()
{
query
:=
&
Query
{
Tags
:
[]
*
Tag
{
&
Tag
{
Operator
:
"
<"
,
Value
:
"1000
1"
,
Key
:
"key"
}}}
So
(
strings
.
Join
(
query
.
renderTags
(),
""
),
ShouldEqual
,
`"key" = 10001.1`
)
So
(
strings
.
Join
(
query
.
renderTags
(),
""
),
ShouldEqual
,
`"key" < 10001`
)
})
Convey
(
"can render number greather then condition tags"
,
func
()
{
query
:=
&
Query
{
Tags
:
[]
*
Tag
{
&
Tag
{
Operator
:
">"
,
Value
:
"10001"
,
Key
:
"key"
}}}
So
(
strings
.
Join
(
query
.
renderTags
(),
""
),
ShouldEqual
,
`"key" > 10001`
)
})
Convey
(
"can render string tags"
,
func
()
{
...
...
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