Scopes: Select scope even without data retrieval (#87988)

* Scopes: Select scope even without data retrieval

* Pass entire scope and not only the spec to Prometheus

* Enrich ScopeSpec that is sent to Prometheus

* add name to BE

---------

Co-authored-by: Kyle Brandt <kyle@grafana.com>
This commit is contained in:
Bogdan Matei
2024-05-29 20:09:27 +03:00
committed by GitHub
co-authored by Kyle Brandt
parent 8b5c9e3e2a
commit 55ea077c3e
7 changed files with 56 additions and 17 deletions
+2 -1
View File
@@ -76,8 +76,9 @@ type PrometheusQueryProperties struct {
}
// ScopeSpec is a hand copy of the ScopeSpec struct from pkg/apis/scope/v0alpha1/types.go
// to avoid import (temp fix)
// to avoid import (temp fix). This also has metadata.name inlined.
type ScopeSpec struct {
Name string `json:"name"` // This is the identifier from metadata.name of the scope model.
Title string `json:"title"`
Type string `json:"type"`
Description string `json:"description"`
+6 -1
View File
@@ -177,9 +177,10 @@
"description": "A set of filters applied to apply to the query",
"type": "array",
"items": {
"description": "ScopeSpec is a hand copy of the ScopeSpec struct from pkg/apis/scope/v0alpha1/types.go to avoid import (temp fix)",
"description": "ScopeSpec is a hand copy of the ScopeSpec struct from pkg/apis/scope/v0alpha1/types.go to avoid import (temp fix).",
"type": "object",
"required": [
"name",
"title",
"type",
"description",
@@ -217,6 +218,10 @@
"additionalProperties": false
}
},
"name": {
"description": "This is the identifier from metadata.name of the scope model.",
"type": "string"
},
"title": {
"type": "string"
},
+6 -1
View File
@@ -187,9 +187,10 @@
"description": "A set of filters applied to apply to the query",
"type": "array",
"items": {
"description": "ScopeSpec is a hand copy of the ScopeSpec struct from pkg/apis/scope/v0alpha1/types.go to avoid import (temp fix)",
"description": "ScopeSpec is a hand copy of the ScopeSpec struct from pkg/apis/scope/v0alpha1/types.go to avoid import (temp fix).",
"type": "object",
"required": [
"name",
"title",
"type",
"description",
@@ -227,6 +228,10 @@
"additionalProperties": false
}
},
"name": {
"description": "This is the identifier from metadata.name of the scope model.",
"type": "string"
},
"title": {
"type": "string"
},
+7 -2
View File
@@ -8,7 +8,7 @@
{
"metadata": {
"name": "default",
"resourceVersion": "1715781995240",
"resourceVersion": "1715871691891",
"creationTimestamp": "2024-03-25T13:19:04Z"
},
"spec": {
@@ -96,7 +96,7 @@
"description": "A set of filters applied to apply to the query",
"items": {
"additionalProperties": false,
"description": "ScopeSpec is a hand copy of the ScopeSpec struct from pkg/apis/scope/v0alpha1/types.go to avoid import (temp fix)",
"description": "ScopeSpec is a hand copy of the ScopeSpec struct from pkg/apis/scope/v0alpha1/types.go to avoid import (temp fix).",
"properties": {
"category": {
"type": "string"
@@ -128,6 +128,10 @@
},
"type": "array"
},
"name": {
"description": "This is the identifier from metadata.name of the scope model.",
"type": "string"
},
"title": {
"type": "string"
},
@@ -136,6 +140,7 @@
}
},
"required": [
"name",
"title",
"type",
"description",