Prometheus: remove cue definition (#83808)
Co-authored-by: ismail simsek <ismailsimsek09@gmail.com>
This commit is contained in:
co-authored by
ismail simsek
parent
2e8c514cfd
commit
5aa965b9e9
@@ -15,11 +15,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
"github.com/grafana/kindsys"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/grafana/grafana/pkg/tsdb/prometheus/kinds/dataquery"
|
||||
|
||||
"github.com/grafana/grafana/pkg/tsdb/prometheus/models"
|
||||
)
|
||||
|
||||
@@ -127,8 +124,8 @@ func createJsonTestData(start int64, step int64, timestampCount int, seriesCount
|
||||
bytes := []byte(fmt.Sprintf(`{"status":"success","data":{"resultType":"matrix","result":[%v]}}`, strings.Join(allSeries, ",")))
|
||||
|
||||
qm := models.QueryModel{
|
||||
PrometheusDataQuery: dataquery.PrometheusDataQuery{
|
||||
Range: kindsys.Ptr(true),
|
||||
PrometheusQueryProperties: models.PrometheusQueryProperties{
|
||||
Range: true,
|
||||
Expr: "test",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@ import (
|
||||
"github.com/grafana/grafana-plugin-sdk-go/experimental"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/grafana/grafana/pkg/tsdb/prometheus/kinds/dataquery"
|
||||
|
||||
"github.com/grafana/grafana/pkg/tsdb/prometheus/models"
|
||||
)
|
||||
|
||||
@@ -109,14 +107,16 @@ func loadStoredQuery(fileName string) (*backend.QueryDataRequest, error) {
|
||||
}
|
||||
|
||||
qm := models.QueryModel{
|
||||
PrometheusDataQuery: dataquery.PrometheusDataQuery{
|
||||
Range: &sq.RangeQuery,
|
||||
Exemplar: &sq.ExemplarQuery,
|
||||
Expr: sq.Expr,
|
||||
PrometheusQueryProperties: models.PrometheusQueryProperties{
|
||||
Range: sq.RangeQuery,
|
||||
Exemplar: sq.ExemplarQuery,
|
||||
Expr: sq.Expr,
|
||||
LegendFormat: sq.LegendFormat,
|
||||
},
|
||||
Interval: fmt.Sprintf("%ds", sq.Step),
|
||||
IntervalMs: sq.Step * 1000,
|
||||
LegendFormat: sq.LegendFormat,
|
||||
CommonQueryProperties: models.CommonQueryProperties{
|
||||
IntervalMs: sq.Step * 1000,
|
||||
},
|
||||
Interval: fmt.Sprintf("%ds", sq.Step),
|
||||
}
|
||||
|
||||
data, err := json.Marshal(&qm)
|
||||
|
||||
@@ -15,10 +15,6 @@ import (
|
||||
p "github.com/prometheus/common/model"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/grafana/grafana/pkg/tsdb/prometheus/kinds/dataquery"
|
||||
|
||||
"github.com/grafana/kindsys"
|
||||
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend/httpclient"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
|
||||
@@ -68,10 +64,10 @@ func TestPrometheus_parseTimeSeriesResponse(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
qm := models.QueryModel{
|
||||
LegendFormat: "legend {{app}}",
|
||||
UtcOffsetSec: 0,
|
||||
PrometheusDataQuery: dataquery.PrometheusDataQuery{
|
||||
Exemplar: kindsys.Ptr(true),
|
||||
PrometheusQueryProperties: models.PrometheusQueryProperties{
|
||||
LegendFormat: "legend {{app}}",
|
||||
Exemplar: true,
|
||||
},
|
||||
}
|
||||
b, err := json.Marshal(&qm)
|
||||
@@ -115,10 +111,10 @@ func TestPrometheus_parseTimeSeriesResponse(t *testing.T) {
|
||||
}
|
||||
|
||||
qm := models.QueryModel{
|
||||
LegendFormat: "legend {{app}}",
|
||||
UtcOffsetSec: 0,
|
||||
PrometheusDataQuery: dataquery.PrometheusDataQuery{
|
||||
Range: kindsys.Ptr(true),
|
||||
PrometheusQueryProperties: models.PrometheusQueryProperties{
|
||||
Range: true,
|
||||
LegendFormat: "legend {{app}}",
|
||||
},
|
||||
}
|
||||
b, err := json.Marshal(&qm)
|
||||
@@ -164,10 +160,10 @@ func TestPrometheus_parseTimeSeriesResponse(t *testing.T) {
|
||||
}
|
||||
|
||||
qm := models.QueryModel{
|
||||
LegendFormat: "",
|
||||
UtcOffsetSec: 0,
|
||||
PrometheusDataQuery: dataquery.PrometheusDataQuery{
|
||||
Range: kindsys.Ptr(true),
|
||||
PrometheusQueryProperties: models.PrometheusQueryProperties{
|
||||
Range: true,
|
||||
LegendFormat: "",
|
||||
},
|
||||
}
|
||||
b, err := json.Marshal(&qm)
|
||||
@@ -209,10 +205,10 @@ func TestPrometheus_parseTimeSeriesResponse(t *testing.T) {
|
||||
}
|
||||
|
||||
qm := models.QueryModel{
|
||||
LegendFormat: "",
|
||||
UtcOffsetSec: 0,
|
||||
PrometheusDataQuery: dataquery.PrometheusDataQuery{
|
||||
Range: kindsys.Ptr(true),
|
||||
PrometheusQueryProperties: models.PrometheusQueryProperties{
|
||||
Range: true,
|
||||
LegendFormat: "",
|
||||
},
|
||||
}
|
||||
b, err := json.Marshal(&qm)
|
||||
@@ -252,10 +248,10 @@ func TestPrometheus_parseTimeSeriesResponse(t *testing.T) {
|
||||
}
|
||||
|
||||
qm := models.QueryModel{
|
||||
LegendFormat: "",
|
||||
UtcOffsetSec: 0,
|
||||
PrometheusDataQuery: dataquery.PrometheusDataQuery{
|
||||
Range: kindsys.Ptr(true),
|
||||
PrometheusQueryProperties: models.PrometheusQueryProperties{
|
||||
Range: true,
|
||||
LegendFormat: "",
|
||||
},
|
||||
}
|
||||
b, err := json.Marshal(&qm)
|
||||
@@ -289,10 +285,10 @@ func TestPrometheus_parseTimeSeriesResponse(t *testing.T) {
|
||||
},
|
||||
}
|
||||
qm := models.QueryModel{
|
||||
LegendFormat: "legend {{app}}",
|
||||
UtcOffsetSec: 0,
|
||||
PrometheusDataQuery: dataquery.PrometheusDataQuery{
|
||||
Instant: kindsys.Ptr(true),
|
||||
PrometheusQueryProperties: models.PrometheusQueryProperties{
|
||||
Instant: true,
|
||||
LegendFormat: "legend {{app}}",
|
||||
},
|
||||
}
|
||||
b, err := json.Marshal(&qm)
|
||||
@@ -330,10 +326,10 @@ func TestPrometheus_parseTimeSeriesResponse(t *testing.T) {
|
||||
},
|
||||
}
|
||||
qm := models.QueryModel{
|
||||
LegendFormat: "",
|
||||
UtcOffsetSec: 0,
|
||||
PrometheusDataQuery: dataquery.PrometheusDataQuery{
|
||||
Instant: kindsys.Ptr(true),
|
||||
PrometheusQueryProperties: models.PrometheusQueryProperties{
|
||||
Instant: true,
|
||||
LegendFormat: "",
|
||||
},
|
||||
}
|
||||
b, err := json.Marshal(&qm)
|
||||
|
||||
Reference in New Issue
Block a user