Prometheus schematization (#63878)

* Schematize prometheus

* revert changes

* close response body

* Update report.json

* Update pkg/tsdb/prometheus/models/query.go

Co-authored-by: sam boyer <sdboyer@grafana.com>

* Use without pointers

* remove unused

* Specify query format

* Rename

* Clean up schema

* Update public/app/plugins/datasource/prometheus/dataquery.cue

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>

* Update pkg/tsdb/prometheus/models/query.go

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>

* Clean up tests

* Update public/app/plugins/datasource/prometheus/dataquery.cue

Co-authored-by: sam boyer <sdboyer@grafana.com>

* make gen-cue

* Add comments

* Make linter happy

* Remove editormode override

* Update

---------

Co-authored-by: sam boyer <sdboyer@grafana.com>
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
ismail simsek
2023-03-09 11:26:15 +01:00
committed by GitHub
parent 473013e3f5
commit 68b588b912
14 changed files with 361 additions and 81 deletions
@@ -15,6 +15,8 @@ import (
"time"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana/pkg/kindsys"
"github.com/grafana/grafana/pkg/tsdb/prometheus/kinds/dataquery"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/tsdb/prometheus/models"
@@ -121,8 +123,10 @@ 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{
RangeQuery: true,
Expr: "test",
PrometheusDataQuery: dataquery.PrometheusDataQuery{
Range: kindsys.Ptr(true),
Expr: "test",
},
}
data, err := json.Marshal(&qm)