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
46e4a54a
Commit
46e4a54a
authored
Jan 27, 2017
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style: go fmt with simplify
parent
1df9c2ca
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
27 deletions
+26
-27
pkg/services/alerting/eval_handler_test.go
+1
-1
pkg/services/alerting/notifiers/line.go
+7
-7
pkg/services/alerting/notifiers/line_test.go
+0
-1
pkg/services/sqlstore/alert.go
+1
-1
pkg/tsdb/influxdb/query_test.go
+7
-7
pkg/tsdb/influxdb/response_parser_test.go
+2
-2
pkg/tsdb/mqe/types_test.go
+8
-8
No files found.
pkg/services/alerting/eval_handler_test.go
View file @
46e4a54a
...
...
@@ -39,7 +39,7 @@ func TestAlertingEvaluationHandler(t *testing.T) {
Convey
(
"Show return false with not passing asdf"
,
func
()
{
context
:=
NewEvalContext
(
context
.
TODO
(),
&
Rule
{
Conditions
:
[]
Condition
{
&
conditionStub
{
firing
:
true
,
operator
:
"and"
,
matches
:
[]
*
EvalMatch
{
&
EvalMatch
{},
&
EvalMatch
{}}},
&
conditionStub
{
firing
:
true
,
operator
:
"and"
,
matches
:
[]
*
EvalMatch
{
{},
{}}},
&
conditionStub
{
firing
:
false
,
operator
:
"and"
},
},
})
...
...
pkg/services/alerting/notifiers/line.go
View file @
46e4a54a
package
notifiers
import
(
"fmt"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/services/alerting"
m
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/metrics"
m
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/alerting"
"net/url"
"fmt"
"github.com/grafana/grafana/pkg/bus"
)
func
init
()
{
alerting
.
RegisterNotifier
(
&
alerting
.
NotifierPlugin
{
Type
:
"LINE"
,
Name
:
"LINE"
,
Type
:
"LINE"
,
Name
:
"LINE"
,
Description
:
"Send notifications to LINE notify"
,
Factory
:
NewLINENotifier
,
Factory
:
NewLINENotifier
,
OptionsTemplate
:
`
<div class="gf-form-group">
<h3 class="page-heading">LINE notify settings</h3>
...
...
pkg/services/alerting/notifiers/line_test.go
View file @
46e4a54a
package
notifiers
import
(
...
...
pkg/services/sqlstore/alert.go
View file @
46e4a54a
...
...
@@ -113,7 +113,7 @@ func HandleAlertsQuery(query *m.GetAlertsQuery) error {
return
err
}
for
i
,
_
:=
range
alerts
{
for
i
:=
range
alerts
{
if
alerts
[
i
]
.
ExecutionError
==
" "
{
alerts
[
i
]
.
ExecutionError
=
""
}
...
...
pkg/tsdb/influxdb/query_test.go
View file @
46e4a54a
...
...
@@ -128,43 +128,43 @@ func TestInfluxdbQueryBuilder(t *testing.T) {
})
Convey
(
"can render normal tags without operator"
,
func
()
{
query
:=
&
Query
{
Tags
:
[]
*
Tag
{
&
Tag
{
Operator
:
""
,
Value
:
`value`
,
Key
:
"key"
}}}
query
:=
&
Query
{
Tags
:
[]
*
Tag
{{
Operator
:
""
,
Value
:
`value`
,
Key
:
"key"
}}}
So
(
strings
.
Join
(
query
.
renderTags
(),
""
),
ShouldEqual
,
`"key" = 'value'`
)
})
Convey
(
"can render regex tags without operator"
,
func
()
{
query
:=
&
Query
{
Tags
:
[]
*
Tag
{
&
Tag
{
Operator
:
""
,
Value
:
`/value/`
,
Key
:
"key"
}}}
query
:=
&
Query
{
Tags
:
[]
*
Tag
{{
Operator
:
""
,
Value
:
`/value/`
,
Key
:
"key"
}}}
So
(
strings
.
Join
(
query
.
renderTags
(),
""
),
ShouldEqual
,
`"key" =~ /value/`
)
})
Convey
(
"can render regex tags"
,
func
()
{
query
:=
&
Query
{
Tags
:
[]
*
Tag
{
&
Tag
{
Operator
:
"=~"
,
Value
:
`/value/`
,
Key
:
"key"
}}}
query
:=
&
Query
{
Tags
:
[]
*
Tag
{{
Operator
:
"=~"
,
Value
:
`/value/`
,
Key
:
"key"
}}}
So
(
strings
.
Join
(
query
.
renderTags
(),
""
),
ShouldEqual
,
`"key" =~ /value/`
)
})
Convey
(
"can render number tags"
,
func
()
{
query
:=
&
Query
{
Tags
:
[]
*
Tag
{
&
Tag
{
Operator
:
"="
,
Value
:
"10001"
,
Key
:
"key"
}}}
query
:=
&
Query
{
Tags
:
[]
*
Tag
{{
Operator
:
"="
,
Value
:
"10001"
,
Key
:
"key"
}}}
So
(
strings
.
Join
(
query
.
renderTags
(),
""
),
ShouldEqual
,
`"key" = '10001'`
)
})
Convey
(
"can render numbers less then condition tags"
,
func
()
{
query
:=
&
Query
{
Tags
:
[]
*
Tag
{
&
Tag
{
Operator
:
"<"
,
Value
:
"10001"
,
Key
:
"key"
}}}
query
:=
&
Query
{
Tags
:
[]
*
Tag
{{
Operator
:
"<"
,
Value
:
"10001"
,
Key
:
"key"
}}}
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"
}}}
query
:=
&
Query
{
Tags
:
[]
*
Tag
{{
Operator
:
">"
,
Value
:
"10001"
,
Key
:
"key"
}}}
So
(
strings
.
Join
(
query
.
renderTags
(),
""
),
ShouldEqual
,
`"key" > 10001`
)
})
Convey
(
"can render string tags"
,
func
()
{
query
:=
&
Query
{
Tags
:
[]
*
Tag
{
&
Tag
{
Operator
:
"="
,
Value
:
"value"
,
Key
:
"key"
}}}
query
:=
&
Query
{
Tags
:
[]
*
Tag
{{
Operator
:
"="
,
Value
:
"value"
,
Key
:
"key"
}}}
So
(
strings
.
Join
(
query
.
renderTags
(),
""
),
ShouldEqual
,
`"key" = 'value'`
)
})
...
...
pkg/tsdb/influxdb/response_parser_test.go
View file @
46e4a54a
...
...
@@ -19,7 +19,7 @@ func TestInfluxdbResponseParser(t *testing.T) {
response
:=
&
Response
{
Results
:
[]
Result
{
Result
{
{
Series
:
[]
Row
{
{
Name
:
"cpu"
,
...
...
@@ -69,7 +69,7 @@ func TestInfluxdbResponseParser(t *testing.T) {
response
:=
&
Response
{
Results
:
[]
Result
{
Result
{
{
Series
:
[]
Row
{
{
Name
:
"cpu.upc"
,
...
...
pkg/tsdb/mqe/types_test.go
View file @
46e4a54a
...
...
@@ -27,16 +27,16 @@ func TestWildcardExpansion(t *testing.T) {
Convey
(
"Without wildcard series"
,
func
()
{
query
:=
&
Query
{
Metrics
:
[]
Metric
{
Metric
{
Metric
:
"os.cpu.3.idle"
,
Alias
:
""
},
Metric
{
Metric
:
"os.cpu.2.idle"
,
Alias
:
""
},
Metric
{
Metric
:
"os.cpu.1.idle"
,
Alias
:
"cpu"
},
{
Metric
:
"os.cpu.3.idle"
,
Alias
:
""
},
{
Metric
:
"os.cpu.2.idle"
,
Alias
:
""
},
{
Metric
:
"os.cpu.1.idle"
,
Alias
:
"cpu"
},
},
Hosts
:
[]
string
{
"staples-lab-1"
,
"staples-lab-2"
},
Cluster
:
[]
string
{
"demoapp-1"
,
"demoapp-2"
},
AddClusterToAlias
:
false
,
AddHostToAlias
:
false
,
FunctionList
:
[]
Function
{
Function
{
Func
:
"aggregate.min"
},
{
Func
:
"aggregate.min"
},
},
TimeRange
:
&
tsdb
.
TimeRange
{
Now
:
now
,
From
:
"5m"
,
To
:
"now"
},
}
...
...
@@ -52,15 +52,15 @@ func TestWildcardExpansion(t *testing.T) {
Convey
(
"With two aggregate functions"
,
func
()
{
query
:=
&
Query
{
Metrics
:
[]
Metric
{
Metric
{
Metric
:
"os.cpu.3.idle"
,
Alias
:
""
},
{
Metric
:
"os.cpu.3.idle"
,
Alias
:
""
},
},
Hosts
:
[]
string
{
"staples-lab-1"
,
"staples-lab-2"
},
Cluster
:
[]
string
{
"demoapp-1"
,
"demoapp-2"
},
AddClusterToAlias
:
false
,
AddHostToAlias
:
false
,
FunctionList
:
[]
Function
{
Function
{
Func
:
"aggregate.min"
},
Function
{
Func
:
"aggregate.max"
},
{
Func
:
"aggregate.min"
},
{
Func
:
"aggregate.max"
},
},
TimeRange
:
&
tsdb
.
TimeRange
{
Now
:
now
,
From
:
"5m"
,
To
:
"now"
},
}
...
...
@@ -74,7 +74,7 @@ func TestWildcardExpansion(t *testing.T) {
Convey
(
"Containg wildcard series"
,
func
()
{
query
:=
&
Query
{
Metrics
:
[]
Metric
{
Metric
{
Metric
:
"os.cpu*"
,
Alias
:
""
},
{
Metric
:
"os.cpu*"
,
Alias
:
""
},
},
Hosts
:
[]
string
{
"staples-lab-1"
},
AddClusterToAlias
:
false
,
...
...
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