loki: implement schema for loki query (#62114)

* loki: implement schema for loki query

* removed forgotten code

* better types

* adjust cue-maturity-level

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>

* sync docs to schema change

* removed forgotten go code

* updated schema docs

Co-authored-by: J Stickler <julie.stickler@grafana.com>

* updated schema docs

Co-authored-by: J Stickler <julie.stickler@grafana.com>

* update schema docs

Co-authored-by: J Stickler <julie.stickler@grafana.com>

* update schema docs

Co-authored-by: J Stickler <julie.stickler@grafana.com>

* updated schema docs

Co-authored-by: J Stickler <julie.stickler@grafana.com>

* updated schema docs

* add documentation to the resolution field

* move direction-field to schema

* loki: cue: moved deprecated fields to the bottom

---------

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
Co-authored-by: J Stickler <julie.stickler@grafana.com>
This commit is contained in:
Gábor Farkas
2023-02-02 16:18:30 +00:00
committed by GitHub
co-authored by Alex Khomenko J Stickler
parent 753c84f825
commit 48a374f50b
9 changed files with 367 additions and 92 deletions
@@ -0,0 +1,105 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
//
// Generated by:
// public/app/plugins/gen.go
// Using jennies:
// PluginGoTypesJenny
//
// Run 'make gen-cue' from repository root to regenerate.
package dataquery
// Defines values for EditorMode.
const (
EditorModeBuilder EditorMode = "builder"
EditorModeCode EditorMode = "code"
)
// Defines values for LokiQueryDirection.
const (
LokiQueryDirectionBackward LokiQueryDirection = "backward"
LokiQueryDirectionForward LokiQueryDirection = "forward"
)
// Defines values for LokiQueryType.
const (
LokiQueryTypeInstant LokiQueryType = "instant"
LokiQueryTypeRange LokiQueryType = "range"
LokiQueryTypeStream LokiQueryType = "stream"
)
// Defines values for QueryEditorMode.
const (
QueryEditorModeBuilder QueryEditorMode = "builder"
QueryEditorModeCode QueryEditorMode = "code"
)
// Defines values for SupportingQueryType.
const (
SupportingQueryTypeDataSample SupportingQueryType = "dataSample"
SupportingQueryTypeLogsSample SupportingQueryType = "logsSample"
SupportingQueryTypeLogsVolume SupportingQueryType = "logsVolume"
)
// LokiDataQuery defines model for LokiDataQuery.
type LokiDataQuery struct {
// For mixed data sources the selected datasource is on the query level.
// For non mixed scenarios this is undefined.
// TODO find a better way to do this ^ that's friendly to schema
// TODO this shouldn't be unknown but DataSourceRef | null
Datasource *interface{} `json:"datasource,omitempty"`
EditorMode *EditorMode `json:"editorMode,omitempty"`
// The LogQL query.
Expr string `json:"expr"`
// true if query is disabled (ie should not be returned to the dashboard)
Hide *bool `json:"hide,omitempty"`
// @deprecated, now use queryType.
Instant *bool `json:"instant,omitempty"`
// Unique, guid like, string used in explore mode
Key *string `json:"key,omitempty"`
// Used to override the name of the series.
LegendFormat *string `json:"legendFormat,omitempty"`
// Used to limit the number of log rows returned.
MaxLines *int64 `json:"maxLines,omitempty"`
// Specify the query flavor
// TODO make this required and give it a default
QueryType *string `json:"queryType,omitempty"`
// @deprecated, now use queryType.
Range *bool `json:"range,omitempty"`
// A - Z
RefId string `json:"refId"`
// Used to scale the interval value.
Resolution *int64 `json:"resolution,omitempty"`
}
// EditorMode defines model for LokiDataQuery.EditorMode.
type EditorMode string
// LokiQueryDirection defines model for LokiQueryDirection.
type LokiQueryDirection string
// LokiQueryType defines model for LokiQueryType.
type LokiQueryType string
// QueryEditorMode defines model for QueryEditorMode.
type QueryEditorMode string
// SupportingQueryType defines model for SupportingQueryType.
type SupportingQueryType string