2016-12-05 17:36:12 +00:00
|
|
|
## Dashboard API
|
2016-12-06 17:22:27 +00:00
|
|
|
The dashboard API will support collections of resizable InfluxQL visualizations.
|
2016-12-05 17:36:12 +00:00
|
|
|
|
|
|
|
### TL; DR
|
2016-12-06 17:10:26 +00:00
|
|
|
Here are the objects we are thinking about; dashboards contain layouts which
|
2017-02-01 21:05:06 +00:00
|
|
|
contain queries.
|
2016-12-05 17:36:12 +00:00
|
|
|
|
|
|
|
#### Dashboard
|
2016-12-06 17:10:26 +00:00
|
|
|
|
2016-12-05 17:36:12 +00:00
|
|
|
```json
|
|
|
|
{
|
|
|
|
"links": {
|
|
|
|
"self": "/chronograf/v1/dashboards/myid"
|
|
|
|
},
|
|
|
|
"id": "myid",
|
2016-12-07 22:35:58 +00:00
|
|
|
"cells": [
|
2016-12-06 17:10:26 +00:00
|
|
|
{
|
|
|
|
"x": 0,
|
|
|
|
"y": 0,
|
|
|
|
"w": 2,
|
|
|
|
"h": 1,
|
|
|
|
"label": "Objects/Second",
|
|
|
|
"range": {
|
|
|
|
"upper": 100,
|
|
|
|
"lower": 10
|
|
|
|
},
|
2016-12-07 22:35:58 +00:00
|
|
|
"queries": ["/chronograf/v1/queries/1"]
|
2016-12-06 17:10:26 +00:00
|
|
|
},
|
2016-12-05 17:36:12 +00:00
|
|
|
{
|
2016-12-06 17:10:26 +00:00
|
|
|
"x": 2,
|
|
|
|
"y": 0,
|
|
|
|
"w": 2,
|
|
|
|
"h": 1,
|
|
|
|
"label": "Widgets/Second",
|
|
|
|
"range": {
|
|
|
|
"upper": 10,
|
|
|
|
"lower": 0
|
|
|
|
},
|
2016-12-07 22:35:58 +00:00
|
|
|
"queries": ["/chronograf/v1/queries/2"]
|
2016-12-05 17:36:12 +00:00
|
|
|
}
|
2016-12-06 17:10:26 +00:00
|
|
|
],
|
|
|
|
"name": "This is my dashboard",
|
2016-12-05 17:36:12 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2016-12-06 17:10:26 +00:00
|
|
|
#### Query
|
2016-12-05 17:36:12 +00:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2016-12-06 17:10:26 +00:00
|
|
|
"query": "SELECT mean(n_cpu) from cpu GROUP BY time(15m)",
|
|
|
|
"db": "telegraf",
|
|
|
|
"rp": "",
|
|
|
|
"links" : {
|
|
|
|
"self": "/chronograf/v1/queries/1"
|
|
|
|
}
|
2016-12-05 17:36:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
```
|
2016-12-06 17:22:27 +00:00
|
|
|
## Older Chronograf dashboards
|
|
|
|
Older chronograf dashboards had the following features:
|
|
|
|
|
|
|
|
* View Dashboard
|
|
|
|
* Add new visualization to dashboard
|
|
|
|
* Add existing visualization to dashboard
|
|
|
|
* Remove visualizatoin from dashboard
|
|
|
|
* Naming of dashboards
|
|
|
|
* Delete dashboard
|
|
|
|
* Edit visualization in dashboard
|
2016-12-05 17:36:12 +00:00
|
|
|
|
|
|
|
## API
|
2016-12-06 17:22:27 +00:00
|
|
|
This API supports a user defined grid layout by specifying `x`, `y`, `w`, `h`.
|
|
|
|
These fields align with the [react-grid-layout](https://github.com/STRML/react-grid-layout#usage)
|
|
|
|
methodology.
|
|
|
|
|
|
|
|
This layout style has:
|
|
|
|
|
|
|
|
* Draggable query cells
|
|
|
|
* Resizable query cells
|
|
|
|
* Vertical auto-packing
|
|
|
|
|
2016-12-05 17:36:12 +00:00
|
|
|
### /dashboards
|
|
|
|
#### GET /dashboards
|
|
|
|
|
|
|
|
Returns a list of dashboards
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2016-12-06 17:10:26 +00:00
|
|
|
"dashboards": [
|
|
|
|
{
|
|
|
|
"links": {
|
|
|
|
"self": "/chronograf/v1/dashboards/myid"
|
|
|
|
},
|
|
|
|
"id": "myid",
|
2016-12-07 22:35:58 +00:00
|
|
|
"cells": [
|
2016-12-06 17:10:26 +00:00
|
|
|
{
|
|
|
|
"x": 0,
|
|
|
|
"y": 0,
|
|
|
|
"w": 2,
|
|
|
|
"h": 1,
|
|
|
|
"label": "Objects/Second",
|
|
|
|
"range": {
|
|
|
|
"upper": 100,
|
|
|
|
"lower": 10
|
|
|
|
},
|
2016-12-07 22:35:58 +00:00
|
|
|
"queries": ["/chronograf/v1/queries/1"]
|
2016-12-06 17:10:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"x": 2,
|
|
|
|
"y": 0,
|
|
|
|
"w": 2,
|
|
|
|
"h": 1,
|
|
|
|
"label": "Widgets/Second",
|
|
|
|
"range": {
|
|
|
|
"upper": 10,
|
|
|
|
"lower": 0
|
|
|
|
},
|
2016-12-07 22:35:58 +00:00
|
|
|
"queries": ["/chronograf/v1/queries/2"]
|
2016-12-06 17:10:26 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"name": "This is my dashboard"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"links": {
|
|
|
|
"self": "/chronograf/v1/dashboards/myid"
|
|
|
|
},
|
|
|
|
"id": "myid",
|
2016-12-07 22:35:58 +00:00
|
|
|
"cells": [
|
2016-12-06 17:10:26 +00:00
|
|
|
{
|
|
|
|
"x": 0,
|
|
|
|
"y": 0,
|
|
|
|
"w": 2,
|
|
|
|
"h": 1,
|
|
|
|
"label": "Objects/Second",
|
|
|
|
"range": {
|
|
|
|
"upper": 100,
|
|
|
|
"lower": 10
|
|
|
|
},
|
2016-12-07 22:35:58 +00:00
|
|
|
"queries": ["/chronograf/v1/queries/1"]
|
2016-12-06 17:10:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"x": 2,
|
|
|
|
"y": 0,
|
|
|
|
"w": 2,
|
|
|
|
"h": 1,
|
|
|
|
"label": "Widgets/Second",
|
|
|
|
"range": {
|
|
|
|
"upper": 10,
|
|
|
|
"lower": 0
|
|
|
|
},
|
2016-12-07 22:35:58 +00:00
|
|
|
"queries": ["/chronograf/v1/queries/2"]
|
2016-12-06 17:10:26 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"name": "This is my dashboard"
|
|
|
|
}
|
|
|
|
]
|
2016-12-05 17:36:12 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
#### GET /dashboards/myid
|
|
|
|
|
2016-12-06 17:22:27 +00:00
|
|
|
Returns an single dashboard object. The fields `x`, `y`, `w`, `h`, default to
|
|
|
|
not existing unless a user has modified the particular cell.
|
2016-12-05 17:36:12 +00:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"links": {
|
|
|
|
"self": "/chronograf/v1/dashboards/myid"
|
|
|
|
},
|
|
|
|
"id": "myid",
|
2016-12-07 22:35:58 +00:00
|
|
|
"cells": [
|
2016-12-06 17:10:26 +00:00
|
|
|
{
|
|
|
|
"x": 0,
|
|
|
|
"y": 0,
|
|
|
|
"w": 2,
|
|
|
|
"h": 1,
|
|
|
|
"label": "Objects/Second",
|
|
|
|
"range": {
|
|
|
|
"upper": 100,
|
|
|
|
"lower": 10
|
|
|
|
},
|
2016-12-07 22:35:58 +00:00
|
|
|
"queries": ["/chronograf/v1/queries/1"]
|
2016-12-06 17:10:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"x": 2,
|
|
|
|
"y": 0,
|
|
|
|
"w": 2,
|
|
|
|
"h": 1,
|
|
|
|
"label": "Widgets/Second",
|
|
|
|
"range": {
|
|
|
|
"upper": 10,
|
|
|
|
"lower": 0
|
|
|
|
},
|
2016-12-07 22:35:58 +00:00
|
|
|
"queries": ["/chronograf/v1/queries/2"]
|
2016-12-06 17:10:26 +00:00
|
|
|
}
|
2016-12-05 17:36:12 +00:00
|
|
|
],
|
2016-12-06 17:10:26 +00:00
|
|
|
"name": "This is my dashboard"
|
2016-12-05 17:36:12 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### PUT /dashboards/myid
|
2016-12-06 17:10:26 +00:00
|
|
|
We want complete updates to the dashboards because we don't know if we can
|
|
|
|
actually incrementally update visualization metadata
|
2016-12-05 17:36:12 +00:00
|
|
|
|
|
|
|
This endpoint will respond with the dashboard after update.
|
|
|
|
|
|
|
|
#### DELETE
|
2016-12-06 17:10:26 +00:00
|
|
|
Removes a dashboard but will not remove the queries. This will lead to orphans.
|
2016-12-05 17:36:12 +00:00
|
|
|
|
2016-12-06 17:10:26 +00:00
|
|
|
Should we have a page that lists all the queries?
|
2016-12-05 17:36:12 +00:00
|
|
|
|
|
|
|
#### POST
|
|
|
|
Creating a dashboard from an exploration would need to be a two-step process
|
|
|
|
|
2016-12-06 17:10:26 +00:00
|
|
|
1. Create a query
|
|
|
|
2. Create dashboard including query link
|
2016-12-05 17:36:12 +00:00
|
|
|
|
2016-12-06 17:10:26 +00:00
|
|
|
### /queries
|
|
|
|
The queries endpoint will be a simple CRUD endpoint storing the raw query:
|
2016-12-05 17:36:12 +00:00
|
|
|
|
2016-12-06 17:10:26 +00:00
|
|
|
```json
|
|
|
|
{
|
|
|
|
"query": "SELECT mean(n_cpu) from cpu GROUP BY time(15m)",
|
|
|
|
"db": "telegraf",
|
|
|
|
"rp": "",
|
|
|
|
"links" : {
|
|
|
|
"self": "/chronograf/v1/queries/1"
|
|
|
|
}
|
|
|
|
}
|
2016-12-05 17:36:12 +00:00
|
|
|
```
|
|
|
|
|
2016-12-06 17:10:26 +00:00
|
|
|
Over time I'd like this queries endpoint to support a `format` parameter to return
|
2016-12-06 17:22:27 +00:00
|
|
|
the query data in different JSON formats such as `QueryConfig`.
|