grafana/pkg/promlib/models/query.panel.schema.json
Bogdan Matei 55ea077c3e
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>
2024-05-29 20:09:27 +03:00

274 lines
10 KiB
JSON

{
"type": "object",
"required": [
"targets",
"type"
],
"properties": {
"targets": {
"type": "array",
"items": {
"description": "PrometheusQueryProperties defines the specific properties used for prometheus",
"type": "object",
"required": [
"expr"
],
"properties": {
"adhocFilters": {
"description": "Additional Ad-hoc filters that take precedence over Scope on conflict.",
"type": "array",
"items": {
"description": "ScopeFilter is a hand copy of the ScopeFilter struct from pkg/apis/scope/v0alpha1/types.go to avoid import (temp fix)",
"type": "object",
"required": [
"key",
"value",
"operator"
],
"properties": {
"key": {
"type": "string"
},
"operator": {
"type": "string"
},
"value": {
"type": "string"
}
},
"additionalProperties": false
}
},
"datasource": {
"description": "The datasource",
"type": "object",
"required": [
"type"
],
"properties": {
"apiVersion": {
"description": "The apiserver version",
"type": "string"
},
"type": {
"description": "The datasource plugin type",
"type": "string",
"pattern": "^prometheus$"
},
"uid": {
"description": "Datasource UID (NOTE: name in k8s)",
"type": "string"
}
},
"additionalProperties": false
},
"editorMode": {
"description": "what we should show in the editor\n\n\nPossible enum values:\n - `\"builder\"` \n - `\"code\"` ",
"type": "string",
"enum": [
"builder",
"code"
],
"x-enum-description": {}
},
"exemplar": {
"description": "Execute an additional query to identify interesting raw samples relevant for the given expr",
"type": "boolean"
},
"expr": {
"description": "The actual expression/query that will be evaluated by Prometheus",
"type": "string"
},
"format": {
"description": "The response format\n\n\nPossible enum values:\n - `\"time_series\"` \n - `\"table\"` \n - `\"heatmap\"` ",
"type": "string",
"enum": [
"time_series",
"table",
"heatmap"
],
"x-enum-description": {}
},
"groupByKeys": {
"description": "Group By parameters to apply to aggregate expressions in the query",
"type": "array",
"items": {
"type": "string"
}
},
"hide": {
"description": "true if query is disabled (ie should not be returned to the dashboard)\nNOTE: this does not always imply that the query should not be executed since\nthe results from a hidden query may be used as the input to other queries (SSE etc)",
"type": "boolean"
},
"instant": {
"description": "Returns only the latest value that Prometheus has scraped for the requested time series",
"type": "boolean"
},
"intervalFactor": {
"description": "Used to specify how many times to divide max data points by. We use max data points under query options\nSee https://github.com/grafana/grafana/issues/48081\nDeprecated: use interval",
"type": "integer"
},
"intervalMs": {
"description": "Interval is the suggested duration between time points in a time series query.\nNOTE: the values for intervalMs is not saved in the query model. It is typically calculated\nfrom the interval required to fill a pixels in the visualization",
"type": "number"
},
"legendFormat": {
"description": "Series name override or template. Ex. {{hostname}} will be replaced with label value for hostname",
"type": "string"
},
"maxDataPoints": {
"description": "MaxDataPoints is the maximum number of data points that should be returned from a time series query.\nNOTE: the values for maxDataPoints is not saved in the query model. It is typically calculated\nfrom the number of pixels visible in a visualization",
"type": "integer"
},
"queryType": {
"description": "QueryType is an optional identifier for the type of query.\nIt can be used to distinguish different types of queries.",
"type": "string"
},
"range": {
"description": "Returns a Range vector, comprised of a set of time series containing a range of data points over time for each time series",
"type": "boolean"
},
"refId": {
"description": "RefID is the unique identifier of the query, set by the frontend call.",
"type": "string"
},
"resultAssertions": {
"description": "Optionally define expected query result behavior",
"type": "object",
"required": [
"typeVersion"
],
"properties": {
"maxFrames": {
"description": "Maximum frame count",
"type": "integer"
},
"type": {
"description": "Type asserts that the frame matches a known type structure.\n\n\nPossible enum values:\n - `\"\"` \n - `\"timeseries-wide\"` \n - `\"timeseries-long\"` \n - `\"timeseries-many\"` \n - `\"timeseries-multi\"` \n - `\"directory-listing\"` \n - `\"table\"` \n - `\"numeric-wide\"` \n - `\"numeric-multi\"` \n - `\"numeric-long\"` \n - `\"log-lines\"` ",
"type": "string",
"enum": [
"",
"timeseries-wide",
"timeseries-long",
"timeseries-many",
"timeseries-multi",
"directory-listing",
"table",
"numeric-wide",
"numeric-multi",
"numeric-long",
"log-lines"
],
"x-enum-description": {}
},
"typeVersion": {
"description": "TypeVersion is the version of the Type property. Versions greater than 0.0 correspond to the dataplane\ncontract documentation https://grafana.github.io/dataplane/contract/.",
"type": "array",
"maxItems": 2,
"minItems": 2,
"items": {
"type": "integer"
}
}
},
"additionalProperties": false
},
"scopes": {
"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).",
"type": "object",
"required": [
"name",
"title",
"type",
"description",
"category",
"filters"
],
"properties": {
"category": {
"type": "string"
},
"description": {
"type": "string"
},
"filters": {
"type": "array",
"items": {
"description": "ScopeFilter is a hand copy of the ScopeFilter struct from pkg/apis/scope/v0alpha1/types.go to avoid import (temp fix)",
"type": "object",
"required": [
"key",
"value",
"operator"
],
"properties": {
"key": {
"type": "string"
},
"operator": {
"type": "string"
},
"value": {
"type": "string"
}
},
"additionalProperties": false
}
},
"name": {
"description": "This is the identifier from metadata.name of the scope model.",
"type": "string"
},
"title": {
"type": "string"
},
"type": {
"type": "string"
}
},
"additionalProperties": false
}
},
"timeRange": {
"description": "TimeRange represents the query range\nNOTE: unlike generic /ds/query, we can now send explicit time values in each query\nNOTE: the values for timeRange are not saved in a dashboard, they are constructed on the fly",
"type": "object",
"required": [
"from",
"to"
],
"properties": {
"from": {
"description": "From is the start time of the query.",
"type": "string",
"default": "now-6h",
"examples": [
"now-1h"
]
},
"to": {
"description": "To is the end time of the query.",
"type": "string",
"default": "now",
"examples": [
"now"
]
}
},
"additionalProperties": false
}
},
"additionalProperties": false,
"$schema": "https://json-schema.org/draft-04/schema#"
}
},
"type": {
"description": "the panel type",
"type": "string"
}
},
"additionalProperties": true,
"$schema": "https://json-schema.org/draft-04/schema#"
}