|
| 1 | +# Dashboard |
| 2 | + |
| 3 | +Without any doubt, this is the principal resource of Perses. |
| 4 | + |
| 5 | +A `Dashboard` belongs to a `Project`. See the [project documentation](./project.md) to see how to create a project. |
| 6 | + |
| 7 | +It is defined like this: |
| 8 | + |
| 9 | +```yaml |
| 10 | +kind: "Dashboard" |
| 11 | +metadata: |
| 12 | + name: <string> |
| 13 | + project: <string> |
| 14 | +spec: <dashboard_specification> |
| 15 | +``` |
| 16 | +
|
| 17 | +## Dashboard specification |
| 18 | +
|
| 19 | +```yaml |
| 20 | +# Metadata.name has some restrictions. For example, you can't use space here. |
| 21 | +# `display` allows to provide a rich name and a description for your dashboard. |
| 22 | +[ display: <Display specification> ] |
| 23 | + |
| 24 | +# `datasources` is a map where the key is the reference of the datasource. The value is the actual datasource definition. |
| 25 | +# A datasource can be referenced by the different panels and/or variables. |
| 26 | +datasources: |
| 27 | + [ <string>: <Datasource specification> ] |
| 28 | + |
| 29 | +# `variables` is the list of dashboard variables. A variable can be referenced by the different panels and/or by other variables. |
| 30 | +variables: |
| 31 | + - [ <Variable specification> ] |
| 32 | + |
| 33 | +# `panels` is a map where the key is the reference of the panel. The value is the actual panel definition that describes |
| 34 | +# the kind of chart this panel is using. A panel can only hold one chart. |
| 35 | +panels: |
| 36 | + [ <string>: <Panel specification> ] |
| 37 | + |
| 38 | +# `layouts` is the list of layouts. A layout describes how to display the list of panels. |
| 39 | +# Indeed, in Perses the definition of a panel is uncorrelated from the definition of where to position it. |
| 40 | +layouts: |
| 41 | + - <Layout specification> |
| 42 | + |
| 43 | +# `duration` is the default time range to use on the initial load of the dashboard. |
| 44 | +[ duration: <duration> ] |
| 45 | + |
| 46 | +# `refreshInterval` is the default refresh interval to use on the initial load of the dashboard. |
| 47 | +[ refreshInterval: <duration> ] |
| 48 | +``` |
| 49 | +
|
| 50 | +A dashboard in its minimal definition only requires a panel and a layout. |
| 51 | +
|
| 52 | +### Display specification |
| 53 | +
|
| 54 | +This is the way to provide a rich name and a description for your dashboard. There is no restriction about the type of |
| 55 | +characters you can use here. |
| 56 | +
|
| 57 | +```yaml |
| 58 | +# The new name of the dashboard. If set, it will replace `metadata.name` in the dashboard title in the UI. |
| 59 | +# Note that it cannot be used when you are querying the API. Only `metadata.name` can be used to reference the dashboard. |
| 60 | +# This is just for display purpose. |
| 61 | +[ name: <string> ] |
| 62 | + |
| 63 | +# The description of the dashboard. |
| 64 | +[ description: <string> ] |
| 65 | +``` |
| 66 | +
|
| 67 | +### Datasource specification |
| 68 | +
|
| 69 | +See the [datasource](./datasource.md) documentation. |
| 70 | +
|
| 71 | +### Variable specification |
| 72 | +
|
| 73 | +See the [variable](./variable.md) documentation. |
| 74 | +
|
| 75 | +### Panel specification |
| 76 | +
|
| 77 | +```yaml |
| 78 | +kind: "Panel" |
| 79 | +spec: |
| 80 | + display: <Display specification> |
| 81 | + |
| 82 | + # `plugin` is where you define the chart type to use. |
| 83 | + # The chart type chosen should match one of the chart plugins known to the Perses instance. |
| 84 | + plugin: <Panel Plugin specification> |
| 85 | + |
| 86 | + # `queries` is the list of queries to be executed by the panel. The available types of query are conditioned by the type of chart & the type of datasource used. |
| 87 | + queries: |
| 88 | + - [ <Query specification> ] |
| 89 | +``` |
| 90 | +
|
| 91 | +#### Panel Plugin specification |
| 92 | +
|
| 93 | +```yaml |
| 94 | +# `kind` is the plugin type of the panel. For example, `TimeSeriesChart`. |
| 95 | +kind: <string> |
| 96 | + |
| 97 | +# `spec` is the actual definition of the panel plugin. Each `kind` comes with its own `spec`. |
| 98 | +spec: <Plugin specification> |
| 99 | +``` |
| 100 | +
|
| 101 | +See the [Panel plugins](../plugins/panels.md) documentation to know more about the different panels supported by Perses. |
| 102 | +
|
| 103 | +#### Query specification |
| 104 | +
|
| 105 | +```yaml |
| 106 | +# kind` is the type of the query. For the moment we only support `TimeSeriesQuery`. |
| 107 | +kind: <string> |
| 108 | +spec: |
| 109 | + plugin: <Query Plugin specification> |
| 110 | +``` |
| 111 | +
|
| 112 | +##### Query Plugin specification |
| 113 | +
|
| 114 | +```yaml |
| 115 | +# `kind` is the plugin type matching the type of query. For example, `PrometheusTimeSeriesQuery` for the query type `TimeSeriesQuery`. |
| 116 | +kind: <string> |
| 117 | + |
| 118 | +# `spec` is the actual definition of the query. Each `kind` comes with its own `spec`. |
| 119 | +spec: <Plugin specification> |
| 120 | +``` |
| 121 | +
|
| 122 | +Perses supports only Prometheus for the `TimeSeriesQuery` for the moment. |
| 123 | +Please look at the [Prometheus documentation](../plugins/prometheus.md#datasource) to know the spec for the `PrometheusTimeSeriesQuery`. |
| 124 | + |
| 125 | +### Layout specification |
| 126 | + |
| 127 | +```yaml |
| 128 | +kind: "Grid" |
| 129 | +spec: |
| 130 | + [ display: <Grid Display specification> ] |
| 131 | + items: |
| 132 | + [ - <Grid Item specification> ] |
| 133 | +``` |
| 134 | + |
| 135 | +Example: |
| 136 | + |
| 137 | +```yaml |
| 138 | +kind: "Grid" |
| 139 | +spec: |
| 140 | + display: |
| 141 | + title: "Row 1" |
| 142 | + collapse: |
| 143 | + open: true |
| 144 | + items: |
| 145 | + - x: 0 |
| 146 | + y: 0 |
| 147 | + width: 2 |
| 148 | + height: 3 |
| 149 | + content: |
| 150 | + "$ref": "#/spec/panels/statRAM" |
| 151 | + - x: 0 |
| 152 | + y: 4 |
| 153 | + width: 2 |
| 154 | + height: 3 |
| 155 | + content: |
| 156 | + $ref": "#/spec/panels/statTotalRAM" |
| 157 | +``` |
| 158 | + |
| 159 | +### Grid Display specification |
| 160 | + |
| 161 | +```yaml |
| 162 | +title: <string> |
| 163 | +collapse: |
| 164 | + open: <boolean> |
| 165 | +``` |
| 166 | + |
| 167 | +### Grid Item specification |
| 168 | + |
| 169 | +```yaml |
| 170 | +x: <int> |
| 171 | +y: <int> |
| 172 | +width: <int> |
| 173 | +height: <int> |
| 174 | +content: |
| 175 | + "$ref": <json_panel_ref> |
| 176 | +``` |
| 177 | + |
| 178 | +## API definition |
| 179 | + |
| 180 | +### Get a list of `Dashboard` |
| 181 | + |
| 182 | +```bash |
| 183 | +GET /api/v1/projects/<project_name>/dasbhoards |
| 184 | +``` |
| 185 | + |
| 186 | +URL query parameters: |
| 187 | + |
| 188 | +- name = `<string>` : filters the list of dashboards based on their name (prefix match). |
| 189 | + |
| 190 | +### Get a single `Dashboard` |
| 191 | + |
| 192 | +```bash |
| 193 | +GET /api/v1/projects/<project_name>/dasbhoards/<dasbhoard_name> |
| 194 | +``` |
| 195 | + |
| 196 | +### Create a single `Dashboard` |
| 197 | + |
| 198 | +```bash |
| 199 | +POST /api/v1/projects/<project_name>/dashboards |
| 200 | +``` |
| 201 | + |
| 202 | +### Update a single `Dashboard` |
| 203 | + |
| 204 | +```bash |
| 205 | +PUT /api/v1/projects/<project_name>/dasbhoards/<dasbhoard_name> |
| 206 | +``` |
| 207 | + |
| 208 | +### Delete a single `Dashboard` |
| 209 | + |
| 210 | +```bash |
| 211 | +DELETE /api/v1/projects/<project_name>/dasbhoards/<dasbhoard_name> |
| 212 | +``` |
0 commit comments