Commit 556219b1 by Mario Trangoni

pkg/tsdb: fix ineffassign isues

parent 6b585493
......@@ -271,7 +271,7 @@ func parseQuery(model *simplejson.Json) (*CloudWatchQuery, error) {
}
}
period := 300
var period int
if regexp.MustCompile(`^\d+$`).Match([]byte(p)) {
period, err = strconv.Atoi(p)
if err != nil {
......
......@@ -40,6 +40,9 @@ func (qp *InfluxdbQueryParser) Parse(model *simplejson.Json, dsInfo *models.Data
}
parsedInterval, err := tsdb.GetIntervalFrom(dsInfo, model, time.Millisecond*1)
if err != nil {
return nil, err
}
return &Query{
Measurement: measurement,
......
......@@ -62,9 +62,8 @@ func (query *Query) renderTags() []string {
}
}
textValue := ""
// quote value unless regex or number
var textValue string
if tag.Operator == "=~" || tag.Operator == "!~" {
textValue = tag.Value
} else if tag.Operator == "<" || tag.Operator == ">" {
......@@ -107,7 +106,7 @@ func (query *Query) renderSelectors(queryContext *tsdb.TsdbQuery) string {
}
func (query *Query) renderMeasurement() string {
policy := ""
var policy string
if query.Policy == "" || query.Policy == "default" {
policy = ""
} else {
......
......@@ -83,6 +83,10 @@ func (e *OpenTsdbExecutor) createRequest(dsInfo *models.DataSource, data OpenTsd
u.Path = path.Join(u.Path, "api/query")
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)))
if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment