mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
(format) run go fmt in pkg
This commit is contained in:
@@ -3,9 +3,9 @@ package opentsdb
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
"github.com/grafana/grafana/pkg/tsdb"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
)
|
||||
|
||||
func TestOpenTsdbExecutor(t *testing.T) {
|
||||
@@ -23,8 +23,8 @@ func TestOpenTsdbExecutor(t *testing.T) {
|
||||
query.Model.Set("aggregator", "avg")
|
||||
query.Model.Set("disableDownsampling", false)
|
||||
query.Model.Set("downsampleInterval", "")
|
||||
query.Model.Set("downsampleAggregator","avg")
|
||||
query.Model.Set("downsampleFillPolicy","none")
|
||||
query.Model.Set("downsampleAggregator", "avg")
|
||||
query.Model.Set("downsampleFillPolicy", "none")
|
||||
|
||||
metric := exec.buildMetric(query)
|
||||
|
||||
@@ -45,15 +45,15 @@ func TestOpenTsdbExecutor(t *testing.T) {
|
||||
query.Model.Set("aggregator", "avg")
|
||||
query.Model.Set("disableDownsampling", true)
|
||||
query.Model.Set("downsampleInterval", "")
|
||||
query.Model.Set("downsampleAggregator","avg")
|
||||
query.Model.Set("downsampleFillPolicy","none")
|
||||
query.Model.Set("downsampleAggregator", "avg")
|
||||
query.Model.Set("downsampleFillPolicy", "none")
|
||||
|
||||
metric := exec.buildMetric(query)
|
||||
|
||||
So(len(metric), ShouldEqual, 2)
|
||||
So(metric["metric"], ShouldEqual, "cpu.average.percent")
|
||||
So(metric["aggregator"], ShouldEqual, "avg")
|
||||
|
||||
|
||||
})
|
||||
|
||||
Convey("Build metric with downsampling enabled with params", func() {
|
||||
@@ -66,8 +66,8 @@ func TestOpenTsdbExecutor(t *testing.T) {
|
||||
query.Model.Set("aggregator", "avg")
|
||||
query.Model.Set("disableDownsampling", false)
|
||||
query.Model.Set("downsampleInterval", "5m")
|
||||
query.Model.Set("downsampleAggregator","sum")
|
||||
query.Model.Set("downsampleFillPolicy","null")
|
||||
query.Model.Set("downsampleAggregator", "sum")
|
||||
query.Model.Set("downsampleFillPolicy", "null")
|
||||
|
||||
metric := exec.buildMetric(query)
|
||||
|
||||
@@ -87,8 +87,8 @@ func TestOpenTsdbExecutor(t *testing.T) {
|
||||
query.Model.Set("aggregator", "avg")
|
||||
query.Model.Set("disableDownsampling", true)
|
||||
query.Model.Set("downsampleInterval", "5m")
|
||||
query.Model.Set("downsampleAggregator","sum")
|
||||
query.Model.Set("downsampleFillPolicy","null")
|
||||
query.Model.Set("downsampleAggregator", "sum")
|
||||
query.Model.Set("downsampleFillPolicy", "null")
|
||||
|
||||
tags := simplejson.New()
|
||||
tags.Set("env", "prod")
|
||||
@@ -117,8 +117,8 @@ func TestOpenTsdbExecutor(t *testing.T) {
|
||||
query.Model.Set("aggregator", "avg")
|
||||
query.Model.Set("disableDownsampling", true)
|
||||
query.Model.Set("shouldComputeRate", true)
|
||||
query.Model.Set("isCounter",false)
|
||||
|
||||
query.Model.Set("isCounter", false)
|
||||
|
||||
tags := simplejson.New()
|
||||
tags.Set("env", "prod")
|
||||
tags.Set("app", "grafana")
|
||||
@@ -147,9 +147,9 @@ func TestOpenTsdbExecutor(t *testing.T) {
|
||||
query.Model.Set("aggregator", "avg")
|
||||
query.Model.Set("disableDownsampling", true)
|
||||
query.Model.Set("shouldComputeRate", true)
|
||||
query.Model.Set("isCounter",true)
|
||||
query.Model.Set("counterMax",45)
|
||||
query.Model.Set("counterResetValue",60)
|
||||
query.Model.Set("isCounter", true)
|
||||
query.Model.Set("counterMax", 45)
|
||||
query.Model.Set("counterResetValue", 60)
|
||||
|
||||
tags := simplejson.New()
|
||||
tags.Set("env", "prod")
|
||||
@@ -173,4 +173,4 @@ func TestOpenTsdbExecutor(t *testing.T) {
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package opentsdb
|
||||
|
||||
type OpenTsdbQuery struct {
|
||||
Start int64 `json:"start"`
|
||||
End int64 `json:"end"`
|
||||
Queries []map[string]interface{} `json:"queries"`
|
||||
Start int64 `json:"start"`
|
||||
End int64 `json:"end"`
|
||||
Queries []map[string]interface{} `json:"queries"`
|
||||
}
|
||||
|
||||
type OpenTsdbResponse struct {
|
||||
Metric string `json:"metric"`
|
||||
DataPoints map[string]float64 `json:"dps"`
|
||||
}
|
||||
Metric string `json:"metric"`
|
||||
DataPoints map[string]float64 `json:"dps"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user