Google Cloud Monitor: Prom query editor (#73503)

* revert

* works but needs clean up and tests

* clean up

* remove any

* change confusing query var to expr

* oops

* add test

* lint

* cleanup

* update docs

* Update public/app/plugins/datasource/cloud-monitoring/components/PromQLEditor.tsx

Co-authored-by: Andreas Christou <andreas.christou@grafana.com>

* nit

* lint fix?

* remove comment from cue

* go linter

* removing parsing stuff parseresponse func

---------

Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
This commit is contained in:
Andrew Hackmann
2023-08-18 11:14:43 -05:00
committed by GitHub
parent 23ae1127a7
commit 42f4306251
23 changed files with 512 additions and 17 deletions
@@ -67,6 +67,7 @@ const (
// Defines values for QueryType.
const (
QueryTypeAnnotation QueryType = "annotation"
QueryTypePromQL QueryType = "promQL"
QueryTypeSlo QueryType = "slo"
QueryTypeTimeSeriesList QueryType = "timeSeriesList"
QueryTypeTimeSeriesQuery QueryType = "timeSeriesQuery"
@@ -99,6 +100,9 @@ type CloudMonitoringQuery struct {
// Time interval in milliseconds.
IntervalMs *float32 `json:"intervalMs,omitempty"`
// PromQL sub-query properties.
PromQLQuery *PromQLQuery `json:"promQLQuery,omitempty"`
// SLO sub-query properties.
SloQuery *SLOQuery `json:"sloQuery,omitempty"`
@@ -220,6 +224,18 @@ type MetricQuery struct {
// Types of pre-processor available. Defined by the metric.
type PreprocessorType string
// PromQL sub-query properties.
type PromQLQuery struct {
// PromQL expression/query to be executed.
Expr string `json:"expr"`
// GCP project to execute the query against.
ProjectName string `json:"projectName"`
// PromQL min step
Step string `json:"step"`
}
// Defines the supported queryTypes.
type QueryType string