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
556219b1
Commit
556219b1
authored
Apr 22, 2018
by
Mario Trangoni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pkg/tsdb: fix ineffassign isues
parent
6b585493
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
4 deletions
+10
-4
pkg/tsdb/cloudwatch/cloudwatch.go
+1
-1
pkg/tsdb/influxdb/model_parser.go
+3
-0
pkg/tsdb/influxdb/query.go
+2
-3
pkg/tsdb/opentsdb/opentsdb.go
+4
-0
No files found.
pkg/tsdb/cloudwatch/cloudwatch.go
View file @
556219b1
...
@@ -271,7 +271,7 @@ func parseQuery(model *simplejson.Json) (*CloudWatchQuery, error) {
...
@@ -271,7 +271,7 @@ func parseQuery(model *simplejson.Json) (*CloudWatchQuery, error) {
}
}
}
}
period
:=
300
var
period
int
if
regexp
.
MustCompile
(
`^\d+$`
)
.
Match
([]
byte
(
p
))
{
if
regexp
.
MustCompile
(
`^\d+$`
)
.
Match
([]
byte
(
p
))
{
period
,
err
=
strconv
.
Atoi
(
p
)
period
,
err
=
strconv
.
Atoi
(
p
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/tsdb/influxdb/model_parser.go
View file @
556219b1
...
@@ -40,6 +40,9 @@ func (qp *InfluxdbQueryParser) Parse(model *simplejson.Json, dsInfo *models.Data
...
@@ -40,6 +40,9 @@ func (qp *InfluxdbQueryParser) Parse(model *simplejson.Json, dsInfo *models.Data
}
}
parsedInterval
,
err
:=
tsdb
.
GetIntervalFrom
(
dsInfo
,
model
,
time
.
Millisecond
*
1
)
parsedInterval
,
err
:=
tsdb
.
GetIntervalFrom
(
dsInfo
,
model
,
time
.
Millisecond
*
1
)
if
err
!=
nil
{
return
nil
,
err
}
return
&
Query
{
return
&
Query
{
Measurement
:
measurement
,
Measurement
:
measurement
,
...
...
pkg/tsdb/influxdb/query.go
View file @
556219b1
...
@@ -62,9 +62,8 @@ func (query *Query) renderTags() []string {
...
@@ -62,9 +62,8 @@ func (query *Query) renderTags() []string {
}
}
}
}
textValue
:=
""
// quote value unless regex or number
// quote value unless regex or number
var
textValue
string
if
tag
.
Operator
==
"=~"
||
tag
.
Operator
==
"!~"
{
if
tag
.
Operator
==
"=~"
||
tag
.
Operator
==
"!~"
{
textValue
=
tag
.
Value
textValue
=
tag
.
Value
}
else
if
tag
.
Operator
==
"<"
||
tag
.
Operator
==
">"
{
}
else
if
tag
.
Operator
==
"<"
||
tag
.
Operator
==
">"
{
...
@@ -107,7 +106,7 @@ func (query *Query) renderSelectors(queryContext *tsdb.TsdbQuery) string {
...
@@ -107,7 +106,7 @@ func (query *Query) renderSelectors(queryContext *tsdb.TsdbQuery) string {
}
}
func
(
query
*
Query
)
renderMeasurement
()
string
{
func
(
query
*
Query
)
renderMeasurement
()
string
{
policy
:=
""
var
policy
string
if
query
.
Policy
==
""
||
query
.
Policy
==
"default"
{
if
query
.
Policy
==
""
||
query
.
Policy
==
"default"
{
policy
=
""
policy
=
""
}
else
{
}
else
{
...
...
pkg/tsdb/opentsdb/opentsdb.go
View file @
556219b1
...
@@ -83,6 +83,10 @@ func (e *OpenTsdbExecutor) createRequest(dsInfo *models.DataSource, data OpenTsd
...
@@ -83,6 +83,10 @@ func (e *OpenTsdbExecutor) createRequest(dsInfo *models.DataSource, data OpenTsd
u
.
Path
=
path
.
Join
(
u
.
Path
,
"api/query"
)
u
.
Path
=
path
.
Join
(
u
.
Path
,
"api/query"
)
postData
,
err
:=
json
.
Marshal
(
data
)
postData
,
err
:=
json
.
Marshal
(
data
)
if
err
!=
nil
{
plog
.
Info
(
"Failed marshalling data"
,
"error"
,
err
)
return
nil
,
fmt
.
Errorf
(
"Failed to create request. error: %v"
,
err
)
}
req
,
err
:=
http
.
NewRequest
(
http
.
MethodPost
,
u
.
String
(),
strings
.
NewReader
(
string
(
postData
)))
req
,
err
:=
http
.
NewRequest
(
http
.
MethodPost
,
u
.
String
(),
strings
.
NewReader
(
string
(
postData
)))
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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