Last active
March 6, 2020 18:17
-
-
Save fr-ser/b81b1ab70519e29a594daee7f59b6c18 to your computer and use it in GitHub Desktop.
Swagger documentation for grafana plugin: simpod-json-datasource
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: 3.0.0 | |
info: | |
title: Prometheus Grafana API | |
description: API definition for the prometheus api server, that is queried by | |
grafana (https://grafana.com/plugins/simpod-json-datasource) | |
version: "0.1" | |
paths: | |
/: | |
get: | |
summary: "Test connection" | |
description: Used for "Test connection" on the datasource config page | |
tags: | |
- Health Check | |
responses: | |
'200': | |
description: Positive health check | |
/search: | |
post: | |
summary: List available measure points | |
tags: | |
- Visualization | |
description: Used by the find metric options on the query tab in panels | |
requestBody: | |
content: | |
application/json: | |
schema: | |
type: object | |
properties: | |
target: | |
type: string | |
example: "upper_50" | |
responses: | |
'200': | |
description: "" | |
content: | |
application/json: | |
schema: | |
type: array | |
items: | |
oneOf: | |
- type: string | |
example: ["upper_25", "upper_50", "upper_75", "upper_90", "upper_95"] | |
- type: object | |
example: [{"text" :"upper_25", "value": 1}, {"text" :"upper_75", "value": 2}] | |
properties: | |
text: | |
type: string | |
value: | |
type: number | |
/query: | |
post: | |
summary: Query | |
tags: | |
- Visualization | |
description: Returns metrics / measurepoint data | |
requestBody: | |
required: true | |
content: | |
application/json: | |
schema: | |
type: object | |
properties: | |
panelId: | |
type: number | |
range: | |
type: object | |
properties: | |
from: | |
type: string | |
format: date-time | |
to: | |
type: string | |
format: date-time | |
raw: | |
$ref: '#/components/schemas/raw-time-frame' | |
rangeRaw: | |
$ref: '#/components/schemas/raw-time-frame' | |
interval: | |
type: string | |
example: 30s | |
intervalMs: | |
type: number | |
example: 5500 | |
maxDataPoints: | |
type: number | |
example: 50 | |
targets: | |
type: array | |
items: | |
type: object | |
required: [target] | |
properties: | |
target: | |
type: string | |
example: "upper_25" | |
refId: | |
type: string | |
type: | |
type: string | |
enum: ["timeseries", "table"] | |
data: | |
type: object | |
properties: | |
additional: | |
type: string | |
example: '{"some": "json string"}' | |
format: json | |
adhocFilters: | |
type: array | |
items: | |
type: object | |
properties: | |
key: | |
type: string | |
example: City | |
operator: | |
type: string | |
example: "=" | |
value: | |
type: string | |
example: Berlin | |
responses: | |
'200': | |
description: "Can be a 'timeseries' or 'table' response" | |
content: | |
application/json: | |
schema: | |
type: array | |
items: | |
anyOf: | |
- type: object | |
description: timeseries case | |
required: ["target", "datapoints"] | |
properties: | |
target: | |
type: string | |
example: "upper_25" | |
datapoints: | |
type: array | |
items: | |
type: array | |
example: [ [2.5, 1557385723416], [3.5, 1557385731634] ] | |
description: First value is Metric value as a float. | |
Second values is unixtimestamp in milliseconds | |
minItems: 2 | |
maxItems: 2 | |
items: | |
type: number | |
- type: object | |
description: table case | |
required: ["type", "columns", "rows"] | |
properties: | |
type: | |
type: string | |
enum: ["table"] | |
columns: | |
type: array | |
items: | |
type: object | |
required: ["text"] | |
example: | |
- {"text": "Time", "type": "time"} | |
- {"text": "Country", "type": "string"} | |
- {"text": "Value", "type": "number"} | |
properties: | |
text: | |
type: string | |
type: | |
type: string | |
rows: | |
type: array | |
example: [[1557385723416,"SE",123], [1557385731634,"SE", 456]] | |
items: | |
anyOf: | |
- type: string | |
- type: number | |
/annotations: | |
post: | |
summary: Annotations | |
tags: | |
- Visualization | |
description: should return annotations. | |
requestBody: | |
required: true | |
content: | |
application/json: | |
schema: | |
type: object | |
properties: | |
range: | |
type: object | |
properties: | |
from: | |
type: string | |
format: date-time | |
to: | |
type: string | |
format: date-time | |
rangeRaw: | |
$ref: '#/components/schemas/raw-time-frame' | |
annotation: | |
type: object | |
properties: | |
name: | |
type: string | |
example: deploy | |
datasource: | |
type: string | |
example: JSON datasource | |
iconColor: | |
type: string | |
example: rgba(255, 96, 96, 1) | |
enable: | |
type: boolean | |
query: | |
type: string | |
example: "#deploy" | |
variables: | |
type: array | |
items: | |
anyOf: | |
- type: number | |
- type: string | |
responses: | |
'200': | |
description: "Array of annotation objects" | |
content: | |
application/json: | |
schema: | |
type: array | |
items: | |
type: object | |
required: | |
- text | |
- time | |
properties: | |
text: | |
type: string | |
example: text shown in body | |
time: | |
type: string | |
format: timestamp | |
title: | |
type: string | |
isRegion: | |
type: boolean | |
timeEnd: | |
type: string | |
description: required if isRegion is true | |
format: timestamp | |
tags: | |
type: array | |
items: | |
type: string | |
options: | |
summary: Annotations | |
tags: | |
- Visualization | |
description: If the datasource is configured to connect directly to the backend, | |
OPTIONS endpoint at responds with the correct CORS headers. | |
responses: | |
'200': | |
description: "CORS headers" | |
content: | |
text/plain: | |
schema: | |
type: string | |
example: | | |
Access-Control-Allow-Headers:accept, content-type | |
Access-Control-Allow-Methods:POST | |
Access-Control-Allow-Origin:* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment