Plugins: Remove deprecated /api/tsdb/query metrics endpoint (#49916)

* remove /api/tsdb/query

* revert changes to alert rules

* regenerate spec based on 9.0.x
This commit is contained in:
Will Browne 2022-06-01 13:05:15 +02:00 committed by GitHub
parent 63303eb4ba
commit abfc711c53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 869 additions and 546 deletions

View File

@ -57,7 +57,7 @@ export default (data) => {
requests.push({ method: 'GET', url: '/api/annotations?from=1580825186534&to=1580846786535' });
for (let n = 0; n < batchCount; n++) {
requests.push({ method: 'POST', url: '/api/tsdb/query', body: payload });
requests.push({ method: 'POST', url: '/api/ds/query', body: payload });
}
let responses = client.batch(requests);

View File

@ -62,7 +62,7 @@ export default (data) => {
requests.push({ method: 'GET', url: '/api/annotations?dashboardId=2074&from=1548078832772&to=1548082432772' });
for (let n = 0; n < batchCount; n++) {
requests.push({ method: 'POST', url: '/api/tsdb/query', body: payload });
requests.push({ method: 'POST', url: '/api/ds/query', body: payload });
}
let responses = client.batch(requests);

View File

@ -59,7 +59,7 @@ export default (data) => {
requests.push({ method: 'GET', url: '/api/annotations?dashboardId=2074&from=1548078832772&to=1548082432772' });
for (let n = 0; n < batchCount; n++) {
requests.push({ method: 'POST', url: '/api/tsdb/query', body: payload });
requests.push({ method: 'POST', url: '/api/ds/query', body: payload });
}
let responses = client.batch(requests);

View File

@ -58,7 +58,7 @@ export default (data) => {
requests.push({ method: 'GET', url: '/api/annotations?dashboardId=2074&from=1548078832772&to=1548082432772' });
for (let n = 0; n < batchCount; n++) {
requests.push({ method: 'POST', url: '/api/tsdb/query', body: payload });
requests.push({ method: 'POST', url: '/api/ds/query', body: payload });
}
let responses = client.batch(requests);

View File

@ -960,117 +960,3 @@ In addition, specific properties of each data source should be added in a reques
| 403 | Access denied. |
| 404 | Either the data source or plugin required to fulfil the request could not be found. |
| 500 | Unexpected error. Refer to the body and/or server logs for more details. |
## Deprecated resources
The following resources have been deprecated. They will be removed in a future release.
### Query a data source by id
> **Warning:** This API is deprecated since Grafana v8.5.0 and will be removed in a future release. Refer to the [new data source query API](#query-a-data-source).
Queries a data source having a backend implementation.
`POST /api/tsdb/query`
> **Note:** Grafana's built-in data sources usually have a backend implementation.
**Example Request**:
```http
POST /api/tsdb/query HTTP/1.1
Accept: application/json
Content-Type: application/json
{
"from": "1420066800000",
"to": "1575845999999",
"queries": [
{
"refId": "A",
"intervalMs": 86400000,
"maxDataPoints": 1092,
"datasourceId": 86,
"rawSql": "SELECT 1 as valueOne, 2 as valueTwo",
"format": "table"
}
]
}
```
JSON Body schema:
- **from/to** Specifies the time range for the queries. The time can be either epoch timestamps in milliseconds or relative using Grafana time units. For example, `now-5m`.
- **queries.refId** Specifies an identifier of the query. Defaults to "A".
- **queries.format** Specifies the format the data should be returned in. Valid options are `time_series` or `table` depending on the data source.
- **queries.datasourceId** Specifies the data source to be queried. Each `query` in the request must have a unique `datasourceId`.
- **queries.maxDataPoints** - Species the maximum amount of data points that a dashboard panel can render. Defaults to 100.
- **queries.intervalMs** - Specifies the time series time interval in milliseconds. Defaults to 1000.
In addition, specific properties of each data source should be added in a request. To better understand how to form a query for a certain data source, use the Developer Tools in your browser of choice and inspect the HTTP requests being made to `/api/tsdb/query`.
**Example request for the MySQL data source:**
```http
POST /api/tsdb/query HTTP/1.1
Accept: application/json
Content-Type: application/json
{
"from": "1420066800000",
"to": "1575845999999",
"queries": [
{
"refId": "A",
"intervalMs": 86400000,
"maxDataPoints": 1092,
"datasourceId": 86,
"rawSql": "SELECT\n time,\n sum(opened) AS \"Opened\",\n sum(closed) AS \"Closed\"\nFROM\n issues_activity\nWHERE\n $__unixEpochFilter(time) AND\n period = 'm' AND\n repo IN('grafana/grafana') AND\n opened_by IN('Contributor','Grafana Labs')\nGROUP BY 1\nORDER BY 1\n",
"format": "time_series"
}
]
}
```
**Example MySQL time series query response:**
```http
HTTP/1.1 200
Content-Type: application/json
{
"results": {
"A": {
"refId": "A",
"meta": {
"rowCount": 0,
"sql": "SELECT\n time,\n sum(opened) AS \"Opened\",\n sum(closed) AS \"Closed\"\nFROM\n issues_activity\nWHERE\n time >= 1420066800 AND time <= 1575845999 AND\n period = 'm' AND\n repo IN('grafana/grafana') AND\n opened_by IN('Contributor','Grafana Labs')\nGROUP BY 1\nORDER BY 1\n"
},
"series": [
{
"name": "Opened",
"points": [
[
109,
1420070400000
],
[
122,
1422748800000
]
]
},
{
"name": "Closed",
"points": [
[
89,
1420070400000
]
]
}
]
}
}
}
```

View File

@ -444,9 +444,6 @@ func (hs *HTTPServer) registerRoutes() {
apiRoute.Get("/search/", routing.Wrap(hs.Search))
// metrics
// Deprecated: use /ds/query API instead.
apiRoute.Post("/tsdb/query", authorize(reqSignedIn, ac.EvalPermission(datasources.ActionQuery)), routing.Wrap(hs.QueryMetrics))
// DataSource w/ expressions
apiRoute.Post("/ds/query", authorize(reqSignedIn, ac.EvalPermission(datasources.ActionQuery)), routing.Wrap(hs.QueryMetricsV2))

View File

@ -3,7 +3,6 @@ package definitions
import (
"github.com/grafana/grafana/pkg/api/dtos"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/tsdb/legacydata"
)
// swagger:route GET /datasources datasources getDatasources
@ -334,29 +333,6 @@ import (
// 404: notFoundError
// 500: internalServerError
// swagger:route POST /tsdb/query datasources queryDatasource
//
// Query metrics.
//
// Please refer to [updated API](#/ds/queryMetricsWithExpressions) instead
//
// Queries a data source having backend implementation.
//
// Most of Grafanas builtin data sources have backend implementation.
//
// If you are running Grafana Enterprise and have Fine-grained access control enabled
// you need to have a permission with action: `datasources:query`.
//
// Deprecated: true
//
// Responses:
// 200: queryDatasourceResponse
// 401: unauthorisedError
// 400: badRequestError
// 403: forbiddenError
// 404: notFoundError
// 500: internalServerError
// swagger:parameters updateDatasourceByID deleteDatasourceByID getDatasourceByID datasourceProxyGETcalls datasourceProxyPOSTcalls datasourceProxyDELETEcalls
// swagger:parameters enablePermissions disablePermissions getPermissions deletePermissions
// swagger:parameters checkDatasourceHealthByID fetchDatasourceResourcesByID
@ -411,13 +387,6 @@ type UpdateDatasource struct {
Body models.UpdateDataSourceCommand
}
// swagger:parameters queryDatasource
type QueryDatasource struct {
// in:body
// required:true
Body dtos.MetricRequest
}
// swagger:response getDatasourcesResponse
type GetDatasourcesResponse struct {
// The response message
@ -486,11 +455,3 @@ type DeleteDatasourceByNameResponse struct {
Message string `json:"message"`
} `json:"body"`
}
// swagger:response queryDatasourceResponse
type QueryDatasourceResponse struct {
// The response message
// in: body
//nolint: staticcheck // plugins.DataResponse deprecated
Body legacydata.DataResponse `json:"body"`
}

View File

@ -12,7 +12,6 @@ import (
"github.com/grafana/grafana/pkg/plugins/backendplugin"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/query"
"github.com/grafana/grafana/pkg/tsdb/legacydata"
"github.com/grafana/grafana/pkg/util"
"github.com/grafana/grafana/pkg/web"
)
@ -53,54 +52,6 @@ func (hs *HTTPServer) QueryMetricsV2(c *models.ReqContext) response.Response {
return hs.toJsonStreamingResponse(resp)
}
// QueryMetrics returns query metrics
// POST /api/tsdb/query
//nolint: staticcheck // legacydata.DataResponse deprecated
//nolint: staticcheck // legacydata.DataQueryResult deprecated
// Deprecated: use QueryMetricsV2 instead.
func (hs *HTTPServer) QueryMetrics(c *models.ReqContext) response.Response {
reqDto := dtos.MetricRequest{}
if err := web.Bind(c.Req, &reqDto); err != nil {
return response.Error(http.StatusBadRequest, "bad request data", err)
}
sdkResp, err := hs.queryDataService.QueryData(c.Req.Context(), c.SignedInUser, c.SkipCache, reqDto, false)
if err != nil {
return hs.handleQueryMetricsError(err)
}
legacyResp := legacydata.DataResponse{
Results: map[string]legacydata.DataQueryResult{},
}
for refID, res := range sdkResp.Responses {
dqr := legacydata.DataQueryResult{
RefID: refID,
}
if res.Error != nil {
dqr.Error = res.Error
}
if res.Frames != nil {
dqr.Dataframes = legacydata.NewDecodedDataFrames(res.Frames)
}
legacyResp.Results[refID] = dqr
}
statusCode := http.StatusOK
for _, res := range legacyResp.Results {
if res.Error != nil {
res.ErrorString = res.Error.Error()
legacyResp.Message = res.ErrorString
statusCode = http.StatusBadRequest
}
}
return response.JSON(statusCode, &legacyResp)
}
func (hs *HTTPServer) toJsonStreamingResponse(qdr *backend.QueryDataResponse) response.Response {
statusWhenError := http.StatusBadRequest
if hs.Features.IsEnabled(featuremgmt.FlagDatasourceQueryMultiStatus) {

View File

@ -7464,45 +7464,6 @@
}
}
},
"/tsdb/query": {
"post": {
"description": "Please refer to [updated API](#/ds/queryMetricsWithExpressions) instead\n\nQueries a data source having backend implementation.\n\nMost of Grafanas builtin data sources have backend implementation.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:query`.",
"tags": ["datasources"],
"summary": "Query metrics.",
"operationId": "queryDatasource",
"deprecated": true,
"parameters": [
{
"name": "Body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/MetricRequest"
}
}
],
"responses": {
"200": {
"$ref": "#/responses/queryDatasourceResponse"
},
"400": {
"$ref": "#/responses/badRequestError"
},
"401": {
"$ref": "#/responses/unauthorisedError"
},
"403": {
"$ref": "#/responses/forbiddenError"
},
"404": {
"$ref": "#/responses/notFoundError"
},
"500": {
"$ref": "#/responses/internalServerError"
}
}
}
},
"/user": {
"get": {
"tags": ["signed_in_user"],
@ -9308,6 +9269,12 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/models"
},
"ConfFloat64": {
"description": "ConfFloat64 is a float64. It Marshals float64 values of NaN of Inf\nto null.",
"type": "number",
"format": "double",
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"Config": {
"type": "object",
"title": "Config is the top-level configuration for Alertmanager's config files.",
@ -10296,67 +10263,39 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/models"
},
"DataFrames": {
"description": "See NewDecodedDataFrames and NewEncodedDataFrames for more information.",
"type": "object",
"title": "DataFrames is an interface for retrieving encoded and decoded data frames.",
"x-go-package": "github.com/grafana/grafana/pkg/tsdb/legacydata"
},
"DataQueryResult": {
"description": "Deprecated: DataQueryResult should use backend.QueryDataResponse",
"DataLink": {
"description": "DataLink define what",
"type": "object",
"properties": {
"dataframes": {
"$ref": "#/definitions/DataFrames"
"targetBlank": {
"type": "boolean",
"x-go-name": "TargetBlank"
},
"error": {
"title": {
"type": "string",
"x-go-name": "ErrorString"
"x-go-name": "Title"
},
"meta": {
"$ref": "#/definitions/Json"
},
"refId": {
"url": {
"type": "string",
"x-go-name": "RefID"
},
"series": {
"$ref": "#/definitions/DataTimeSeriesSlice"
},
"tables": {
"type": "array",
"items": {
"$ref": "#/definitions/DataTable"
},
"x-go-name": "Tables"
"x-go-name": "URL"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/tsdb/legacydata"
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"DataResponse": {
"description": "Deprecated: DataResponse -- this structure is deprecated, all new work should use backend.QueryDataResponse",
"description": "A map of RefIDs (unique query identifers) to this type makes up the Responses property of a QueryDataResponse.\nThe Error property is used to allow for partial success responses from the containing QueryDataResponse.",
"type": "object",
"title": "DataResponse contains the results from a DataQuery.",
"properties": {
"message": {
"type": "string",
"x-go-name": "Message"
"Error": {
"description": "Error is a property to be set if the the corresponding DataQuery has an error.",
"type": "string"
},
"results": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/DataQueryResult"
},
"x-go-name": "Results"
"Frames": {
"$ref": "#/definitions/Frames"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/tsdb/legacydata"
},
"DataRowValues": {
"type": "array",
"items": {
"type": "object"
},
"x-go-package": "github.com/grafana/grafana/pkg/tsdb/legacydata"
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/backend"
},
"DataSource": {
"type": "object",
@ -10528,78 +10467,6 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/api/dtos"
},
"DataTable": {
"type": "object",
"properties": {
"columns": {
"type": "array",
"items": {
"$ref": "#/definitions/DataTableColumn"
},
"x-go-name": "Columns"
},
"rows": {
"type": "array",
"items": {
"$ref": "#/definitions/DataRowValues"
},
"x-go-name": "Rows"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/tsdb/legacydata"
},
"DataTableColumn": {
"type": "object",
"properties": {
"text": {
"type": "string",
"x-go-name": "Text"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/tsdb/legacydata"
},
"DataTimePoint": {
"type": "array",
"items": {
"$ref": "#/definitions/Float"
},
"x-go-package": "github.com/grafana/grafana/pkg/tsdb/legacydata"
},
"DataTimeSeries": {
"description": "DataTimeSeries -- this structure is deprecated, all new work should use DataFrames from the SDK",
"type": "object",
"properties": {
"name": {
"type": "string",
"x-go-name": "Name"
},
"points": {
"$ref": "#/definitions/DataTimeSeriesPoints"
},
"tags": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"x-go-name": "Tags"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/tsdb/legacydata"
},
"DataTimeSeriesPoints": {
"type": "array",
"items": {
"$ref": "#/definitions/DataTimePoint"
},
"x-go-package": "github.com/grafana/grafana/pkg/tsdb/legacydata"
},
"DataTimeSeriesSlice": {
"type": "array",
"items": {
"$ref": "#/definitions/DataTimeSeries"
},
"x-go-package": "github.com/grafana/grafana/pkg/tsdb/legacydata"
},
"DateTime": {
"description": "DateTime is a time but it serializes to ISO8601 format with millis\nIt knows how to read 3 different variations of a RFC3339 date time.\nMost APIs we encounter want either millisecond or second precision times.\nThis just tries to make it worry-free.",
"type": "string",
@ -10897,6 +10764,119 @@
"Failure": {
"$ref": "#/definitions/ResponseDetails"
},
"Field": {
"description": "A Field is essentially a slice of various types with extra properties and methods.\nSee NewField() for supported types.\n\nThe slice data in the Field is a not exported, so methods on the Field are used to to manipulate its data.",
"type": "object",
"title": "Field represents a typed column of data within a Frame.",
"properties": {
"config": {
"$ref": "#/definitions/FieldConfig"
},
"labels": {
"$ref": "#/definitions/Labels"
},
"name": {
"description": "Name is default identifier of the field. The name does not have to be unique, but the combination\nof name and Labels should be unique for proper behavior in all situations.",
"type": "string",
"x-go-name": "Name"
}
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"FieldConfig": {
"type": "object",
"title": "FieldConfig represents the display properties for a Field.",
"properties": {
"color": {
"description": "Map values to a display color\nNOTE: this interface is under development in the frontend... so simple map for now",
"type": "object",
"additionalProperties": {
"type": "object"
},
"x-go-name": "Color"
},
"custom": {
"description": "Panel Specific Values",
"type": "object",
"additionalProperties": {
"type": "object"
},
"x-go-name": "Custom"
},
"decimals": {
"type": "integer",
"format": "uint16",
"x-go-name": "Decimals"
},
"description": {
"description": "Description is human readable field metadata",
"type": "string",
"x-go-name": "Description"
},
"displayName": {
"description": "DisplayName overrides Grafana default naming, should not be used from a data source",
"type": "string",
"x-go-name": "DisplayName"
},
"displayNameFromDS": {
"description": "DisplayNameFromDS overrides Grafana default naming in a better way that allows users to override it easily.",
"type": "string",
"x-go-name": "DisplayNameFromDS"
},
"filterable": {
"description": "Filterable indicates if the Field's data can be filtered by additional calls.",
"type": "boolean",
"x-go-name": "Filterable"
},
"interval": {
"description": "Interval indicates the expected regular step between values in the series.\nWhen an interval exists, consumers can identify \"missing\" values when the expected value is not present.\nThe grafana timeseries visualization will render disconnected values when missing values are found it the time field.\nThe interval uses the same units as the values. For time.Time, this is defined in milliseconds.",
"type": "number",
"format": "double",
"x-go-name": "Interval"
},
"links": {
"description": "The behavior when clicking on a result",
"type": "array",
"items": {
"$ref": "#/definitions/DataLink"
},
"x-go-name": "Links"
},
"mappings": {
"$ref": "#/definitions/ValueMappings"
},
"max": {
"$ref": "#/definitions/ConfFloat64"
},
"min": {
"$ref": "#/definitions/ConfFloat64"
},
"noValue": {
"description": "Alternative to empty string",
"type": "string",
"x-go-name": "NoValue"
},
"path": {
"description": "Path is an explicit path to the field in the datasource. When the frame meta includes a path,\nthis will default to `${frame.meta.path}/${field.name}\n\nWhen defined, this value can be used as an identifier within the datasource scope, and\nmay be used as an identifier to update values in a subsequent request",
"type": "string",
"x-go-name": "Path"
},
"thresholds": {
"$ref": "#/definitions/ThresholdsConfig"
},
"unit": {
"description": "Numeric Options",
"type": "string",
"x-go-name": "Unit"
},
"writeable": {
"description": "Writeable indicates that the datasource knows how to update this value",
"type": "boolean",
"x-go-name": "Writeable"
}
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"FindTagsResult": {
"type": "object",
"title": "FindTagsResult is the result of a tags search.",
@ -11011,6 +10991,101 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/api/dtos"
},
"Frame": {
"description": "Each Field is well typed by its FieldType and supports optional Labels.\n\nA Frame is a general data container for Grafana. A Frame can be table data\nor time series data depending on its content and field types.",
"type": "object",
"title": "Frame is a columnar data structure where each column is a Field.",
"properties": {
"Fields": {
"description": "Fields are the columns of a frame.\nAll Fields must be of the same the length when marshalling the Frame for transmission.",
"type": "array",
"items": {
"$ref": "#/definitions/Field"
}
},
"Meta": {
"$ref": "#/definitions/FrameMeta"
},
"Name": {
"description": "Name is used in some Grafana visualizations.",
"type": "string"
},
"RefID": {
"description": "RefID is a property that can be set to match a Frame to its originating query.",
"type": "string"
}
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"FrameMeta": {
"description": "https://github.com/grafana/grafana/blob/master/packages/grafana-data/src/types/data.ts#L11\nNOTE -- in javascript this can accept any `[key: string]: any;` however\nthis interface only exposes the values we want to be exposed",
"type": "object",
"title": "FrameMeta matches:",
"properties": {
"channel": {
"description": "Channel is the path to a stream in grafana live that has real-time updates for this data.",
"type": "string",
"x-go-name": "Channel"
},
"custom": {
"description": "Custom datasource specific values.",
"type": "object",
"x-go-name": "Custom"
},
"executedQueryString": {
"description": "ExecutedQueryString is the raw query sent to the underlying system. All macros and templating\nhave been applied. When metadata contains this value, it will be shown in the query inspector.",
"type": "string",
"x-go-name": "ExecutedQueryString"
},
"notices": {
"description": "Notices provide additional information about the data in the Frame that\nGrafana can display to the user in the user interface.",
"type": "array",
"items": {
"$ref": "#/definitions/Notice"
},
"x-go-name": "Notices"
},
"path": {
"description": "Path is a browsable path on the datasource.",
"type": "string",
"x-go-name": "Path"
},
"pathSeparator": {
"description": "PathSeparator defines the separator pattern to decode a hiearchy. The default separator is '/'.",
"type": "string",
"x-go-name": "PathSeparator"
},
"preferredVisualisationType": {
"$ref": "#/definitions/VisType"
},
"stats": {
"description": "Stats is an array of query result statistics.",
"type": "array",
"items": {
"$ref": "#/definitions/QueryStat"
},
"x-go-name": "Stats"
},
"type": {
"$ref": "#/definitions/FrameType"
}
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"FrameType": {
"description": "A FrameType string, when present in a frame's metadata, asserts that the\nframe's structure conforms to the FrameType's specification.\nThis property is currently optional, so FrameType may be FrameTypeUnknown even if the properties of\nthe Frame correspond to a defined FrameType.",
"type": "string",
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"Frames": {
"description": "It is the main data container within a backend.DataResponse.",
"type": "array",
"title": "Frames is a slice of Frame pointers.",
"items": {
"$ref": "#/definitions/Frame"
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"GetAnnotationTagsResponse": {
"type": "object",
"title": "GetAnnotationTagsResponse is a response struct for FindTagsResult.",
@ -11827,6 +11902,12 @@
},
"x-go-package": "github.com/prometheus/alertmanager/config"
},
"InspectType": {
"type": "integer",
"format": "int64",
"title": "InspectType is a type for the Inspect property of a Notice.",
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"ItemDTO": {
"type": "object",
"properties": {
@ -12438,6 +12519,35 @@
"type": "object",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"Notice": {
"type": "object",
"title": "Notice provides a structure for presenting notifications in Grafana's user interface.",
"properties": {
"inspect": {
"$ref": "#/definitions/InspectType"
},
"link": {
"description": "Link is an optional link for display in the user interface and can be an\nabsolute URL or a path relative to Grafana's root url.",
"type": "string",
"x-go-name": "Link"
},
"severity": {
"$ref": "#/definitions/NoticeSeverity"
},
"text": {
"description": "Text is freeform descriptive text for the notice.",
"type": "string",
"x-go-name": "Text"
}
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"NoticeSeverity": {
"type": "integer",
"format": "int64",
"title": "NoticeSeverity is a type for the Severity property of a Notice.",
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"NotificationTestCommand": {
"type": "object",
"properties": {
@ -13503,6 +13613,106 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/services/preference"
},
"QueryStat": {
"description": "The embedded FieldConfig's display name must be set.\nIt corresponds to the QueryResultMetaStat on the frontend (https://github.com/grafana/grafana/blob/master/packages/grafana-data/src/types/data.ts#L53).",
"type": "object",
"title": "QueryStat is used for storing arbitrary statistics metadata related to a query and its result, e.g. total request time, data processing time.",
"properties": {
"color": {
"description": "Map values to a display color\nNOTE: this interface is under development in the frontend... so simple map for now",
"type": "object",
"additionalProperties": {
"type": "object"
},
"x-go-name": "Color"
},
"custom": {
"description": "Panel Specific Values",
"type": "object",
"additionalProperties": {
"type": "object"
},
"x-go-name": "Custom"
},
"decimals": {
"type": "integer",
"format": "uint16",
"x-go-name": "Decimals"
},
"description": {
"description": "Description is human readable field metadata",
"type": "string",
"x-go-name": "Description"
},
"displayName": {
"description": "DisplayName overrides Grafana default naming, should not be used from a data source",
"type": "string",
"x-go-name": "DisplayName"
},
"displayNameFromDS": {
"description": "DisplayNameFromDS overrides Grafana default naming in a better way that allows users to override it easily.",
"type": "string",
"x-go-name": "DisplayNameFromDS"
},
"filterable": {
"description": "Filterable indicates if the Field's data can be filtered by additional calls.",
"type": "boolean",
"x-go-name": "Filterable"
},
"interval": {
"description": "Interval indicates the expected regular step between values in the series.\nWhen an interval exists, consumers can identify \"missing\" values when the expected value is not present.\nThe grafana timeseries visualization will render disconnected values when missing values are found it the time field.\nThe interval uses the same units as the values. For time.Time, this is defined in milliseconds.",
"type": "number",
"format": "double",
"x-go-name": "Interval"
},
"links": {
"description": "The behavior when clicking on a result",
"type": "array",
"items": {
"$ref": "#/definitions/DataLink"
},
"x-go-name": "Links"
},
"mappings": {
"$ref": "#/definitions/ValueMappings"
},
"max": {
"$ref": "#/definitions/ConfFloat64"
},
"min": {
"$ref": "#/definitions/ConfFloat64"
},
"noValue": {
"description": "Alternative to empty string",
"type": "string",
"x-go-name": "NoValue"
},
"path": {
"description": "Path is an explicit path to the field in the datasource. When the frame meta includes a path,\nthis will default to `${frame.meta.path}/${field.name}\n\nWhen defined, this value can be used as an identifier within the datasource scope, and\nmay be used as an identifier to update values in a subsequent request",
"type": "string",
"x-go-name": "Path"
},
"thresholds": {
"$ref": "#/definitions/ThresholdsConfig"
},
"unit": {
"description": "Numeric Options",
"type": "string",
"x-go-name": "Unit"
},
"value": {
"type": "number",
"format": "double",
"x-go-name": "Value"
},
"writeable": {
"description": "Writeable indicates that the datasource knows how to update this value",
"type": "boolean",
"x-go-name": "Writeable"
}
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"Receiver": {
"type": "object",
"title": "Receiver configuration provides configuration on how to contact a receiver.",
@ -14909,6 +15119,47 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"Threshold": {
"description": "Threshold a single step on the threshold list",
"type": "object",
"properties": {
"color": {
"type": "string",
"x-go-name": "Color"
},
"state": {
"type": "string",
"x-go-name": "State"
},
"value": {
"$ref": "#/definitions/ConfFloat64"
}
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"ThresholdsConfig": {
"description": "ThresholdsConfig setup thresholds",
"type": "object",
"properties": {
"mode": {
"$ref": "#/definitions/ThresholdsMode"
},
"steps": {
"description": "Must be sorted by 'value', first value is always -Infinity",
"type": "array",
"items": {
"$ref": "#/definitions/Threshold"
},
"x-go-name": "Steps"
}
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"ThresholdsMode": {
"description": "ThresholdsMode absolute or percentage",
"type": "string",
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"TimeInterval": {
"description": "TimeInterval describes intervals of time. ContainsTime will tell you if a golang time is contained\nwithin the interval.",
"type": "object",
@ -15875,6 +16126,18 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"ValueMapping": {
"description": "ValueMapping allows mapping input values to text and color",
"type": "object",
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"ValueMappings": {
"type": "array",
"items": {
"$ref": "#/definitions/ValueMapping"
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"Vector": {
"description": "Vector is basically only an alias for model.Samples, but the\ncontract is that in a Vector, all Samples have the same timestamp.",
"type": "array",
@ -15933,6 +16196,11 @@
},
"x-go-package": "github.com/prometheus/alertmanager/config"
},
"VisType": {
"type": "string",
"title": "VisType is used to indicate how the data should be visualized in explore.",
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"WebhookConfig": {
"type": "object",
"title": "WebhookConfig configures notifications via a generic webhook.",
@ -17437,12 +17705,6 @@
"$ref": "#/definitions/QueryDataResponse"
}
},
"queryDatasourceResponse": {
"description": "",
"schema": {
"$ref": "#/definitions/DataResponse"
}
},
"recordingRuleResponse": {
"description": "",
"schema": {

View File

@ -7464,45 +7464,6 @@
}
}
},
"/tsdb/query": {
"post": {
"description": "Please refer to [updated API](#/ds/queryMetricsWithExpressions) instead\n\nQueries a data source having backend implementation.\n\nMost of Grafanas builtin data sources have backend implementation.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:query`.",
"tags": ["datasources"],
"summary": "Query metrics.",
"operationId": "queryDatasource",
"deprecated": true,
"parameters": [
{
"name": "Body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/MetricRequest"
}
}
],
"responses": {
"200": {
"$ref": "#/responses/queryDatasourceResponse"
},
"400": {
"$ref": "#/responses/badRequestError"
},
"401": {
"$ref": "#/responses/unauthorisedError"
},
"403": {
"$ref": "#/responses/forbiddenError"
},
"404": {
"$ref": "#/responses/notFoundError"
},
"500": {
"$ref": "#/responses/internalServerError"
}
}
}
},
"/user": {
"get": {
"tags": ["signed_in_user"],
@ -9099,6 +9060,12 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/models"
},
"ConfFloat64": {
"description": "ConfFloat64 is a float64. It Marshals float64 values of NaN of Inf\nto null.",
"type": "number",
"format": "double",
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"ConfigDTO": {
"description": "ConfigDTO is model representation in transfer",
"type": "object",
@ -10053,67 +10020,39 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/models"
},
"DataFrames": {
"description": "See NewDecodedDataFrames and NewEncodedDataFrames for more information.",
"type": "object",
"title": "DataFrames is an interface for retrieving encoded and decoded data frames.",
"x-go-package": "github.com/grafana/grafana/pkg/tsdb/legacydata"
},
"DataQueryResult": {
"description": "Deprecated: DataQueryResult should use backend.QueryDataResponse",
"DataLink": {
"description": "DataLink define what",
"type": "object",
"properties": {
"dataframes": {
"$ref": "#/definitions/DataFrames"
"targetBlank": {
"type": "boolean",
"x-go-name": "TargetBlank"
},
"error": {
"title": {
"type": "string",
"x-go-name": "ErrorString"
"x-go-name": "Title"
},
"meta": {
"$ref": "#/definitions/Json"
},
"refId": {
"url": {
"type": "string",
"x-go-name": "RefID"
},
"series": {
"$ref": "#/definitions/DataTimeSeriesSlice"
},
"tables": {
"type": "array",
"items": {
"$ref": "#/definitions/DataTable"
},
"x-go-name": "Tables"
"x-go-name": "URL"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/tsdb/legacydata"
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"DataResponse": {
"description": "Deprecated: DataResponse -- this structure is deprecated, all new work should use backend.QueryDataResponse",
"description": "A map of RefIDs (unique query identifers) to this type makes up the Responses property of a QueryDataResponse.\nThe Error property is used to allow for partial success responses from the containing QueryDataResponse.",
"type": "object",
"title": "DataResponse contains the results from a DataQuery.",
"properties": {
"message": {
"type": "string",
"x-go-name": "Message"
"Error": {
"description": "Error is a property to be set if the the corresponding DataQuery has an error.",
"type": "string"
},
"results": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/DataQueryResult"
},
"x-go-name": "Results"
"Frames": {
"$ref": "#/definitions/Frames"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/tsdb/legacydata"
},
"DataRowValues": {
"type": "array",
"items": {
"type": "object"
},
"x-go-package": "github.com/grafana/grafana/pkg/tsdb/legacydata"
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/backend"
},
"DataSource": {
"type": "object",
@ -10285,78 +10224,6 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/api/dtos"
},
"DataTable": {
"type": "object",
"properties": {
"columns": {
"type": "array",
"items": {
"$ref": "#/definitions/DataTableColumn"
},
"x-go-name": "Columns"
},
"rows": {
"type": "array",
"items": {
"$ref": "#/definitions/DataRowValues"
},
"x-go-name": "Rows"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/tsdb/legacydata"
},
"DataTableColumn": {
"type": "object",
"properties": {
"text": {
"type": "string",
"x-go-name": "Text"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/tsdb/legacydata"
},
"DataTimePoint": {
"type": "array",
"items": {
"$ref": "#/definitions/Float"
},
"x-go-package": "github.com/grafana/grafana/pkg/tsdb/legacydata"
},
"DataTimeSeries": {
"description": "DataTimeSeries -- this structure is deprecated, all new work should use DataFrames from the SDK",
"type": "object",
"properties": {
"name": {
"type": "string",
"x-go-name": "Name"
},
"points": {
"$ref": "#/definitions/DataTimeSeriesPoints"
},
"tags": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"x-go-name": "Tags"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/tsdb/legacydata"
},
"DataTimeSeriesPoints": {
"type": "array",
"items": {
"$ref": "#/definitions/DataTimePoint"
},
"x-go-package": "github.com/grafana/grafana/pkg/tsdb/legacydata"
},
"DataTimeSeriesSlice": {
"type": "array",
"items": {
"$ref": "#/definitions/DataTimeSeries"
},
"x-go-package": "github.com/grafana/grafana/pkg/tsdb/legacydata"
},
"DeleteTokenCommand": {
"type": "object",
"properties": {
@ -10438,6 +10305,119 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/extensions/ldapsync"
},
"Field": {
"description": "A Field is essentially a slice of various types with extra properties and methods.\nSee NewField() for supported types.\n\nThe slice data in the Field is a not exported, so methods on the Field are used to to manipulate its data.",
"type": "object",
"title": "Field represents a typed column of data within a Frame.",
"properties": {
"config": {
"$ref": "#/definitions/FieldConfig"
},
"labels": {
"$ref": "#/definitions/Labels"
},
"name": {
"description": "Name is default identifier of the field. The name does not have to be unique, but the combination\nof name and Labels should be unique for proper behavior in all situations.",
"type": "string",
"x-go-name": "Name"
}
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"FieldConfig": {
"type": "object",
"title": "FieldConfig represents the display properties for a Field.",
"properties": {
"color": {
"description": "Map values to a display color\nNOTE: this interface is under development in the frontend... so simple map for now",
"type": "object",
"additionalProperties": {
"type": "object"
},
"x-go-name": "Color"
},
"custom": {
"description": "Panel Specific Values",
"type": "object",
"additionalProperties": {
"type": "object"
},
"x-go-name": "Custom"
},
"decimals": {
"type": "integer",
"format": "uint16",
"x-go-name": "Decimals"
},
"description": {
"description": "Description is human readable field metadata",
"type": "string",
"x-go-name": "Description"
},
"displayName": {
"description": "DisplayName overrides Grafana default naming, should not be used from a data source",
"type": "string",
"x-go-name": "DisplayName"
},
"displayNameFromDS": {
"description": "DisplayNameFromDS overrides Grafana default naming in a better way that allows users to override it easily.",
"type": "string",
"x-go-name": "DisplayNameFromDS"
},
"filterable": {
"description": "Filterable indicates if the Field's data can be filtered by additional calls.",
"type": "boolean",
"x-go-name": "Filterable"
},
"interval": {
"description": "Interval indicates the expected regular step between values in the series.\nWhen an interval exists, consumers can identify \"missing\" values when the expected value is not present.\nThe grafana timeseries visualization will render disconnected values when missing values are found it the time field.\nThe interval uses the same units as the values. For time.Time, this is defined in milliseconds.",
"type": "number",
"format": "double",
"x-go-name": "Interval"
},
"links": {
"description": "The behavior when clicking on a result",
"type": "array",
"items": {
"$ref": "#/definitions/DataLink"
},
"x-go-name": "Links"
},
"mappings": {
"$ref": "#/definitions/ValueMappings"
},
"max": {
"$ref": "#/definitions/ConfFloat64"
},
"min": {
"$ref": "#/definitions/ConfFloat64"
},
"noValue": {
"description": "Alternative to empty string",
"type": "string",
"x-go-name": "NoValue"
},
"path": {
"description": "Path is an explicit path to the field in the datasource. When the frame meta includes a path,\nthis will default to `${frame.meta.path}/${field.name}\n\nWhen defined, this value can be used as an identifier within the datasource scope, and\nmay be used as an identifier to update values in a subsequent request",
"type": "string",
"x-go-name": "Path"
},
"thresholds": {
"$ref": "#/definitions/ThresholdsConfig"
},
"unit": {
"description": "Numeric Options",
"type": "string",
"x-go-name": "Unit"
},
"writeable": {
"description": "Writeable indicates that the datasource knows how to update this value",
"type": "boolean",
"x-go-name": "Writeable"
}
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"FindTagsResult": {
"type": "object",
"title": "FindTagsResult is the result of a tags search.",
@ -10552,6 +10532,101 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/api/dtos"
},
"Frame": {
"description": "Each Field is well typed by its FieldType and supports optional Labels.\n\nA Frame is a general data container for Grafana. A Frame can be table data\nor time series data depending on its content and field types.",
"type": "object",
"title": "Frame is a columnar data structure where each column is a Field.",
"properties": {
"Fields": {
"description": "Fields are the columns of a frame.\nAll Fields must be of the same the length when marshalling the Frame for transmission.",
"type": "array",
"items": {
"$ref": "#/definitions/Field"
}
},
"Meta": {
"$ref": "#/definitions/FrameMeta"
},
"Name": {
"description": "Name is used in some Grafana visualizations.",
"type": "string"
},
"RefID": {
"description": "RefID is a property that can be set to match a Frame to its originating query.",
"type": "string"
}
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"FrameMeta": {
"description": "https://github.com/grafana/grafana/blob/master/packages/grafana-data/src/types/data.ts#L11\nNOTE -- in javascript this can accept any `[key: string]: any;` however\nthis interface only exposes the values we want to be exposed",
"type": "object",
"title": "FrameMeta matches:",
"properties": {
"channel": {
"description": "Channel is the path to a stream in grafana live that has real-time updates for this data.",
"type": "string",
"x-go-name": "Channel"
},
"custom": {
"description": "Custom datasource specific values.",
"type": "object",
"x-go-name": "Custom"
},
"executedQueryString": {
"description": "ExecutedQueryString is the raw query sent to the underlying system. All macros and templating\nhave been applied. When metadata contains this value, it will be shown in the query inspector.",
"type": "string",
"x-go-name": "ExecutedQueryString"
},
"notices": {
"description": "Notices provide additional information about the data in the Frame that\nGrafana can display to the user in the user interface.",
"type": "array",
"items": {
"$ref": "#/definitions/Notice"
},
"x-go-name": "Notices"
},
"path": {
"description": "Path is a browsable path on the datasource.",
"type": "string",
"x-go-name": "Path"
},
"pathSeparator": {
"description": "PathSeparator defines the separator pattern to decode a hiearchy. The default separator is '/'.",
"type": "string",
"x-go-name": "PathSeparator"
},
"preferredVisualisationType": {
"$ref": "#/definitions/VisType"
},
"stats": {
"description": "Stats is an array of query result statistics.",
"type": "array",
"items": {
"$ref": "#/definitions/QueryStat"
},
"x-go-name": "Stats"
},
"type": {
"$ref": "#/definitions/FrameType"
}
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"FrameType": {
"description": "A FrameType string, when present in a frame's metadata, asserts that the\nframe's structure conforms to the FrameType's specification.\nThis property is currently optional, so FrameType may be FrameTypeUnknown even if the properties of\nthe Frame correspond to a defined FrameType.",
"type": "string",
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"Frames": {
"description": "It is the main data container within a backend.DataResponse.",
"type": "array",
"title": "Frames is a slice of Frame pointers.",
"items": {
"$ref": "#/definitions/Frame"
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"GetAnnotationTagsResponse": {
"type": "object",
"title": "GetAnnotationTagsResponse is a response struct for FindTagsResult.",
@ -10799,6 +10874,12 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/services/dashboardimport"
},
"InspectType": {
"type": "integer",
"format": "int64",
"title": "InspectType is a type for the Inspect property of a Notice.",
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"ItemDTO": {
"type": "object",
"properties": {
@ -10896,6 +10977,14 @@
"type": "object",
"x-go-package": "github.com/grafana/grafana/pkg/components/simplejson"
},
"Labels": {
"description": "Labels are used to add metadata to an object. The JSON will always be sorted keys",
"type": "object",
"additionalProperties": {
"type": "string"
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"LibraryElementConnectionDTO": {
"type": "object",
"title": "LibraryElementConnectionDTO is the frontend DTO for element connections.",
@ -11239,6 +11328,35 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/api/dtos"
},
"Notice": {
"type": "object",
"title": "Notice provides a structure for presenting notifications in Grafana's user interface.",
"properties": {
"inspect": {
"$ref": "#/definitions/InspectType"
},
"link": {
"description": "Link is an optional link for display in the user interface and can be an\nabsolute URL or a path relative to Grafana's root url.",
"type": "string",
"x-go-name": "Link"
},
"severity": {
"$ref": "#/definitions/NoticeSeverity"
},
"text": {
"description": "Text is freeform descriptive text for the notice.",
"type": "string",
"x-go-name": "Text"
}
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"NoticeSeverity": {
"type": "integer",
"format": "int64",
"title": "NoticeSeverity is a type for the Severity property of a Notice.",
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"NotificationTestCommand": {
"type": "object",
"properties": {
@ -11673,6 +11791,106 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/services/preference"
},
"QueryStat": {
"description": "The embedded FieldConfig's display name must be set.\nIt corresponds to the QueryResultMetaStat on the frontend (https://github.com/grafana/grafana/blob/master/packages/grafana-data/src/types/data.ts#L53).",
"type": "object",
"title": "QueryStat is used for storing arbitrary statistics metadata related to a query and its result, e.g. total request time, data processing time.",
"properties": {
"color": {
"description": "Map values to a display color\nNOTE: this interface is under development in the frontend... so simple map for now",
"type": "object",
"additionalProperties": {
"type": "object"
},
"x-go-name": "Color"
},
"custom": {
"description": "Panel Specific Values",
"type": "object",
"additionalProperties": {
"type": "object"
},
"x-go-name": "Custom"
},
"decimals": {
"type": "integer",
"format": "uint16",
"x-go-name": "Decimals"
},
"description": {
"description": "Description is human readable field metadata",
"type": "string",
"x-go-name": "Description"
},
"displayName": {
"description": "DisplayName overrides Grafana default naming, should not be used from a data source",
"type": "string",
"x-go-name": "DisplayName"
},
"displayNameFromDS": {
"description": "DisplayNameFromDS overrides Grafana default naming in a better way that allows users to override it easily.",
"type": "string",
"x-go-name": "DisplayNameFromDS"
},
"filterable": {
"description": "Filterable indicates if the Field's data can be filtered by additional calls.",
"type": "boolean",
"x-go-name": "Filterable"
},
"interval": {
"description": "Interval indicates the expected regular step between values in the series.\nWhen an interval exists, consumers can identify \"missing\" values when the expected value is not present.\nThe grafana timeseries visualization will render disconnected values when missing values are found it the time field.\nThe interval uses the same units as the values. For time.Time, this is defined in milliseconds.",
"type": "number",
"format": "double",
"x-go-name": "Interval"
},
"links": {
"description": "The behavior when clicking on a result",
"type": "array",
"items": {
"$ref": "#/definitions/DataLink"
},
"x-go-name": "Links"
},
"mappings": {
"$ref": "#/definitions/ValueMappings"
},
"max": {
"$ref": "#/definitions/ConfFloat64"
},
"min": {
"$ref": "#/definitions/ConfFloat64"
},
"noValue": {
"description": "Alternative to empty string",
"type": "string",
"x-go-name": "NoValue"
},
"path": {
"description": "Path is an explicit path to the field in the datasource. When the frame meta includes a path,\nthis will default to `${frame.meta.path}/${field.name}\n\nWhen defined, this value can be used as an identifier within the datasource scope, and\nmay be used as an identifier to update values in a subsequent request",
"type": "string",
"x-go-name": "Path"
},
"thresholds": {
"$ref": "#/definitions/ThresholdsConfig"
},
"unit": {
"description": "Numeric Options",
"type": "string",
"x-go-name": "Unit"
},
"value": {
"type": "number",
"format": "double",
"x-go-name": "Value"
},
"writeable": {
"description": "Writeable indicates that the datasource knows how to update this value",
"type": "boolean",
"x-go-name": "Writeable"
}
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"RecordingRuleJSON": {
"description": "RecordingRuleJSON is the external representation of a recording rule",
"type": "object",
@ -12332,6 +12550,47 @@
"type": "string",
"x-go-package": "github.com/grafana/grafana/pkg/models"
},
"Threshold": {
"description": "Threshold a single step on the threshold list",
"type": "object",
"properties": {
"color": {
"type": "string",
"x-go-name": "Color"
},
"state": {
"type": "string",
"x-go-name": "State"
},
"value": {
"$ref": "#/definitions/ConfFloat64"
}
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"ThresholdsConfig": {
"description": "ThresholdsConfig setup thresholds",
"type": "object",
"properties": {
"mode": {
"$ref": "#/definitions/ThresholdsMode"
},
"steps": {
"description": "Must be sorted by 'value', first value is always -Infinity",
"type": "array",
"items": {
"$ref": "#/definitions/Threshold"
},
"x-go-name": "Steps"
}
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"ThresholdsMode": {
"description": "ThresholdsMode absolute or percentage",
"type": "string",
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"TimeRangeDTO": {
"type": "object",
"properties": {
@ -13186,6 +13445,23 @@
}
},
"x-go-package": "github.com/grafana/grafana/pkg/models"
},
"ValueMapping": {
"description": "ValueMapping allows mapping input values to text and color",
"type": "object",
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"ValueMappings": {
"type": "array",
"items": {
"$ref": "#/definitions/ValueMapping"
},
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
},
"VisType": {
"type": "string",
"title": "VisType is used to indicate how the data should be visualized in explore.",
"x-go-package": "github.com/grafana/grafana-plugin-sdk-go/data"
}
},
"responses": {
@ -14073,12 +14349,6 @@
"$ref": "#/definitions/QueryDataResponse"
}
},
"queryDatasourceResponse": {
"description": "",
"schema": {
"$ref": "#/definitions/DataResponse"
}
},
"recordingRuleResponse": {
"description": "",
"schema": {

View File

@ -22,11 +22,7 @@ export function addQuery(queries: DataQuery[], query?: Partial<DataQuery>, datas
}
export function isDataQuery(url: string): boolean {
if (
url.indexOf('api/datasources/proxy') !== -1 ||
url.indexOf('api/tsdb/query') !== -1 ||
url.indexOf('api/ds/query') !== -1
) {
if (url.indexOf('api/datasources/proxy') !== -1 || url.indexOf('api/ds/query') !== -1) {
return true;
}

View File

@ -340,7 +340,7 @@ describe('ElasticDatasource', function (this: any) {
data: '{\n "reason": "all shards failed"\n}',
message: 'all shards failed',
config: {
url: 'http://localhost:3000/api/tsdb/query',
url: 'http://localhost:3000/api/ds/query',
},
};
@ -357,8 +357,8 @@ describe('ElasticDatasource', function (this: any) {
message: 'Authentication to data source failed',
},
status: 400,
url: 'http://localhost:3000/api/tsdb/query',
config: { url: 'http://localhost:3000/api/tsdb/query' },
url: 'http://localhost:3000/api/ds/query',
config: { url: 'http://localhost:3000/api/ds/query' },
type: 'basic',
statusText: 'Bad Request',
redirected: false,
@ -401,7 +401,7 @@ describe('ElasticDatasource', function (this: any) {
data: '{}',
message: 'Unknown elastic error response',
config: {
url: 'http://localhost:3000/api/tsdb/query',
url: 'http://localhost:3000/api/ds/query',
},
};

View File

@ -4,8 +4,8 @@ export function createFetchResponse<T>(data: T): FetchResponse<T> {
return {
data,
status: 200,
url: 'http://localhost:3000/api/tsdb/query',
config: { url: 'http://localhost:3000/api/tsdb/query' },
url: 'http://localhost:3000/api/ds/query',
config: { url: 'http://localhost:3000/api/ds/query' },
type: 'basic',
statusText: 'Ok',
redirected: false,