mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Schema: Improve Dashboard kind docs and remove deprecated props (#69359)
Remove unused properties: * `FieldColorModeId.PaletteSaturated`: It doesn't exist and it is not a valid palette. * `VariableModel.rootStateKey`: It is not persisted in the DB, so it shouldn't be in the schema. It is a property only used in the frontend to store the Redux store key. * `VariableModel.error`: It is not persisted in the DB, so it shouldn't be in the schema. It is a property only used in the frontend to store fetching errors. * `Panel.thresholds`: old property only existing in previous versions of the dashboard schema. * `Panel.timeRegions`: old property only existing in previous versions of the dashboard schema.
This commit is contained in:
parent
ae0f94e616
commit
819041c732
@ -864,7 +864,7 @@ exports[`better eslint`] = {
|
||||
"packages/grafana-schema/src/veneer/dashboard.types.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "4"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "5"],
|
||||
|
@ -64,40 +64,43 @@ extraFields is reserved for any fields that are pulled from the API server metad
|
||||
|
||||
### Spec
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|------------------------|---------------------------------------------|----------|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `editable` | boolean | **Yes** | `true` | Whether a dashboard is editable or not. |
|
||||
| `graphTooltip` | integer | **Yes** | `0` | 0 for no shared crosshair or tooltip (default).<br/>1 for shared crosshair.<br/>2 for shared crosshair AND shared tooltip.<br/>Possible values are: `0`, `1`, `2`. |
|
||||
| `schemaVersion` | uint16 | **Yes** | `36` | Version of the JSON schema, incremented each time a Grafana update brings<br/>changes to said schema.<br/>TODO this is the existing schema numbering system. It will be replaced by Thema's themaVersion |
|
||||
| `style` | string | **Yes** | `dark` | Theme of dashboard.<br/>Possible values are: `dark`, `light`. |
|
||||
| `annotations` | [AnnotationContainer](#annotationcontainer) | No | | TODO -- should not be a public interface on its own, but required for Veneer |
|
||||
| `description` | string | No | | Description of dashboard. |
|
||||
| `fiscalYearStartMonth` | integer | No | `0` | The month that the fiscal year starts on. 0 = January, 11 = December<br/>Constraint: `>=0 & <12`. |
|
||||
| `gnetId` | string | No | | ID of a dashboard imported from the https://grafana.com/grafana/dashboards/ portal |
|
||||
| `id` | integer | No | | Unique numeric identifier for the dashboard.<br/>TODO must isolate or remove identifiers local to a Grafana instance...? |
|
||||
| `links` | [DashboardLink](#dashboardlink)[] | No | | Links with references to other dashboards or external websites. |
|
||||
| `liveNow` | boolean | No | | When set to true, the dashboard will redraw panels at an interval matching the pixel width.<br/>This will keep data "moving left" regardless of the query refresh rate. This setting helps<br/>avoid dashboards presenting stale live data |
|
||||
| `panels` | [object](#panels)[] | No | | |
|
||||
| `refresh` | | No | | Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d". |
|
||||
| `revision` | integer | No | | This property should only be used in dashboards defined by plugins. It is a quick check<br/>to see if the version has changed since the last time. Unclear why using the version property<br/>is insufficient. |
|
||||
| `snapshot` | [Snapshot](#snapshot) | No | | A dashboard snapshot shares an interactive dashboard publicly.<br/>It is a read-only version of a dashboard, and is not editable.<br/>It is possible to create a snapshot of a snapshot.<br/>Grafana strips away all sensitive information from the dashboard.<br/>Sensitive information stripped: queries (metric, template,annotation) and panel links. |
|
||||
| `tags` | string[] | No | | Tags associated with dashboard. |
|
||||
| `templating` | [object](#templating) | No | | Contains the list of configured template variables with their saved values along with some other metadata |
|
||||
| `time` | [object](#time) | No | | Time range for dashboard.<br/>Accepted values are relative time strings like {from: 'now-6h', to: 'now'} or absolute time strings like {from: '2020-07-10T08:00:00.000Z', to: '2020-07-10T14:00:00.000Z'}. |
|
||||
| `timepicker` | [object](#timepicker) | No | | Configuration of the time picker shown at the top of a dashboard. |
|
||||
| `timezone` | string | No | `browser` | Timezone of dashboard. Accepted values are IANA TZDB zone ID or "browser" or "utc". |
|
||||
| `title` | string | No | | Title of dashboard. |
|
||||
| `uid` | string | No | | Unique dashboard identifier that can be generated by anyone. string (8-40) |
|
||||
| `version` | uint32 | No | | Version of the dashboard, incremented each time the dashboard is updated. |
|
||||
| `weekStart` | string | No | | Day when the week starts. Expressed by the name of the day in lowercase, e.g. "monday". |
|
||||
| Property | Type | Required | Default | Description |
|
||||
|------------------------|---------------------------------------------|----------|-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `editable` | boolean | **Yes** | `true` | Whether a dashboard is editable or not. |
|
||||
| `graphTooltip` | integer | **Yes** | `0` | 0 for no shared crosshair or tooltip (default).<br/>1 for shared crosshair.<br/>2 for shared crosshair AND shared tooltip.<br/>Possible values are: `0`, `1`, `2`. |
|
||||
| `schemaVersion` | uint16 | **Yes** | `36` | Version of the JSON schema, incremented each time a Grafana update brings<br/>changes to said schema. |
|
||||
| `style` | string | **Yes** | `dark` | Theme of dashboard.<br/>Default value: dark.<br/>Possible values are: `dark`, `light`. |
|
||||
| `annotations` | [AnnotationContainer](#annotationcontainer) | No | | Contains the list of annotations that are associated with the dashboard.<br/>Annotations are used to overlay event markers and overlay event tags on graphs.<br/>Grafana comes with a native annotation store and the ability to add annotation events directly from the graph panel or via the HTTP API.<br/>See https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/annotate-visualizations/ |
|
||||
| `description` | string | No | | Description of dashboard. |
|
||||
| `fiscalYearStartMonth` | integer | No | `0` | The month that the fiscal year starts on. 0 = January, 11 = December<br/>Constraint: `>=0 & <12`. |
|
||||
| `gnetId` | string | No | | ID of a dashboard imported from the https://grafana.com/grafana/dashboards/ portal |
|
||||
| `id` | integer | No | | Unique numeric identifier for the dashboard.<br/>`id` is internal to a specific Grafana instance. `uid` should be used to identify a dashboard across Grafana instances. |
|
||||
| `links` | [DashboardLink](#dashboardlink)[] | No | | Links with references to other dashboards or external websites. |
|
||||
| `liveNow` | boolean | No | | When set to true, the dashboard will redraw panels at an interval matching the pixel width.<br/>This will keep data "moving left" regardless of the query refresh rate. This setting helps<br/>avoid dashboards presenting stale live data |
|
||||
| `panels` | [object](#panels)[] | No | | List of dashboard panels |
|
||||
| `refresh` | | No | | Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d". |
|
||||
| `revision` | integer | No | | This property should only be used in dashboards defined by plugins. It is a quick check<br/>to see if the version has changed since the last time. |
|
||||
| `snapshot` | [Snapshot](#snapshot) | No | | A dashboard snapshot shares an interactive dashboard publicly.<br/>It is a read-only version of a dashboard, and is not editable.<br/>It is possible to create a snapshot of a snapshot.<br/>Grafana strips away all sensitive information from the dashboard.<br/>Sensitive information stripped: queries (metric, template,annotation) and panel links. |
|
||||
| `tags` | string[] | No | | Tags associated with dashboard. |
|
||||
| `templating` | [object](#templating) | No | | Configured template variables |
|
||||
| `time` | [object](#time) | No | | Time range for dashboard.<br/>Accepted values are relative time strings like {from: 'now-6h', to: 'now'} or absolute time strings like {from: '2020-07-10T08:00:00.000Z', to: '2020-07-10T14:00:00.000Z'}. |
|
||||
| `timepicker` | [object](#timepicker) | No | | Configuration of the time picker shown at the top of a dashboard. |
|
||||
| `timezone` | string | No | `browser` | Timezone of dashboard. Accepted values are IANA TZDB zone ID or "browser" or "utc". |
|
||||
| `title` | string | No | | Title of dashboard. |
|
||||
| `uid` | string | No | | Unique dashboard identifier that can be generated by anyone. string (8-40) |
|
||||
| `version` | uint32 | No | | Version of the dashboard, incremented each time the dashboard is updated. |
|
||||
| `weekStart` | string | No | | Day when the week starts. Expressed by the name of the day in lowercase, e.g. "monday". |
|
||||
|
||||
### AnnotationContainer
|
||||
|
||||
TODO -- should not be a public interface on its own, but required for Veneer
|
||||
Contains the list of annotations that are associated with the dashboard.
|
||||
Annotations are used to overlay event markers and overlay event tags on graphs.
|
||||
Grafana comes with a native annotation store and the ability to add annotation events directly from the graph panel or via the HTTP API.
|
||||
See https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/annotate-visualizations/
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|---------------------------------------|----------|---------|-------------|
|
||||
| `list` | [AnnotationQuery](#annotationquery)[] | No | | |
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|---------------------------------------|----------|---------|---------------------|
|
||||
| `list` | [AnnotationQuery](#annotationquery)[] | No | | List of annotations |
|
||||
|
||||
### AnnotationQuery
|
||||
|
||||
@ -190,78 +193,91 @@ Sensitive information stripped: queries (metric, template,annotation) and panel
|
||||
|
||||
### DataTransformerConfig
|
||||
|
||||
TODO docs
|
||||
Transformations allow to manipulate data returned by a query before the system applies a visualization.
|
||||
Using transformations you can: rename fields, join time series data, perform mathematical operations across queries,
|
||||
use the output of one transformation as the input to another transformation, etc.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|------------|---------------------------------|----------|---------|----------------------------------------------------------------------------------------|
|
||||
| `id` | string | **Yes** | | Unique identifier of transformer |
|
||||
| `options` | | **Yes** | | Options to be passed to the transformer<br/>Valid options depend on the transformer id |
|
||||
| `disabled` | boolean | No | | Disabled transformations are skipped |
|
||||
| `filter` | [MatcherConfig](#matcherconfig) | No | | |
|
||||
| Property | Type | Required | Default | Description |
|
||||
|------------|---------------------------------|----------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `id` | string | **Yes** | | Unique identifier of transformer |
|
||||
| `options` | | **Yes** | | Options to be passed to the transformer<br/>Valid options depend on the transformer id |
|
||||
| `disabled` | boolean | No | | Disabled transformations are skipped |
|
||||
| `filter` | [MatcherConfig](#matcherconfig) | No | | Matcher is a predicate configuration. Based on the config a set of field(s) or values is filtered in order to apply override / transformation.<br/>It comes with in id ( to resolve implementation from registry) and a configuration that’s specific to a particular matcher type. |
|
||||
|
||||
### MatcherConfig
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-----------|--------|----------|---------|-------------|
|
||||
| `id` | string | **Yes** | `` | |
|
||||
| `options` | | No | | |
|
||||
Matcher is a predicate configuration. Based on the config a set of field(s) or values is filtered in order to apply override / transformation.
|
||||
It comes with in id ( to resolve implementation from registry) and a configuration that’s specific to a particular matcher type.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-----------|--------|----------|---------|--------------------------------------------------------------------------------|
|
||||
| `id` | string | **Yes** | `` | The matcher id. This is used to find the matcher implementation from registry. |
|
||||
| `options` | | No | | The matcher options. This is specific to the matcher implementation. |
|
||||
|
||||
### FieldConfigSource
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-------------|-----------------------------|----------|---------|-------------|
|
||||
| `defaults` | [FieldConfig](#fieldconfig) | **Yes** | | |
|
||||
| `overrides` | [object](#overrides)[] | **Yes** | | |
|
||||
The data model used in Grafana, namely the data frame, is a columnar-oriented table structure that unifies both time series and table query results.
|
||||
Each column within this structure is called a field. A field can represent a single time series or table column.
|
||||
Field options allow you to change how the data is displayed in your visualizations.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-------------|-----------------------------|----------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `defaults` | [FieldConfig](#fieldconfig) | **Yes** | | The data model used in Grafana, namely the data frame, is a columnar-oriented table structure that unifies both time series and table query results.<br/>Each column within this structure is called a field. A field can represent a single time series or table column.<br/>Field options allow you to change how the data is displayed in your visualizations. |
|
||||
| `overrides` | [object](#overrides)[] | **Yes** | | Overrides are the options applied to specific fields overriding the defaults. |
|
||||
|
||||
### FieldConfig
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|---------------------|---------------------------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `color` | [FieldColor](#fieldcolor) | No | | TODO docs |
|
||||
| `custom` | [object](#custom) | No | | custom is specified by the FieldConfig field<br/>in panel plugin schemas. |
|
||||
| `decimals` | number | No | | Significant digits (for display) |
|
||||
| `description` | string | No | | Human readable field metadata |
|
||||
| `displayNameFromDS` | string | No | | This can be used by data sources that return and explicit naming structure for values and labels<br/>When this property is configured, this value is used rather than the default naming strategy. |
|
||||
| `displayName` | string | No | | The display value for this field. This supports template variables blank is auto |
|
||||
| `filterable` | boolean | No | | True if data source field supports ad-hoc filters |
|
||||
| `links` | | No | | The behavior when clicking on a result |
|
||||
| `mappings` | [ValueMapping](#valuemapping)[] | No | | Convert input values into a display string |
|
||||
| `max` | number | No | | |
|
||||
| `min` | number | No | | |
|
||||
| `noValue` | string | No | | Alternative to empty string |
|
||||
| `path` | string | No | | An explicit path to the field in the datasource. When the frame meta includes a path,<br/>This will default to `${frame.meta.path}/${field.name}<br/><br/>When defined, this value can be used as an identifier within the datasource scope, and<br/>may be used to update the results |
|
||||
| `thresholds` | [ThresholdsConfig](#thresholdsconfig) | No | | |
|
||||
| `unit` | string | No | | Numeric Options |
|
||||
| `writeable` | boolean | No | | True if data source can write a value to the path. Auth/authz are supported separately |
|
||||
The data model used in Grafana, namely the data frame, is a columnar-oriented table structure that unifies both time series and table query results.
|
||||
Each column within this structure is called a field. A field can represent a single time series or table column.
|
||||
Field options allow you to change how the data is displayed in your visualizations.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|---------------------|---------------------------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `color` | [FieldColor](#fieldcolor) | No | | Map a field to a color. |
|
||||
| `custom` | [object](#custom) | No | | custom is specified by the FieldConfig field<br/>in panel plugin schemas. |
|
||||
| `decimals` | number | No | | Specify the number of decimals Grafana includes in the rendered value.<br/>If you leave this field blank, Grafana automatically truncates the number of decimals based on the value.<br/>For example 1.1234 will display as 1.12 and 100.456 will display as 100.<br/>To display all decimals, set the unit to `String`. |
|
||||
| `description` | string | No | | Human readable field metadata |
|
||||
| `displayNameFromDS` | string | No | | This can be used by data sources that return and explicit naming structure for values and labels<br/>When this property is configured, this value is used rather than the default naming strategy. |
|
||||
| `displayName` | string | No | | The display value for this field. This supports template variables blank is auto |
|
||||
| `filterable` | boolean | No | | True if data source field supports ad-hoc filters |
|
||||
| `links` | | No | | The behavior when clicking on a result |
|
||||
| `mappings` | [ValueMapping](#valuemapping)[] | No | | Convert input values into a display string |
|
||||
| `max` | number | No | | The maximum value used in percentage threshold calculations. Leave blank for auto calculation based on all series and fields. |
|
||||
| `min` | number | No | | The minimum value used in percentage threshold calculations. Leave blank for auto calculation based on all series and fields. |
|
||||
| `noValue` | string | No | | Alternative to empty string |
|
||||
| `path` | string | No | | An explicit path to the field in the datasource. When the frame meta includes a path,<br/>This will default to `${frame.meta.path}/${field.name}<br/><br/>When defined, this value can be used as an identifier within the datasource scope, and<br/>may be used to update the results |
|
||||
| `thresholds` | [ThresholdsConfig](#thresholdsconfig) | No | | Thresholds configuration for the panel |
|
||||
| `unit` | string | No | | Unit a field should use. The unit you select is applied to all fields except time.<br/>You can use the units ID availables in Grafana or a custom unit.<br/>Available units in Grafana: https://github.com/grafana/grafana/blob/main/packages/grafana-data/src/valueFormats/categories.ts<br/>As custom unit, you can use the following formats:<br/>`suffix:<suffix>` for custom unit that should go after value.<br/>`prefix:<prefix>` for custom unit that should go before value.<br/>`time:<format>` For custom date time formats type for example `time:YYYY-MM-DD`.<br/>`si:<base scale><unit characters>` for custom SI units. For example: `si: mF`. This one is a bit more advanced as you can specify both a unit and the source data scale. So if your source data is represented as milli (thousands of) something prefix the unit with that SI scale character.<br/>`count:<unit>` for a custom count unit.<br/>`currency:<unit>` for custom a currency unit. |
|
||||
| `writeable` | boolean | No | | True if data source can write a value to the path. Auth/authz are supported separately |
|
||||
|
||||
### FieldColor
|
||||
|
||||
TODO docs
|
||||
Map a field to a color.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|--------------|--------|----------|---------|----------------------------------------------------------|
|
||||
| `mode` | string | **Yes** | | The main color scheme mode |
|
||||
| `fixedColor` | string | No | | Stores the fixed color value if mode is fixed |
|
||||
| `seriesBy` | string | No | | TODO docs<br/>Possible values are: `min`, `max`, `last`. |
|
||||
| Property | Type | Required | Default | Description |
|
||||
|--------------|--------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `mode` | string | **Yes** | | Color mode for a field. You can specify a single color, or select a continuous (gradient) color schemes, based on a value.<br/>Continuous color interpolates a color using the percentage of a value relative to min and max.<br/>Accepted values are:<br/>`thresholds`: From thresholds. Informs Grafana to take the color from the matching threshold<br/>`palette-classic`: Classic palette. Grafana will assign color by looking up a color in a palette by series index. Useful for Graphs and pie charts and other categorical data visualizations<br/>`palette-classic-by-name`: Classic palette (by name). Grafana will assign color by looking up a color in a palette by series name. Useful for Graphs and pie charts and other categorical data visualizations<br/>`continuous-GrYlRd`: ontinuous Green-Yellow-Red palette mode<br/>`continuous-RdYlGr`: Continuous Red-Yellow-Green palette mode<br/>`continuous-BlYlRd`: Continuous Blue-Yellow-Red palette mode<br/>`continuous-YlRd`: Continuous Yellow-Red palette mode<br/>`continuous-BlPu`: Continuous Blue-Purple palette mode<br/>`continuous-YlBl`: Continuous Yellow-Blue palette mode<br/>`continuous-blues`: Continuous Blue palette mode<br/>`continuous-reds`: Continuous Red palette mode<br/>`continuous-greens`: Continuous Green palette mode<br/>`continuous-purples`: Continuous Purple palette mode<br/>`shades`: Shades of a single color. Specify a single color, useful in an override rule.<br/>`fixed`: Fixed color mode. Specify a single color, useful in an override rule.<br/>Possible values are: `thresholds`, `palette-classic`, `palette-classic-by-name`, `continuous-GrYlRd`, `continuous-RdYlGr`, `continuous-BlYlRd`, `continuous-YlRd`, `continuous-BlPu`, `continuous-YlBl`, `continuous-blues`, `continuous-reds`, `continuous-greens`, `continuous-purples`, `fixed`, `shades`. |
|
||||
| `fixedColor` | string | No | | The fixed color value for fixed or shades color modes. |
|
||||
| `seriesBy` | string | No | | Defines how to assign a series color from "by value" color schemes. For example for an aggregated data points like a timeseries, the color can be assigned by the min, max or last value.<br/>Possible values are: `min`, `max`, `last`. |
|
||||
|
||||
### ThresholdsConfig
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|---------------------------|----------|---------|------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `mode` | string | **Yes** | | Thresholds can either be absolute (specific number) or percentage (relative to min or max).<br/>Possible values are: `absolute`, `percentage`. |
|
||||
| `steps` | [Threshold](#threshold)[] | **Yes** | | Must be sorted by 'value', first value is always -Infinity |
|
||||
Thresholds configuration for the panel
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|---------------------------|----------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `mode` | string | **Yes** | | Thresholds can either be `absolute` (specific number) or `percentage` (relative to min or max, it will be values between 0 and 1).<br/>Possible values are: `absolute`, `percentage`. |
|
||||
| `steps` | [Threshold](#threshold)[] | **Yes** | | Must be sorted by 'value', first value is always -Infinity |
|
||||
|
||||
### Threshold
|
||||
|
||||
User-defined value for a metric that triggers visual changes in a panel when this value is met or exceeded
|
||||
They are used to conditionally style and color visualizations based on query results , and can be applied to most visualizations.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|---------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `color` | string | **Yes** | | Color represents the color of the visual change that will occur in the dashboard when the threshold value is met or exceeded. |
|
||||
| `index` | integer | No | | Threshold index, an old property that is not needed an should only appear in older dashboards |
|
||||
| `state` | string | No | | TODO docs<br/>TODO are the values here enumerable into a disjunction?<br/>Some seem to be listed in typescript comment |
|
||||
| `value` | number | No | | Value represents a specified metric for the threshold, which triggers a visual change in the dashboard when this value is met or exceeded.<br/>FIXME the corresponding typescript field is required/non-optional, but nulls currently appear here when serializing -Infinity to JSON |
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|--------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `color` | string | **Yes** | | Color represents the color of the visual change that will occur in the dashboard when the threshold value is met or exceeded. |
|
||||
| `value` | number | **Yes** | | Value represents a specified metric for the threshold, which triggers a visual change in the dashboard when this value is met or exceeded.<br/>Nulls currently appear here when serializing -Infinity to JSON. |
|
||||
|
||||
### ValueMapping
|
||||
|
||||
@ -273,52 +289,59 @@ Allow to transform the visual representation of specific data values in a visual
|
||||
|
||||
### RangeMap
|
||||
|
||||
Maps numeric ranges to a color or different display text
|
||||
Maps numerical ranges to a display text and color.
|
||||
For example, if a value is within a certain range, you can configure a range value mapping to display Low or High rather than the number.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-----------|--------------------|----------|---------|-------------|
|
||||
| `options` | [object](#options) | **Yes** | | |
|
||||
| `type` | string | **Yes** | | |
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-----------|--------------------|----------|---------|-----------------------------------------------------------------------------------|
|
||||
| `options` | [object](#options) | **Yes** | | Range to match against and the result to apply when the value is within the range |
|
||||
| `type` | string | **Yes** | | |
|
||||
|
||||
### Options
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|-------------------------------------------|----------|---------|--------------------------------------------------------------------------------|
|
||||
| `from` | number | **Yes** | | to and from are `number | null` in current ts, really not sure what to do |
|
||||
| `result` | [ValueMappingResult](#valuemappingresult) | **Yes** | | Result used as replacement text and color for RegexMap and SpecialValueMap |
|
||||
| `to` | number | **Yes** | | |
|
||||
Range to match against and the result to apply when the value is within the range
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|-------------------------------------------|----------|---------|-----------------------------------------------------------------------|
|
||||
| `from` | number | **Yes** | | Min value of the range. It can be null which means -Infinity |
|
||||
| `result` | [ValueMappingResult](#valuemappingresult) | **Yes** | | Result used as replacement with text and color when the value matches |
|
||||
| `to` | number | **Yes** | | Max value of the range. It can be null which means +Infinity |
|
||||
|
||||
### ValueMappingResult
|
||||
|
||||
Result used as replacement text and color for RegexMap and SpecialValueMap
|
||||
Result used as replacement with text and color when the value matches
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|---------|----------|---------|-------------|
|
||||
| `color` | string | No | | |
|
||||
| `icon` | string | No | | |
|
||||
| `index` | integer | No | | |
|
||||
| `text` | string | No | | |
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|---------|----------|---------|-----------------------------------------------------------------------|
|
||||
| `color` | string | No | | Text to use when the value matches |
|
||||
| `icon` | string | No | | Icon to display when the value matches. Only specific visualizations. |
|
||||
| `index` | integer | No | | Position in the mapping array. Only used internally. |
|
||||
| `text` | string | No | | Text to display when the value matches |
|
||||
|
||||
### RegexMap
|
||||
|
||||
Maps regular expressions to replacement text and a color
|
||||
Maps regular expressions to replacement text and a color.
|
||||
For example, if a value is www.example.com, you can configure a regex value mapping so that Grafana displays www and truncates the domain.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-----------|--------------------|----------|---------|-------------|
|
||||
| `options` | [object](#options) | **Yes** | | |
|
||||
| `type` | string | **Yes** | | |
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-----------|--------------------|----------|---------|----------------------------------------------------------------------------------------------|
|
||||
| `options` | [object](#options) | **Yes** | | Regular expression to match against and the result to apply when the value matches the regex |
|
||||
| `type` | string | **Yes** | | |
|
||||
|
||||
### Options
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-----------|-------------------------------------------|----------|---------|----------------------------------------------------------------------------|
|
||||
| `pattern` | string | **Yes** | | |
|
||||
| `result` | [ValueMappingResult](#valuemappingresult) | **Yes** | | Result used as replacement text and color for RegexMap and SpecialValueMap |
|
||||
Regular expression to match against and the result to apply when the value matches the regex
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-----------|-------------------------------------------|----------|---------|-----------------------------------------------------------------------|
|
||||
| `pattern` | string | **Yes** | | Regular expression to match against |
|
||||
| `result` | [ValueMappingResult](#valuemappingresult) | **Yes** | | Result used as replacement with text and color when the value matches |
|
||||
|
||||
### SpecialValueMap
|
||||
|
||||
Maps special values like Null, NaN (not a number), and boolean values like true and false to a display text
|
||||
and color
|
||||
Maps special values like Null, NaN (not a number), and boolean values like true and false to a display text and color.
|
||||
See SpecialValueMatch to see the list of special values.
|
||||
For example, you can configure a special value mapping so that null values appear as N/A.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-----------|--------------------|----------|---------|-------------|
|
||||
@ -327,20 +350,20 @@ and color
|
||||
|
||||
### Options
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-----------|-------------------------------------------|----------|---------|----------------------------------------------------------------------------|
|
||||
| `match` | string | **Yes** | | Possible values are: `true`, `false`. |
|
||||
| `pattern` | string | **Yes** | | |
|
||||
| `result` | [ValueMappingResult](#valuemappingresult) | **Yes** | | Result used as replacement text and color for RegexMap and SpecialValueMap |
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|-------------------------------------------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `match` | string | **Yes** | | Special value types supported by the `SpecialValueMap`<br/>Possible values are: `true`, `false`, `null`, `nan`, `null+nan`, `empty`. |
|
||||
| `result` | [ValueMappingResult](#valuemappingresult) | **Yes** | | Result used as replacement with text and color when the value matches |
|
||||
|
||||
### ValueMap
|
||||
|
||||
Maps text values to a color or different display text
|
||||
Maps text values to a color or different display text and color.
|
||||
For example, you can configure a value mapping so that all instances of the value 10 appear as Perfection! rather than the number.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-----------|------------------------------------------------------|----------|---------|-------------|
|
||||
| `options` | map[string][ValueMappingResult](#valuemappingresult) | **Yes** | | |
|
||||
| `type` | string | **Yes** | | |
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-----------|------------------------------------------------------|----------|---------|---------------------------------------------------------------------------------------------------------------|
|
||||
| `options` | map[string][ValueMappingResult](#valuemappingresult) | **Yes** | | Map with <value_to_match>: ValueMappingResult. For example: { "10": { text: "Perfection!", color: "green" } } |
|
||||
| `type` | string | **Yes** | | |
|
||||
|
||||
### Custom
|
||||
|
||||
@ -352,10 +375,10 @@ in panel plugin schemas.
|
||||
|
||||
### Overrides
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|--------------|---------------------------------------------|----------|---------|-------------|
|
||||
| `matcher` | [MatcherConfig](#matcherconfig) | **Yes** | | |
|
||||
| `properties` | [DynamicConfigValue](#dynamicconfigvalue)[] | **Yes** | | |
|
||||
| Property | Type | Required | Default | Description |
|
||||
|--------------|---------------------------------------------|----------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `matcher` | [MatcherConfig](#matcherconfig) | **Yes** | | Matcher is a predicate configuration. Based on the config a set of field(s) or values is filtered in order to apply override / transformation.<br/>It comes with in id ( to resolve implementation from registry) and a configuration that’s specific to a particular matcher type. |
|
||||
| `properties` | [DynamicConfigValue](#dynamicconfigvalue)[] | **Yes** | | |
|
||||
|
||||
### DynamicConfigValue
|
||||
|
||||
@ -366,7 +389,8 @@ in panel plugin schemas.
|
||||
|
||||
### GraphPanel
|
||||
|
||||
Support for legacy graph and heatmap panels.
|
||||
Support for legacy graph panel.
|
||||
@deprecated this a deprecated panel type
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|-------------------|----------|---------|----------------------------------------------------|
|
||||
@ -385,110 +409,126 @@ Support for legacy graph and heatmap panels.
|
||||
|
||||
### GridPos
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|---------|----------|---------|--------------------------------------------|
|
||||
| `h` | uint32 | **Yes** | `9` | Panel |
|
||||
| `w` | integer | **Yes** | `12` | Panel<br/>Constraint: `>0 & <=24`. |
|
||||
| `x` | integer | **Yes** | `0` | Panel x<br/>Constraint: `>=0 & <24`. |
|
||||
| `y` | uint32 | **Yes** | `0` | Panel y |
|
||||
| `static` | boolean | No | | Whether the panel is fixed within the grid |
|
||||
Position and dimensions of a panel in the grid
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|---------|----------|---------|-------------------------------------------------------------------------------------------------------------------|
|
||||
| `h` | uint32 | **Yes** | `9` | Panel height. The height is the number of rows from the top edge of the panel. |
|
||||
| `w` | integer | **Yes** | `12` | Panel width. The width is the number of columns from the left edge of the panel.<br/>Constraint: `>0 & <=24`. |
|
||||
| `x` | integer | **Yes** | `0` | Panel x. The x coordinate is the number of columns from the left edge of the grid<br/>Constraint: `>=0 & <24`. |
|
||||
| `y` | uint32 | **Yes** | `0` | Panel y. The y coordinate is the number of rows from the top edge of the grid |
|
||||
| `static` | boolean | No | | Whether the panel is fixed within the grid. If true, the panel will not be affected by other panels' interactions |
|
||||
|
||||
### HeatmapPanel
|
||||
|
||||
Support for legacy heatmap panel.
|
||||
@deprecated this a deprecated panel type
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|--------|----------|---------|---------------------------------|
|
||||
| `type` | string | **Yes** | | Possible values are: `heatmap`. |
|
||||
|
||||
### LibraryPanelRef
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|--------|----------|---------|-------------|
|
||||
| `name` | string | **Yes** | | |
|
||||
| `uid` | string | **Yes** | | |
|
||||
A library panel is a reusable panel that you can use in any dashboard.
|
||||
When you make a change to a library panel, that change propagates to all instances of where the panel is used.
|
||||
Library panels streamline reuse of panels across multiple dashboards.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|--------|----------|---------|--------------------|
|
||||
| `name` | string | **Yes** | | Library panel name |
|
||||
| `uid` | string | **Yes** | | Library panel uid |
|
||||
|
||||
### Panel
|
||||
|
||||
Dashboard panels. Panels are canonically defined inline
|
||||
because they share a version timeline with the dashboard
|
||||
schema; they do not evolve independently.
|
||||
Dashboard panels are the basic visualization building blocks.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-------------------|---------------------------------------------------|----------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `fieldConfig` | [FieldConfigSource](#fieldconfigsource) | **Yes** | | |
|
||||
| `options` | [object](#options) | **Yes** | | options is specified by the Options field in panel<br/>plugin schemas. |
|
||||
| `repeatDirection` | string | **Yes** | `h` | Direction to repeat in if 'repeat' is set.<br/>"h" for horizontal, "v" for vertical.<br/>TODO this is probably optional<br/>Possible values are: `h`, `v`. |
|
||||
| `transformations` | [DataTransformerConfig](#datatransformerconfig)[] | **Yes** | | |
|
||||
| `fieldConfig` | [FieldConfigSource](#fieldconfigsource) | **Yes** | | The data model used in Grafana, namely the data frame, is a columnar-oriented table structure that unifies both time series and table query results.<br/>Each column within this structure is called a field. A field can represent a single time series or table column.<br/>Field options allow you to change how the data is displayed in your visualizations. |
|
||||
| `options` | [object](#options) | **Yes** | | It depends on the panel plugin. They are specified by the Options field in panel plugin schemas. |
|
||||
| `transformations` | [DataTransformerConfig](#datatransformerconfig)[] | **Yes** | | List of transformations that are applied to the panel data before rendering.<br/>When there are multiple transformations, Grafana applies them in the order they are listed.<br/>Each transformation creates a result set that then passes on to the next transformation in the processing pipeline. |
|
||||
| `transparent` | boolean | **Yes** | `false` | Whether to display the panel without a background. |
|
||||
| `type` | string | **Yes** | | The panel plugin type id. May not be empty.<br/>Constraint: `length >=1`. |
|
||||
| `datasource` | [object](#datasource) | No | | The datasource used in all targets. |
|
||||
| `description` | string | No | | Description. |
|
||||
| `gridPos` | [GridPos](#gridpos) | No | | |
|
||||
| `id` | uint32 | No | | TODO docs |
|
||||
| `type` | string | **Yes** | | The panel plugin type id. This is used to find the plugin to display the panel.<br/>Constraint: `length >=1`. |
|
||||
| `datasource` | [DataSourceRef](#datasourceref) | No | | Ref to a DataSource instance |
|
||||
| `description` | string | No | | Panel description. |
|
||||
| `gridPos` | [GridPos](#gridpos) | No | | Position and dimensions of a panel in the grid |
|
||||
| `id` | uint32 | No | | Unique identifier of the panel. Generated by Grafana when creating a new panel. It must be unique within a dashboard, but not globally. |
|
||||
| `interval` | string | No | | The min time interval setting defines a lower limit for the $__interval and $__interval_ms variables.<br/>This value must be formatted as a number followed by a valid time<br/>identifier like: "40s", "3d", etc.<br/>See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
|
||||
| `libraryPanel` | [LibraryPanelRef](#librarypanelref) | No | | |
|
||||
| `links` | [DashboardLink](#dashboardlink)[] | No | | Panel links.<br/>TODO fill this out - seems there are a couple variants? |
|
||||
| `libraryPanel` | [LibraryPanelRef](#librarypanelref) | No | | A library panel is a reusable panel that you can use in any dashboard.<br/>When you make a change to a library panel, that change propagates to all instances of where the panel is used.<br/>Library panels streamline reuse of panels across multiple dashboards. |
|
||||
| `links` | [DashboardLink](#dashboardlink)[] | No | | Panel links. |
|
||||
| `maxDataPoints` | number | No | | The maximum number of data points that the panel queries are retrieving. |
|
||||
| `pluginVersion` | string | No | | FIXME this almost certainly has to be changed in favor of scuemata versions |
|
||||
| `pluginVersion` | string | No | | The version of the plugin that is used for this panel. This is used to find the plugin to display the panel and to migrate old panel configs. |
|
||||
| `repeatDirection` | string | No | `h` | Direction to repeat in if 'repeat' is set.<br/>`h` for horizontal, `v` for vertical.<br/>Possible values are: `h`, `v`. |
|
||||
| `repeatPanelId` | integer | No | | Id of the repeating panel. |
|
||||
| `repeat` | string | No | | Name of template variable to repeat for. |
|
||||
| `tags` | string[] | No | | TODO docs |
|
||||
| `targets` | [Target](#target)[] | No | | TODO docs |
|
||||
| `thresholds` | | No | | TODO docs - seems to be an old field from old dashboard alerts? |
|
||||
| `tags` | string[] | No | | Tags for the panel. |
|
||||
| `targets` | [Target](#target)[] | No | | Depends on the panel plugin. See the plugin documentation for details. |
|
||||
| `timeFrom` | string | No | | Overrides the relative time range for individual panels,<br/>which causes them to be different than what is selected in<br/>the dashboard time picker in the top-right corner of the dashboard. You can use this to show metrics from different<br/>time periods or days on the same dashboard.<br/>The value is formatted as time operation like: `now-5m` (Last 5 minutes), `now/d` (the day so far),<br/>`now-5d/d`(Last 5 days), `now/w` (This week so far), `now-2y/y` (Last 2 years).<br/>Note: Panel time overrides have no effect when the dashboard’s time range is absolute.<br/>See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
|
||||
| `timeRegions` | | No | | TODO docs |
|
||||
| `timeShift` | string | No | | Overrides the time range for individual panels by shifting its start and end relative to the time picker.<br/>For example, you can shift the time range for the panel to be two hours earlier than the dashboard time picker setting `2h`.<br/>Note: Panel time overrides have no effect when the dashboard’s time range is absolute.<br/>See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
|
||||
| `title` | string | No | | Panel title. |
|
||||
|
||||
### FieldConfigSource
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-------------|-----------------------------|----------|---------|-------------|
|
||||
| `defaults` | [FieldConfig](#fieldconfig) | **Yes** | | |
|
||||
| `overrides` | [overrides](#overrides)[] | **Yes** | | |
|
||||
The data model used in Grafana, namely the data frame, is a columnar-oriented table structure that unifies both time series and table query results.
|
||||
Each column within this structure is called a field. A field can represent a single time series or table column.
|
||||
Field options allow you to change how the data is displayed in your visualizations.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-------------|-----------------------------|----------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `defaults` | [FieldConfig](#fieldconfig) | **Yes** | | The data model used in Grafana, namely the data frame, is a columnar-oriented table structure that unifies both time series and table query results.<br/>Each column within this structure is called a field. A field can represent a single time series or table column.<br/>Field options allow you to change how the data is displayed in your visualizations. |
|
||||
| `overrides` | [overrides](#overrides)[] | **Yes** | | Overrides are the options applied to specific fields overriding the defaults. |
|
||||
|
||||
### FieldConfig
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|---------------------|---------------------------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `color` | [FieldColor](#fieldcolor) | No | | TODO docs |
|
||||
| `custom` | [custom](#custom) | No | | custom is specified by the FieldConfig field<br/>in panel plugin schemas. |
|
||||
| `decimals` | number | No | | Significant digits (for display) |
|
||||
| `description` | string | No | | Human readable field metadata |
|
||||
| `displayNameFromDS` | string | No | | This can be used by data sources that return and explicit naming structure for values and labels<br/>When this property is configured, this value is used rather than the default naming strategy. |
|
||||
| `displayName` | string | No | | The display value for this field. This supports template variables blank is auto |
|
||||
| `filterable` | boolean | No | | True if data source field supports ad-hoc filters |
|
||||
| `links` | | No | | The behavior when clicking on a result |
|
||||
| `mappings` | [ValueMapping](#valuemapping)[] | No | | Convert input values into a display string |
|
||||
| `max` | number | No | | |
|
||||
| `min` | number | No | | |
|
||||
| `noValue` | string | No | | Alternative to empty string |
|
||||
| `path` | string | No | | An explicit path to the field in the datasource. When the frame meta includes a path,<br/>This will default to `${frame.meta.path}/${field.name}<br/><br/>When defined, this value can be used as an identifier within the datasource scope, and<br/>may be used to update the results |
|
||||
| `thresholds` | [ThresholdsConfig](#thresholdsconfig) | No | | |
|
||||
| `unit` | string | No | | Numeric Options |
|
||||
| `writeable` | boolean | No | | True if data source can write a value to the path. Auth/authz are supported separately |
|
||||
The data model used in Grafana, namely the data frame, is a columnar-oriented table structure that unifies both time series and table query results.
|
||||
Each column within this structure is called a field. A field can represent a single time series or table column.
|
||||
Field options allow you to change how the data is displayed in your visualizations.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|---------------------|---------------------------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `color` | [FieldColor](#fieldcolor) | No | | Map a field to a color. |
|
||||
| `custom` | [custom](#custom) | No | | custom is specified by the FieldConfig field<br/>in panel plugin schemas. |
|
||||
| `decimals` | number | No | | Specify the number of decimals Grafana includes in the rendered value.<br/>If you leave this field blank, Grafana automatically truncates the number of decimals based on the value.<br/>For example 1.1234 will display as 1.12 and 100.456 will display as 100.<br/>To display all decimals, set the unit to `String`. |
|
||||
| `description` | string | No | | Human readable field metadata |
|
||||
| `displayNameFromDS` | string | No | | This can be used by data sources that return and explicit naming structure for values and labels<br/>When this property is configured, this value is used rather than the default naming strategy. |
|
||||
| `displayName` | string | No | | The display value for this field. This supports template variables blank is auto |
|
||||
| `filterable` | boolean | No | | True if data source field supports ad-hoc filters |
|
||||
| `links` | | No | | The behavior when clicking on a result |
|
||||
| `mappings` | [ValueMapping](#valuemapping)[] | No | | Convert input values into a display string |
|
||||
| `max` | number | No | | The maximum value used in percentage threshold calculations. Leave blank for auto calculation based on all series and fields. |
|
||||
| `min` | number | No | | The minimum value used in percentage threshold calculations. Leave blank for auto calculation based on all series and fields. |
|
||||
| `noValue` | string | No | | Alternative to empty string |
|
||||
| `path` | string | No | | An explicit path to the field in the datasource. When the frame meta includes a path,<br/>This will default to `${frame.meta.path}/${field.name}<br/><br/>When defined, this value can be used as an identifier within the datasource scope, and<br/>may be used to update the results |
|
||||
| `thresholds` | [ThresholdsConfig](#thresholdsconfig) | No | | Thresholds configuration for the panel |
|
||||
| `unit` | string | No | | Unit a field should use. The unit you select is applied to all fields except time.<br/>You can use the units ID availables in Grafana or a custom unit.<br/>Available units in Grafana: https://github.com/grafana/grafana/blob/main/packages/grafana-data/src/valueFormats/categories.ts<br/>As custom unit, you can use the following formats:<br/>`suffix:<suffix>` for custom unit that should go after value.<br/>`prefix:<prefix>` for custom unit that should go before value.<br/>`time:<format>` For custom date time formats type for example `time:YYYY-MM-DD`.<br/>`si:<base scale><unit characters>` for custom SI units. For example: `si: mF`. This one is a bit more advanced as you can specify both a unit and the source data scale. So if your source data is represented as milli (thousands of) something prefix the unit with that SI scale character.<br/>`count:<unit>` for a custom count unit.<br/>`currency:<unit>` for custom a currency unit. |
|
||||
| `writeable` | boolean | No | | True if data source can write a value to the path. Auth/authz are supported separately |
|
||||
|
||||
### RangeMap
|
||||
|
||||
Maps numeric ranges to a color or different display text
|
||||
Maps numerical ranges to a display text and color.
|
||||
For example, if a value is within a certain range, you can configure a range value mapping to display Low or High rather than the number.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-----------|---------------------|----------|---------|-------------|
|
||||
| `options` | [options](#options) | **Yes** | | |
|
||||
| `type` | string | **Yes** | | |
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-----------|---------------------|----------|---------|-----------------------------------------------------------------------------------|
|
||||
| `options` | [options](#options) | **Yes** | | Range to match against and the result to apply when the value is within the range |
|
||||
| `type` | string | **Yes** | | |
|
||||
|
||||
### RegexMap
|
||||
|
||||
Maps regular expressions to replacement text and a color
|
||||
Maps regular expressions to replacement text and a color.
|
||||
For example, if a value is www.example.com, you can configure a regex value mapping so that Grafana displays www and truncates the domain.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-----------|---------------------|----------|---------|-------------|
|
||||
| `options` | [options](#options) | **Yes** | | |
|
||||
| `type` | string | **Yes** | | |
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-----------|---------------------|----------|---------|----------------------------------------------------------------------------------------------|
|
||||
| `options` | [options](#options) | **Yes** | | Regular expression to match against and the result to apply when the value matches the regex |
|
||||
| `type` | string | **Yes** | | |
|
||||
|
||||
### SpecialValueMap
|
||||
|
||||
Maps special values like Null, NaN (not a number), and boolean values like true and false to a display text
|
||||
and color
|
||||
Maps special values like Null, NaN (not a number), and boolean values like true and false to a display text and color.
|
||||
See SpecialValueMatch to see the list of special values.
|
||||
For example, you can configure a special value mapping so that null values appear as N/A.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-----------|---------------------|----------|---------|-------------|
|
||||
@ -508,19 +548,9 @@ type directly to achieve the same effect.
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|------|----------|---------|-------------|
|
||||
|
||||
### Datasource
|
||||
|
||||
The datasource used in all targets.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|--------|----------|---------|-------------|
|
||||
| `type` | string | No | | |
|
||||
| `uid` | string | No | | |
|
||||
|
||||
### Options
|
||||
|
||||
options is specified by the Options field in panel
|
||||
plugin schemas.
|
||||
It depends on the panel plugin. They are specified by the Options field in panel plugin schemas.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|------|----------|---------|-------------|
|
||||
@ -529,25 +559,16 @@ plugin schemas.
|
||||
|
||||
Row panel
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|--------------|-----------------------|----------|---------|------------------------------------------|
|
||||
| `collapsed` | boolean | **Yes** | `false` | |
|
||||
| `id` | uint32 | **Yes** | | |
|
||||
| `panels` | [panels](#panels)[] | **Yes** | | |
|
||||
| `type` | string | **Yes** | | Possible values are: `row`. |
|
||||
| `datasource` | [object](#datasource) | No | | Name of default datasource. |
|
||||
| `gridPos` | [GridPos](#gridpos) | No | | |
|
||||
| `repeat` | string | No | | Name of template variable to repeat for. |
|
||||
| `title` | string | No | | |
|
||||
|
||||
### Datasource
|
||||
|
||||
Name of default datasource.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|--------|----------|---------|-------------|
|
||||
| `type` | string | No | | |
|
||||
| `uid` | string | No | | |
|
||||
| Property | Type | Required | Default | Description |
|
||||
|--------------|---------------------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `collapsed` | boolean | **Yes** | `false` | Whether this row should be collapsed or not. |
|
||||
| `id` | uint32 | **Yes** | | Unique identifier of the panel. Generated by Grafana when creating a new panel. It must be unique within a dashboard, but not globally. |
|
||||
| `panels` | [panels](#panels)[] | **Yes** | | List of panels in the row |
|
||||
| `type` | string | **Yes** | | The panel type<br/>Possible values are: `row`. |
|
||||
| `datasource` | [DataSourceRef](#datasourceref) | No | | Ref to a DataSource instance |
|
||||
| `gridPos` | [GridPos](#gridpos) | No | | Position and dimensions of a panel in the grid |
|
||||
| `repeat` | string | No | | Name of template variable to repeat for. |
|
||||
| `title` | string | No | | Row title |
|
||||
|
||||
### Panels
|
||||
|
||||
@ -557,7 +578,8 @@ Name of default datasource.
|
||||
|
||||
### GraphPanel
|
||||
|
||||
Support for legacy graph and heatmap panels.
|
||||
Support for legacy graph panel.
|
||||
@deprecated this a deprecated panel type
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|-------------------|----------|---------|----------------------------------------------------|
|
||||
@ -566,73 +588,71 @@ Support for legacy graph and heatmap panels.
|
||||
|
||||
### Panel
|
||||
|
||||
Dashboard panels. Panels are canonically defined inline
|
||||
because they share a version timeline with the dashboard
|
||||
schema; they do not evolve independently.
|
||||
Dashboard panels are the basic visualization building blocks.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|-------------------|---------------------------------------------------|----------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `fieldConfig` | [FieldConfigSource](#fieldconfigsource) | **Yes** | | |
|
||||
| `options` | [options](#options) | **Yes** | | options is specified by the Options field in panel<br/>plugin schemas. |
|
||||
| `repeatDirection` | string | **Yes** | `h` | Direction to repeat in if 'repeat' is set.<br/>"h" for horizontal, "v" for vertical.<br/>TODO this is probably optional<br/>Possible values are: `h`, `v`. |
|
||||
| `transformations` | [DataTransformerConfig](#datatransformerconfig)[] | **Yes** | | |
|
||||
| `fieldConfig` | [FieldConfigSource](#fieldconfigsource) | **Yes** | | The data model used in Grafana, namely the data frame, is a columnar-oriented table structure that unifies both time series and table query results.<br/>Each column within this structure is called a field. A field can represent a single time series or table column.<br/>Field options allow you to change how the data is displayed in your visualizations. |
|
||||
| `options` | [options](#options) | **Yes** | | It depends on the panel plugin. They are specified by the Options field in panel plugin schemas. |
|
||||
| `transformations` | [DataTransformerConfig](#datatransformerconfig)[] | **Yes** | | List of transformations that are applied to the panel data before rendering.<br/>When there are multiple transformations, Grafana applies them in the order they are listed.<br/>Each transformation creates a result set that then passes on to the next transformation in the processing pipeline. |
|
||||
| `transparent` | boolean | **Yes** | `false` | Whether to display the panel without a background. |
|
||||
| `type` | string | **Yes** | | The panel plugin type id. May not be empty.<br/>Constraint: `length >=1`. |
|
||||
| `datasource` | [datasource](#datasource) | No | | The datasource used in all targets. |
|
||||
| `description` | string | No | | Description. |
|
||||
| `gridPos` | [GridPos](#gridpos) | No | | |
|
||||
| `id` | uint32 | No | | TODO docs |
|
||||
| `type` | string | **Yes** | | The panel plugin type id. This is used to find the plugin to display the panel.<br/>Constraint: `length >=1`. |
|
||||
| `datasource` | [DataSourceRef](#datasourceref) | No | | Ref to a DataSource instance |
|
||||
| `description` | string | No | | Panel description. |
|
||||
| `gridPos` | [GridPos](#gridpos) | No | | Position and dimensions of a panel in the grid |
|
||||
| `id` | uint32 | No | | Unique identifier of the panel. Generated by Grafana when creating a new panel. It must be unique within a dashboard, but not globally. |
|
||||
| `interval` | string | No | | The min time interval setting defines a lower limit for the $__interval and $__interval_ms variables.<br/>This value must be formatted as a number followed by a valid time<br/>identifier like: "40s", "3d", etc.<br/>See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
|
||||
| `libraryPanel` | [LibraryPanelRef](#librarypanelref) | No | | |
|
||||
| `links` | [DashboardLink](#dashboardlink)[] | No | | Panel links.<br/>TODO fill this out - seems there are a couple variants? |
|
||||
| `libraryPanel` | [LibraryPanelRef](#librarypanelref) | No | | A library panel is a reusable panel that you can use in any dashboard.<br/>When you make a change to a library panel, that change propagates to all instances of where the panel is used.<br/>Library panels streamline reuse of panels across multiple dashboards. |
|
||||
| `links` | [DashboardLink](#dashboardlink)[] | No | | Panel links. |
|
||||
| `maxDataPoints` | number | No | | The maximum number of data points that the panel queries are retrieving. |
|
||||
| `pluginVersion` | string | No | | FIXME this almost certainly has to be changed in favor of scuemata versions |
|
||||
| `pluginVersion` | string | No | | The version of the plugin that is used for this panel. This is used to find the plugin to display the panel and to migrate old panel configs. |
|
||||
| `repeatDirection` | string | No | `h` | Direction to repeat in if 'repeat' is set.<br/>`h` for horizontal, `v` for vertical.<br/>Possible values are: `h`, `v`. |
|
||||
| `repeatPanelId` | integer | No | | Id of the repeating panel. |
|
||||
| `repeat` | string | No | | Name of template variable to repeat for. |
|
||||
| `tags` | string[] | No | | TODO docs |
|
||||
| `targets` | [Target](#target)[] | No | | TODO docs |
|
||||
| `thresholds` | | No | | TODO docs - seems to be an old field from old dashboard alerts? |
|
||||
| `tags` | string[] | No | | Tags for the panel. |
|
||||
| `targets` | [Target](#target)[] | No | | Depends on the panel plugin. See the plugin documentation for details. |
|
||||
| `timeFrom` | string | No | | Overrides the relative time range for individual panels,<br/>which causes them to be different than what is selected in<br/>the dashboard time picker in the top-right corner of the dashboard. You can use this to show metrics from different<br/>time periods or days on the same dashboard.<br/>The value is formatted as time operation like: `now-5m` (Last 5 minutes), `now/d` (the day so far),<br/>`now-5d/d`(Last 5 days), `now/w` (This week so far), `now-2y/y` (Last 2 years).<br/>Note: Panel time overrides have no effect when the dashboard’s time range is absolute.<br/>See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
|
||||
| `timeRegions` | | No | | TODO docs |
|
||||
| `timeShift` | string | No | | Overrides the time range for individual panels by shifting its start and end relative to the time picker.<br/>For example, you can shift the time range for the panel to be two hours earlier than the dashboard time picker setting `2h`.<br/>Note: Panel time overrides have no effect when the dashboard’s time range is absolute.<br/>See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
|
||||
| `title` | string | No | | Panel title. |
|
||||
|
||||
### Templating
|
||||
|
||||
Contains the list of configured template variables with their saved values along with some other metadata
|
||||
Configured template variables
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|-----------------------------------|----------|---------|-------------|
|
||||
| `list` | [VariableModel](#variablemodel)[] | No | | |
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|-----------------------------------|----------|---------|----------------------------------------------------------------------------------------------|
|
||||
| `list` | [VariableModel](#variablemodel)[] | No | | List of configured template variables with their saved values along with some other metadata |
|
||||
|
||||
### VariableModel
|
||||
|
||||
FROM: packages/grafana-data/src/types/templateVars.ts
|
||||
TODO docs
|
||||
TODO what about what's in public/app/features/types.ts?
|
||||
TODO there appear to be a lot of different kinds of [template] vars here? if so need a disjunction
|
||||
A variable is a placeholder for a value. You can use variables in metric queries and in panel titles.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------------|---------------------------------|----------|----------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `global` | boolean | **Yes** | `false` | |
|
||||
| `hide` | integer | **Yes** | | Possible values are: `0`, `1`, `2`. |
|
||||
| `id` | string | **Yes** | `00000000-0000-0000-0000-000000000000` | |
|
||||
| `index` | int32 | **Yes** | `-1` | |
|
||||
| `name` | string | **Yes** | | |
|
||||
| `skipUrlSync` | boolean | **Yes** | `false` | |
|
||||
| `state` | string | **Yes** | | Possible values are: `NotStarted`, `Loading`, `Streaming`, `Done`, `Error`. |
|
||||
| `type` | string | **Yes** | | FROM: packages/grafana-data/src/types/templateVars.ts<br/>TODO docs<br/>TODO this implies some wider pattern/discriminated union, probably?<br/>Possible values are: `query`, `adhoc`, `constant`, `datasource`, `interval`, `textbox`, `custom`, `system`. |
|
||||
| `datasource` | [DataSourceRef](#datasourceref) | No | | Ref to a DataSource instance |
|
||||
| `description` | string | No | | |
|
||||
| `error` | [object](#error) | No | | |
|
||||
| `label` | string | No | | |
|
||||
| `query` | | No | | TODO: Move this into a separated QueryVariableModel type |
|
||||
| `rootStateKey` | string | No | | |
|
||||
| Property | Type | Required | Default | Description |
|
||||
|---------------|-------------------------------------|----------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `hide` | integer | **Yes** | | Determine if the variable shows on dashboard<br/>Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing).<br/>Possible values are: `0`, `1`, `2`. |
|
||||
| `id` | string | **Yes** | `00000000-0000-0000-0000-000000000000` | Unique numeric identifier for the variable. |
|
||||
| `name` | string | **Yes** | | Name of variable |
|
||||
| `skipUrlSync` | boolean | **Yes** | `false` | Whether the variable value should be managed by URL query params or not |
|
||||
| `type` | string | **Yes** | | Dashboard variable type<br/>`query`: Query-generated list of values such as metric names, server names, sensor IDs, data centers, and so on.<br/>`adhoc`: Key/value filters that are automatically added to all metric queries for a data source (Prometheus, Loki, InfluxDB, and Elasticsearch only).<br/>`constant`: Define a hidden constant.<br/>`datasource`: Quickly change the data source for an entire dashboard.<br/>`interval`: Interval variables represent time spans.<br/>`textbox`: Display a free text input field with an optional default value.<br/>`custom`: Define the variable options manually using a comma-separated list.<br/>`system`: Variables defined by Grafana. See: https://grafana.com/docs/grafana/latest/dashboards/variables/add-template-variables/#global-variables<br/>Possible values are: `query`, `adhoc`, `constant`, `datasource`, `interval`, `textbox`, `custom`, `system`. |
|
||||
| `allFormat` | string | No | | Format to use while fetching all values from data source, eg: wildcard, glob, regex, pipe, etc. |
|
||||
| `current` | [VariableOption](#variableoption) | No | | Option to be selected in a variable. |
|
||||
| `datasource` | [DataSourceRef](#datasourceref) | No | | Ref to a DataSource instance |
|
||||
| `description` | string | No | | Description of variable. It can be defined but `null`. |
|
||||
| `label` | string | No | | Optional display name |
|
||||
| `multi` | boolean | No | `false` | Whether multiple values can be selected or not from variable value list |
|
||||
| `options` | [VariableOption](#variableoption)[] | No | | Options that can be selected for a variable. |
|
||||
| `query` | | No | | Query used to fetch values for a variable |
|
||||
| `refresh` | integer | No | | Options to config when to refresh a variable<br/>`0`: Never refresh the variable<br/>`1`: Queries the data source every time the dashboard loads.<br/>`2`: Queries the data source when the dashboard time range changes.<br/>Possible values are: `0`, `1`, `2`. |
|
||||
|
||||
### Error
|
||||
### VariableOption
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|----------|------|----------|---------|-------------|
|
||||
Option to be selected in a variable.
|
||||
|
||||
| Property | Type | Required | Default | Description |
|
||||
|------------|---------|----------|---------|---------------------------------------|
|
||||
| `text` | | **Yes** | | Text to be displayed for the option |
|
||||
| `value` | | **Yes** | | Value of the option |
|
||||
| `selected` | boolean | No | | Whether the option is selected or not |
|
||||
|
||||
### Time
|
||||
|
||||
|
@ -16,37 +16,48 @@ lineage: schemas: [{
|
||||
schema: {
|
||||
spec: {
|
||||
// Unique numeric identifier for the dashboard.
|
||||
// TODO must isolate or remove identifiers local to a Grafana instance...?
|
||||
// `id` is internal to a specific Grafana instance. `uid` should be used to identify a dashboard across Grafana instances.
|
||||
id?: int64
|
||||
|
||||
// Unique dashboard identifier that can be generated by anyone. string (8-40)
|
||||
uid?: string
|
||||
|
||||
// Title of dashboard.
|
||||
title?: string
|
||||
|
||||
// Description of dashboard.
|
||||
description?: string
|
||||
|
||||
// This property should only be used in dashboards defined by plugins. It is a quick check
|
||||
// to see if the version has changed since the last time. Unclear why using the version property
|
||||
// is insufficient.
|
||||
revision?: int64 @grafanamaturity(NeedsExpertReview)
|
||||
// to see if the version has changed since the last time.
|
||||
revision?: int64
|
||||
|
||||
// ID of a dashboard imported from the https://grafana.com/grafana/dashboards/ portal
|
||||
gnetId?: string @grafanamaturity(NeedsExpertReview)
|
||||
gnetId?: string
|
||||
|
||||
// Tags associated with dashboard.
|
||||
tags?: [...string] @grafanamaturity(NeedsExpertReview)
|
||||
tags?: [...string]
|
||||
|
||||
// Theme of dashboard.
|
||||
style: "light" | *"dark" @grafanamaturity(NeedsExpertReview)
|
||||
// Default value: dark.
|
||||
style: "light" | *"dark"
|
||||
|
||||
// Timezone of dashboard. Accepted values are IANA TZDB zone ID or "browser" or "utc".
|
||||
timezone?: string | *"browser"
|
||||
|
||||
// Whether a dashboard is editable or not.
|
||||
editable: bool | *true
|
||||
|
||||
// Configuration of dashboard cursor sync behavior.
|
||||
// Accepted values are 0 (sync turned off), 1 (shared crosshair), 2 (shared crosshair and tooltip).
|
||||
graphTooltip: #DashboardCursorSync
|
||||
|
||||
// Time range for dashboard.
|
||||
// Accepted values are relative time strings like {from: 'now-6h', to: 'now'} or absolute time strings like {from: '2020-07-10T08:00:00.000Z', to: '2020-07-10T14:00:00.000Z'}.
|
||||
time?: {
|
||||
from: string | *"now-6h"
|
||||
to: string | *"now"
|
||||
} @grafanamaturity(NeedsExpertReview)
|
||||
}
|
||||
|
||||
// Configuration of the time picker shown at the top of a dashboard.
|
||||
timepicker?: {
|
||||
@ -60,36 +71,48 @@ lineage: schemas: [{
|
||||
enable: bool | *true
|
||||
// Selectable options available in the time picker dropdown. Has no effect on provisioned dashboard.
|
||||
time_options: [...string] | *["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
|
||||
} @grafanamaturity(NeedsExpertReview)
|
||||
}
|
||||
|
||||
// The month that the fiscal year starts on. 0 = January, 11 = December
|
||||
fiscalYearStartMonth?: uint8 & <12 | *0
|
||||
|
||||
// When set to true, the dashboard will redraw panels at an interval matching the pixel width.
|
||||
// This will keep data "moving left" regardless of the query refresh rate. This setting helps
|
||||
// This will keep data "moving left" regardless of the query refresh rate. This setting helps
|
||||
// avoid dashboards presenting stale live data
|
||||
liveNow?: bool @grafanamaturity(NeedsExpertReview)
|
||||
liveNow?: bool
|
||||
|
||||
// Day when the week starts. Expressed by the name of the day in lowercase, e.g. "monday".
|
||||
weekStart?: string
|
||||
|
||||
// Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d".
|
||||
refresh?: string | false
|
||||
|
||||
// Version of the JSON schema, incremented each time a Grafana update brings
|
||||
// changes to said schema.
|
||||
// TODO this is the existing schema numbering system. It will be replaced by Thema's themaVersion
|
||||
schemaVersion: uint16 | *36
|
||||
|
||||
// Version of the dashboard, incremented each time the dashboard is updated.
|
||||
version?: uint32 @grafanamaturity(NeedsExpertReview)
|
||||
panels?: [...(#Panel | #RowPanel | #GraphPanel | #HeatmapPanel)] @grafanamaturity(NeedsExpertReview)
|
||||
// Contains the list of configured template variables with their saved values along with some other metadata
|
||||
version?: uint32
|
||||
|
||||
// List of dashboard panels
|
||||
panels?: [...(#Panel | #RowPanel | #GraphPanel | #HeatmapPanel)]
|
||||
|
||||
// Configured template variables
|
||||
templating?: {
|
||||
list?: [...#VariableModel] @grafanamaturity(NeedsExpertReview)
|
||||
// List of configured template variables with their saved values along with some other metadata
|
||||
list?: [...#VariableModel]
|
||||
}
|
||||
|
||||
// TODO docs
|
||||
// Contains the list of annotations that are associated with the dashboard.
|
||||
// Annotations are used to overlay event markers and overlay event tags on graphs.
|
||||
// Grafana comes with a native annotation store and the ability to add annotation events directly from the graph panel or via the HTTP API.
|
||||
// See https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/annotate-visualizations/
|
||||
annotations?: #AnnotationContainer
|
||||
|
||||
// Links with references to other dashboards or external websites.
|
||||
links?: [...#DashboardLink] @grafanamaturity(NeedsExpertReview)
|
||||
links?: [...#DashboardLink]
|
||||
|
||||
// Snapshot options. They are present only if the dashboard is a snapshot.
|
||||
snapshot?: #Snapshot @grafanamaturity(NeedsExpertReview)
|
||||
} @cuetsy(kind="interface") @grafana(TSVeneer="type")
|
||||
|
||||
@ -122,19 +145,18 @@ lineage: schemas: [{
|
||||
ids: [...uint8]
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
// TODO -- should not be a public interface on its own, but required for Veneer
|
||||
// Contains the list of annotations that are associated with the dashboard.
|
||||
// Annotations are used to overlay event markers and overlay event tags on graphs.
|
||||
// Grafana comes with a native annotation store and the ability to add annotation events directly from the graph panel or via the HTTP API.
|
||||
// See https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/annotate-visualizations/
|
||||
#AnnotationContainer: {
|
||||
// annoying... but required so that the list is defined using the nested Veneer
|
||||
@grafana(TSVeneer="type")
|
||||
|
||||
list?: [...#AnnotationQuery] @grafanamaturity(NeedsExpertReview)
|
||||
} @cuetsy(kind="interface")
|
||||
// List of annotations
|
||||
list?: [...#AnnotationQuery]
|
||||
} @cuetsy(kind="interface") @grafana(TSVeneer="type")
|
||||
|
||||
// TODO docs
|
||||
// FROM: AnnotationQuery in grafana-data/src/types/annotations.ts
|
||||
#AnnotationQuery: {
|
||||
@grafana(TSVeneer="type")
|
||||
|
||||
// Name of annotation.
|
||||
name: string
|
||||
|
||||
@ -163,199 +185,279 @@ lineage: schemas: [{
|
||||
// unless datasources have migrated to the target+mapping,
|
||||
// they just spread their query into the base object :(
|
||||
...
|
||||
} @cuetsy(kind="interface")
|
||||
} @cuetsy(kind="interface") @grafana(TSVeneer="type") @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
#LoadingState: "NotStarted" | "Loading" | "Streaming" | "Done" | "Error" @cuetsy(kind="enum") @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// FROM: packages/grafana-data/src/types/templateVars.ts
|
||||
// TODO docs
|
||||
// TODO what about what's in public/app/features/types.ts?
|
||||
// TODO there appear to be a lot of different kinds of [template] vars here? if so need a disjunction
|
||||
// A variable is a placeholder for a value. You can use variables in metric queries and in panel titles.
|
||||
#VariableModel: {
|
||||
id: string | *"00000000-0000-0000-0000-000000000000"
|
||||
type: #VariableType
|
||||
name: string
|
||||
label?: string
|
||||
rootStateKey?: string
|
||||
global: bool | *false
|
||||
hide: #VariableHide
|
||||
skipUrlSync: bool | *false
|
||||
index: int32 | *-1
|
||||
state: #LoadingState
|
||||
error?: {...}
|
||||
// Unique numeric identifier for the variable.
|
||||
id: string | *"00000000-0000-0000-0000-000000000000"
|
||||
// Type of variable
|
||||
type: #VariableType
|
||||
// Name of variable
|
||||
name: string
|
||||
// Optional display name
|
||||
label?: string
|
||||
// Visibility configuration for the variable
|
||||
hide: #VariableHide
|
||||
// Whether the variable value should be managed by URL query params or not
|
||||
skipUrlSync: bool | *false
|
||||
// Description of variable. It can be defined but `null`.
|
||||
description?: string
|
||||
// TODO: Move this into a separated QueryVariableModel type
|
||||
query?: string | {...}
|
||||
// Query used to fetch values for a variable
|
||||
query?: string | {...}
|
||||
// Data source used to fetch values for a variable. It can be defined but `null`.
|
||||
datasource?: #DataSourceRef
|
||||
// Format to use while fetching all values from data source, eg: wildcard, glob, regex, pipe, etc.
|
||||
allFormat?: string
|
||||
// Shows current selected variable text/value on the dashboard
|
||||
current?: #VariableOption
|
||||
// Whether multiple values can be selected or not from variable value list
|
||||
multi?: bool | *false
|
||||
// Options that can be selected for a variable.
|
||||
options?: [...#VariableOption]
|
||||
refresh?: #VariableRefresh
|
||||
...
|
||||
} @cuetsy(kind="interface") @grafana(TSVeneer="type") @grafanamaturity(NeedsExpertReview)
|
||||
#VariableHide: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable") @grafana(TSVeneer="type") @grafanamaturity(NeedsExpertReview)
|
||||
#LoadingState: "NotStarted" | "Loading" | "Streaming" | "Done" | "Error" @cuetsy(kind="enum") @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// Option to be selected in a variable.
|
||||
#VariableOption: {
|
||||
// Whether the option is selected or not
|
||||
selected?: bool
|
||||
// Text to be displayed for the option
|
||||
text: string | [...string]
|
||||
// Value of the option
|
||||
value: string | [...string]
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
// Options to config when to refresh a variable
|
||||
// `0`: Never refresh the variable
|
||||
// `1`: Queries the data source every time the dashboard loads.
|
||||
// `2`: Queries the data source when the dashboard time range changes.
|
||||
#VariableRefresh: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="never|onDashboardLoad|onTimeRangeChanged")
|
||||
|
||||
// Determine if the variable shows on dashboard
|
||||
// Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing).
|
||||
#VariableHide: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable") @grafana(TSVeneer="type")
|
||||
|
||||
// Sort variable options
|
||||
// Accepted values are:
|
||||
// `0`: No sorting
|
||||
// `1`: Alphabetical ASC
|
||||
// `2`: Alphabetical DESC
|
||||
// `3`: Numerical ASC
|
||||
// `4`: Numerical DESC
|
||||
// `5`: Alphabetical Case Insensitive ASC
|
||||
// `6`: Alphabetical Case Insensitive DESC
|
||||
#VariableSort: 0 | 1 | 2 | 3 | 4 | 5 | 6 @cuetsy(kind="enum",memberNames="disabled|alphabeticalAsc|alphabeticalDesc|numericalAsc|numericalDesc|alphabeticalCaseInsensitiveAsc|alphabeticalCaseInsensitiveDesc")
|
||||
|
||||
// Loading status
|
||||
// Accepted values are `NotStarted` (the request is not started), `Loading` (waiting for response), `Streaming` (pulling continuous data), `Done` (response received successfully) or `Error` (failed request).
|
||||
#LoadingState: "NotStarted" | "Loading" | "Streaming" | "Done" | "Error" @cuetsy(kind="enum")
|
||||
|
||||
// Ref to a DataSource instance
|
||||
#DataSourceRef: {
|
||||
// The plugin type-id
|
||||
type?: string @grafanamaturity(NeedsExpertReview)
|
||||
type?: string
|
||||
|
||||
// Specific datasource instance
|
||||
uid?: string @grafanamaturity(NeedsExpertReview)
|
||||
} @cuetsy(kind="interface") @grafana(TSVeneer="type") @grafanamaturity(NeedsExpertReview)
|
||||
uid?: string
|
||||
} @cuetsy(kind="interface") @grafana(TSVeneer="type")
|
||||
|
||||
// Links with references to other dashboards or external resources
|
||||
#DashboardLink: {
|
||||
// Title to display with the link
|
||||
title: string @grafanamaturity(NeedsExpertReview)
|
||||
title: string
|
||||
// Link type. Accepted values are dashboards (to refer to another dashboard) and link (to refer to an external resource)
|
||||
type: #DashboardLinkType @grafanamaturity(NeedsExpertReview)
|
||||
type: #DashboardLinkType
|
||||
// Icon name to be displayed with the link
|
||||
icon: string @grafanamaturity(NeedsExpertReview)
|
||||
icon: string
|
||||
// Tooltip to display when the user hovers their mouse over it
|
||||
tooltip: string @grafanamaturity(NeedsExpertReview)
|
||||
tooltip: string
|
||||
// Link URL. Only required/valid if the type is link
|
||||
url: string @grafanamaturity(NeedsExpertReview)
|
||||
url: string
|
||||
// List of tags to limit the linked dashboards. If empty, all dashboards will be displayed. Only valid if the type is dashboards
|
||||
tags: [...string] @grafanamaturity(NeedsExpertReview)
|
||||
tags: [...string]
|
||||
// If true, all dashboards links will be displayed in a dropdown. If false, all dashboards links will be displayed side by side. Only valid if the type is dashboards
|
||||
asDropdown: bool | *false @grafanamaturity(NeedsExpertReview)
|
||||
asDropdown: bool | *false
|
||||
// If true, the link will be opened in a new tab
|
||||
targetBlank: bool | *false @grafanamaturity(NeedsExpertReview)
|
||||
targetBlank: bool | *false
|
||||
// If true, includes current template variables values in the link as query params
|
||||
includeVars: bool | *false @grafanamaturity(NeedsExpertReview)
|
||||
includeVars: bool | *false
|
||||
// If true, includes current time range in the link as query params
|
||||
keepTime: bool | *false @grafanamaturity(NeedsExpertReview)
|
||||
keepTime: bool | *false
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
// Dashboard Link type. Accepted values are dashboards (to refer to another dashboard) and link (to refer to an external resource)
|
||||
#DashboardLinkType: "link" | "dashboards" @cuetsy(kind="type") @grafanamaturity(NeedsExpertReview)
|
||||
#DashboardLinkType: "link" | "dashboards" @cuetsy(kind="type")
|
||||
|
||||
// FROM: packages/grafana-data/src/types/templateVars.ts
|
||||
// TODO docs
|
||||
// TODO this implies some wider pattern/discriminated union, probably?
|
||||
// Dashboard variable type
|
||||
// `query`: Query-generated list of values such as metric names, server names, sensor IDs, data centers, and so on.
|
||||
// `adhoc`: Key/value filters that are automatically added to all metric queries for a data source (Prometheus, Loki, InfluxDB, and Elasticsearch only).
|
||||
// `constant`: Define a hidden constant.
|
||||
// `datasource`: Quickly change the data source for an entire dashboard.
|
||||
// `interval`: Interval variables represent time spans.
|
||||
// `textbox`: Display a free text input field with an optional default value.
|
||||
// `custom`: Define the variable options manually using a comma-separated list.
|
||||
// `system`: Variables defined by Grafana. See: https://grafana.com/docs/grafana/latest/dashboards/variables/add-template-variables/#global-variables
|
||||
#VariableType: "query" | "adhoc" | "constant" | "datasource" | "interval" | "textbox" | "custom" | "system" @cuetsy(kind="type") @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// TODO docs
|
||||
#FieldColorModeId: "thresholds" | "palette-classic" | "palette-saturated" | "continuous-GrYlRd" | "fixed" @cuetsy(kind="enum",memberNames="Thresholds|PaletteClassic|PaletteSaturated|ContinuousGrYlRd|Fixed") @grafanamaturity(NeedsExpertReview)
|
||||
// Color mode for a field. You can specify a single color, or select a continuous (gradient) color schemes, based on a value.
|
||||
// Continuous color interpolates a color using the percentage of a value relative to min and max.
|
||||
// Accepted values are:
|
||||
// `thresholds`: From thresholds. Informs Grafana to take the color from the matching threshold
|
||||
// `palette-classic`: Classic palette. Grafana will assign color by looking up a color in a palette by series index. Useful for Graphs and pie charts and other categorical data visualizations
|
||||
// `palette-classic-by-name`: Classic palette (by name). Grafana will assign color by looking up a color in a palette by series name. Useful for Graphs and pie charts and other categorical data visualizations
|
||||
// `continuous-GrYlRd`: ontinuous Green-Yellow-Red palette mode
|
||||
// `continuous-RdYlGr`: Continuous Red-Yellow-Green palette mode
|
||||
// `continuous-BlYlRd`: Continuous Blue-Yellow-Red palette mode
|
||||
// `continuous-YlRd`: Continuous Yellow-Red palette mode
|
||||
// `continuous-BlPu`: Continuous Blue-Purple palette mode
|
||||
// `continuous-YlBl`: Continuous Yellow-Blue palette mode
|
||||
// `continuous-blues`: Continuous Blue palette mode
|
||||
// `continuous-reds`: Continuous Red palette mode
|
||||
// `continuous-greens`: Continuous Green palette mode
|
||||
// `continuous-purples`: Continuous Purple palette mode
|
||||
// `shades`: Shades of a single color. Specify a single color, useful in an override rule.
|
||||
// `fixed`: Fixed color mode. Specify a single color, useful in an override rule.
|
||||
#FieldColorModeId: "thresholds" | "palette-classic" | "palette-classic-by-name" | "continuous-GrYlRd" | "continuous-RdYlGr" | "continuous-BlYlRd" | "continuous-YlRd" | "continuous-BlPu" | "continuous-YlBl" | "continuous-blues" | "continuous-reds" | "continuous-greens" | "continuous-purples" | "fixed" | "shades" @cuetsy(kind="enum",memberNames="Thresholds|PaletteClassic|PaletteClassicByName|ContinuousGrYlRd|ContinuousRdYlGr|ContinuousBlYlRd|ContinuousYlRd|ContinuousBlPu|ContinuousYlBl|ContinuousBlues|ContinuousReds|ContinuousGreens|ContinuousPurples|Fixed|Shades") @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// TODO docs
|
||||
#FieldColorSeriesByMode: "min" | "max" | "last" @cuetsy(kind="type") @grafanamaturity(NeedsExpertReview)
|
||||
// Defines how to assign a series color from "by value" color schemes. For example for an aggregated data points like a timeseries, the color can be assigned by the min, max or last value.
|
||||
#FieldColorSeriesByMode: "min" | "max" | "last" @cuetsy(kind="type")
|
||||
|
||||
// TODO docs
|
||||
// Map a field to a color.
|
||||
#FieldColor: {
|
||||
// The main color scheme mode
|
||||
mode: #FieldColorModeId | string
|
||||
// Stores the fixed color value if mode is fixed
|
||||
// The main color scheme mode.
|
||||
mode: #FieldColorModeId
|
||||
// The fixed color value for fixed or shades color modes.
|
||||
fixedColor?: string
|
||||
// Some visualizations need to know how to assign a series color from by value color schemes
|
||||
// Some visualizations need to know how to assign a series color from by value color schemes.
|
||||
seriesBy?: #FieldColorSeriesByMode
|
||||
} @cuetsy(kind="interface") @grafanamaturity(NeedsExpertReview)
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
// Position and dimensions of a panel in the grid
|
||||
#GridPos: {
|
||||
// Panel
|
||||
h: uint32 & >0 | *9 @grafanamaturity(NeedsExpertReview)
|
||||
// Panel
|
||||
w: uint32 & >0 & <=24 | *12 @grafanamaturity(NeedsExpertReview)
|
||||
// Panel x
|
||||
x: uint32 & >=0 & <24 | *0 @grafanamaturity(NeedsExpertReview)
|
||||
// Panel y
|
||||
y: uint32 & >=0 | *0 @grafanamaturity(NeedsExpertReview)
|
||||
// Whether the panel is fixed within the grid
|
||||
static?: bool @grafanamaturity(NeedsExpertReview)
|
||||
// Panel height. The height is the number of rows from the top edge of the panel.
|
||||
h: uint32 & >0 | *9
|
||||
// Panel width. The width is the number of columns from the left edge of the panel.
|
||||
w: uint32 & >0 & <=24 | *12
|
||||
// Panel x. The x coordinate is the number of columns from the left edge of the grid
|
||||
x: uint32 & >=0 & <24 | *0
|
||||
// Panel y. The y coordinate is the number of rows from the top edge of the grid
|
||||
y: uint32 & >=0 | *0
|
||||
// Whether the panel is fixed within the grid. If true, the panel will not be affected by other panels' interactions
|
||||
static?: bool
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
// User-defined value for a metric that triggers visual changes in a panel when this value is met or exceeded
|
||||
// They are used to conditionally style and color visualizations based on query results , and can be applied to most visualizations.
|
||||
#Threshold: {
|
||||
// Value represents a specified metric for the threshold, which triggers a visual change in the dashboard when this value is met or exceeded.
|
||||
// FIXME the corresponding typescript field is required/non-optional, but nulls currently appear here when serializing -Infinity to JSON
|
||||
value?: number @grafanamaturity(NeedsExpertReview)
|
||||
// Nulls currently appear here when serializing -Infinity to JSON.
|
||||
value: number @grafanamaturity(NeedsExpertReview)
|
||||
// Color represents the color of the visual change that will occur in the dashboard when the threshold value is met or exceeded.
|
||||
color: string @grafanamaturity(NeedsExpertReview)
|
||||
// Threshold index, an old property that is not needed an should only appear in older dashboards
|
||||
index?: int32 @grafanamaturity(NeedsExpertReview)
|
||||
// TODO docs
|
||||
// TODO are the values here enumerable into a disjunction?
|
||||
// Some seem to be listed in typescript comment
|
||||
state?: string @grafanamaturity(NeedsExpertReview)
|
||||
} @cuetsy(kind="interface") @grafanamaturity(NeedsExpertReview)
|
||||
} @cuetsy(kind="interface") @grafana(TSVeneer="type") @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// Thresholds can either be absolute (specific number) or percentage (relative to min or max).
|
||||
#ThresholdsMode: "absolute" | "percentage" @cuetsy(kind="enum") @grafanamaturity(NeedsExpertReview)
|
||||
// Thresholds can either be `absolute` (specific number) or `percentage` (relative to min or max, it will be values between 0 and 1).
|
||||
#ThresholdsMode: "absolute" | "percentage" @cuetsy(kind="enum",memberNames="Absolute|Percentage")
|
||||
|
||||
// Thresholds configuration for the panel
|
||||
#ThresholdsConfig: {
|
||||
mode: #ThresholdsMode @grafanamaturity(NeedsExpertReview)
|
||||
// Thresholds mode.
|
||||
mode: #ThresholdsMode
|
||||
|
||||
// Must be sorted by 'value', first value is always -Infinity
|
||||
steps: [...#Threshold] @grafanamaturity(NeedsExpertReview)
|
||||
} @cuetsy(kind="interface") @grafanamaturity(NeedsExpertReview)
|
||||
} @cuetsy(kind="interface") @grafana(TSVeneer="type") @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// Allow to transform the visual representation of specific data values in a visualization, irrespective of their original units
|
||||
#ValueMapping: #ValueMap | #RangeMap | #RegexMap | #SpecialValueMap @cuetsy(kind="type") @grafanamaturity(NeedsExpertReview)
|
||||
#ValueMapping: #ValueMap | #RangeMap | #RegexMap | #SpecialValueMap @cuetsy(kind="type") @grafanamaturity(NeedsExpertReview) @grafana(TSVeneer="type")
|
||||
|
||||
// Supported value mapping types
|
||||
// `value`: Maps text values to a color or different display text and color. For example, you can configure a value mapping so that all instances of the value 10 appear as Perfection! rather than the number.
|
||||
// `range`: Maps numerical ranges to a display text and color. For example, if a value is within a certain range, you can configure a range value mapping to display Low or High rather than the number.
|
||||
// `regex`: Maps regular expressions to replacement text and a color. For example, if a value is www.example.com, you can configure a regex value mapping so that Grafana displays www and truncates the domain.
|
||||
// `special`: Maps special values like Null, NaN (not a number), and boolean values like true and false to a display text and color. See SpecialValueMatch to see the list of special values. For example, you can configure a special value mapping so that null values appear as N/A.
|
||||
#MappingType: "value" | "range" | "regex" | "special" @cuetsy(kind="enum",memberNames="ValueToText|RangeToText|RegexToText|SpecialValue") @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// Maps text values to a color or different display text
|
||||
// Maps text values to a color or different display text and color.
|
||||
// For example, you can configure a value mapping so that all instances of the value 10 appear as Perfection! rather than the number.
|
||||
#ValueMap: {
|
||||
type: #MappingType & "value"
|
||||
// Map with <value_to_match>: ValueMappingResult. For example: { "10": { text: "Perfection!", color: "green" } }
|
||||
options: [string]: #ValueMappingResult
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
// Maps numeric ranges to a color or different display text
|
||||
// Maps numerical ranges to a display text and color.
|
||||
// For example, if a value is within a certain range, you can configure a range value mapping to display Low or High rather than the number.
|
||||
#RangeMap: {
|
||||
type: #MappingType & "range"
|
||||
// Range to match against and the result to apply when the value is within the range
|
||||
options: {
|
||||
// to and from are `number | null` in current ts, really not sure what to do
|
||||
from: float64 @grafanamaturity(NeedsExpertReview)
|
||||
to: float64 @grafanamaturity(NeedsExpertReview)
|
||||
// Min value of the range. It can be null which means -Infinity
|
||||
from: float64
|
||||
// Max value of the range. It can be null which means +Infinity
|
||||
to: float64
|
||||
// Config to apply when the value is within the range
|
||||
result: #ValueMappingResult
|
||||
}
|
||||
} @cuetsy(kind="interface") @grafana(TSVeneer="type") @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// Maps regular expressions to replacement text and a color.
|
||||
// For example, if a value is www.example.com, you can configure a regex value mapping so that Grafana displays www and truncates the domain.
|
||||
#RegexMap: {
|
||||
type: #MappingType & "regex"
|
||||
// Regular expression to match against and the result to apply when the value matches the regex
|
||||
options: {
|
||||
// Regular expression to match against
|
||||
pattern: string
|
||||
// Config to apply when the value matches the regex
|
||||
result: #ValueMappingResult
|
||||
}
|
||||
} @cuetsy(kind="interface") @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// Maps regular expressions to replacement text and a color
|
||||
#RegexMap: {
|
||||
type: #MappingType & "regex"
|
||||
options: {
|
||||
pattern: string
|
||||
result: #ValueMappingResult
|
||||
}
|
||||
} @cuetsy(kind="interface") @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// Maps special values like Null, NaN (not a number), and boolean values like true and false to a display text
|
||||
// and color
|
||||
// Maps special values like Null, NaN (not a number), and boolean values like true and false to a display text and color.
|
||||
// See SpecialValueMatch to see the list of special values.
|
||||
// For example, you can configure a special value mapping so that null values appear as N/A.
|
||||
#SpecialValueMap: {
|
||||
type: #MappingType & "special"
|
||||
options: {
|
||||
match: "true" | "false"
|
||||
pattern: string
|
||||
result: #ValueMappingResult
|
||||
// Special value to match against
|
||||
match: #SpecialValueMatch
|
||||
// Config to apply when the value matches the special value
|
||||
result: #ValueMappingResult
|
||||
}
|
||||
} @cuetsy(kind="interface") @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// Special value types supported by the SpecialValueMap
|
||||
// Special value types supported by the `SpecialValueMap`
|
||||
#SpecialValueMatch: "true" | "false" | "null" | "nan" | "null+nan" | "empty" @cuetsy(kind="enum",memberNames="True|False|Null|NaN|NullAndNan|Empty")
|
||||
|
||||
// Result used as replacement text and color for RegexMap and SpecialValueMap
|
||||
// Result used as replacement with text and color when the value matches
|
||||
#ValueMappingResult: {
|
||||
text?: string
|
||||
// Text to display when the value matches
|
||||
text?: string
|
||||
// Text to use when the value matches
|
||||
color?: string
|
||||
icon?: string
|
||||
// Icon to display when the value matches. Only specific visualizations.
|
||||
icon?: string
|
||||
// Position in the mapping array. Only used internally.
|
||||
index?: int32
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
// TODO docs
|
||||
// Transformations allow to manipulate data returned by a query before the system applies a visualization.
|
||||
// Using transformations you can: rename fields, join time series data, perform mathematical operations across queries,
|
||||
// use the output of one transformation as the input to another transformation, etc.
|
||||
#DataTransformerConfig: {
|
||||
@grafana(TSVeneer="type")
|
||||
|
||||
// Unique identifier of transformer
|
||||
id: string
|
||||
// Disabled transformations are skipped
|
||||
disabled?: bool
|
||||
// Optional frame matcher. When missing it will be applied to all results
|
||||
// Optional frame matcher. When missing it will be applied to all results
|
||||
filter?: #MatcherConfig
|
||||
// Options to be passed to the transformer
|
||||
// Valid options depend on the transformer id
|
||||
options: _
|
||||
} @cuetsy(kind="interface") @grafanamaturity(NeedsExpertReview)
|
||||
} @cuetsy(kind="interface") @grafana(TSVeneer="type")
|
||||
|
||||
// 0 for no shared crosshair or tooltip (default).
|
||||
// 1 for shared crosshair.
|
||||
@ -369,7 +471,7 @@ lineage: schemas: [{
|
||||
// with types derived from plugins in the Instance variant.
|
||||
// When working directly from CUE, importers can extend this
|
||||
// type directly to achieve the same effect.
|
||||
#Target: {...} @grafanamaturity(NeedsExpertReview)
|
||||
#Target: {...}
|
||||
|
||||
// A dashboard snapshot shares an interactive dashboard publicly.
|
||||
// It is a read-only version of a dashboard, and is not editable.
|
||||
@ -401,61 +503,58 @@ lineage: schemas: [{
|
||||
userId: uint32 @grafanamaturity(NeedsExpertReview)
|
||||
} @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// Dashboard panels. Panels are canonically defined inline
|
||||
// because they share a version timeline with the dashboard
|
||||
// schema; they do not evolve independently.
|
||||
// Dashboard panels are the basic visualization building blocks.
|
||||
#Panel: {
|
||||
// The panel plugin type id. May not be empty.
|
||||
type: string & strings.MinRunes(1) @grafanamaturity(NeedsExpertReview)
|
||||
// The panel plugin type id. This is used to find the plugin to display the panel.
|
||||
type: string & strings.MinRunes(1)
|
||||
|
||||
// TODO docs
|
||||
id?: uint32 @grafanamaturity(NeedsExpertReview)
|
||||
// Unique identifier of the panel. Generated by Grafana when creating a new panel. It must be unique within a dashboard, but not globally.
|
||||
id?: uint32
|
||||
|
||||
// FIXME this almost certainly has to be changed in favor of scuemata versions
|
||||
pluginVersion?: string @grafanamaturity(NeedsExpertReview)
|
||||
// The version of the plugin that is used for this panel. This is used to find the plugin to display the panel and to migrate old panel configs.
|
||||
pluginVersion?: string
|
||||
|
||||
// TODO docs
|
||||
tags?: [...string] @grafanamaturity(NeedsExpertReview)
|
||||
// Tags for the panel.
|
||||
tags?: [...string]
|
||||
|
||||
// TODO docs
|
||||
targets?: [...#Target] @grafanamaturity(NeedsExpertReview)
|
||||
// Depends on the panel plugin. See the plugin documentation for details.
|
||||
targets?: [...#Target]
|
||||
|
||||
// Panel title.
|
||||
title?: string @grafanamaturity(NeedsExpertReview)
|
||||
// Description.
|
||||
description?: string @grafanamaturity(NeedsExpertReview)
|
||||
title?: string
|
||||
|
||||
// Panel description.
|
||||
description?: string
|
||||
|
||||
// Whether to display the panel without a background.
|
||||
transparent: bool | *false @grafanamaturity(NeedsExpertReview)
|
||||
transparent: bool | *false
|
||||
|
||||
// The datasource used in all targets.
|
||||
datasource?: {
|
||||
type?: string
|
||||
uid?: string
|
||||
} @grafanamaturity(NeedsExpertReview)
|
||||
datasource?: #DataSourceRef
|
||||
|
||||
// Grid position.
|
||||
gridPos?: #GridPos
|
||||
|
||||
// Panel links.
|
||||
// TODO fill this out - seems there are a couple variants?
|
||||
links?: [...#DashboardLink] @grafanamaturity(NeedsExpertReview)
|
||||
links?: [...#DashboardLink]
|
||||
|
||||
// Name of template variable to repeat for.
|
||||
repeat?: string @grafanamaturity(NeedsExpertReview)
|
||||
repeat?: string
|
||||
|
||||
// Direction to repeat in if 'repeat' is set.
|
||||
// "h" for horizontal, "v" for vertical.
|
||||
// TODO this is probably optional
|
||||
repeatDirection: *"h" | "v" @grafanamaturity(NeedsExpertReview)
|
||||
// `h` for horizontal, `v` for vertical.
|
||||
repeatDirection?: *"h" | "v"
|
||||
|
||||
// Id of the repeating panel.
|
||||
repeatPanelId?: int64 @grafanamaturity(NeedsExpertReview)
|
||||
repeatPanelId?: int64
|
||||
|
||||
// The maximum number of data points that the panel queries are retrieving.
|
||||
maxDataPoints?: number
|
||||
|
||||
// TODO docs - seems to be an old field from old dashboard alerts?
|
||||
thresholds?: [...] @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// TODO docs
|
||||
timeRegions?: [...] @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
transformations: [...#DataTransformerConfig] @grafanamaturity(NeedsExpertReview)
|
||||
// List of transformations that are applied to the panel data before rendering.
|
||||
// When there are multiple transformations, Grafana applies them in the order they are listed.
|
||||
// Each transformation creates a result set that then passes on to the next transformation in the processing pipeline.
|
||||
transformations: [...#DataTransformerConfig]
|
||||
|
||||
// The min time interval setting defines a lower limit for the $__interval and $__interval_ms variables.
|
||||
// This value must be formatted as a number followed by a valid time
|
||||
@ -482,29 +581,43 @@ lineage: schemas: [{
|
||||
// Dynamically load the panel
|
||||
libraryPanel?: #LibraryPanelRef
|
||||
|
||||
// options is specified by the Options field in panel
|
||||
// plugin schemas.
|
||||
// It depends on the panel plugin. They are specified by the Options field in panel plugin schemas.
|
||||
options: {...} @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// Field options allow you to change how the data is displayed in your visualizations.
|
||||
fieldConfig: #FieldConfigSource
|
||||
} @cuetsy(kind="interface") @grafana(TSVeneer="type") @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// The data model used in Grafana, namely the data frame, is a columnar-oriented table structure that unifies both time series and table query results.
|
||||
// Each column within this structure is called a field. A field can represent a single time series or table column.
|
||||
// Field options allow you to change how the data is displayed in your visualizations.
|
||||
#FieldConfigSource: {
|
||||
// Defaults are the options applied to all fields.
|
||||
defaults: #FieldConfig
|
||||
// Overrides are the options applied to specific fields overriding the defaults.
|
||||
overrides: [...{
|
||||
matcher: #MatcherConfig
|
||||
properties: [...#DynamicConfigValue]
|
||||
}] @grafanamaturity(NeedsExpertReview)
|
||||
} @cuetsy(kind="interface") @grafana(TSVeneer="type") @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// A library panel is a reusable panel that you can use in any dashboard.
|
||||
// When you make a change to a library panel, that change propagates to all instances of where the panel is used.
|
||||
// Library panels streamline reuse of panels across multiple dashboards.
|
||||
#LibraryPanelRef: {
|
||||
// Library panel name
|
||||
name: string
|
||||
uid: string
|
||||
// Library panel uid
|
||||
uid: string
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
// Matcher is a predicate configuration. Based on the config a set of field(s) or values is filtered in order to apply override / transformation.
|
||||
// It comes with in id ( to resolve implementation from registry) and a configuration that’s specific to a particular matcher type.
|
||||
#MatcherConfig: {
|
||||
id: string | *"" @grafanamaturity(NeedsExpertReview)
|
||||
options?: _ @grafanamaturity(NeedsExpertReview)
|
||||
// The matcher id. This is used to find the matcher implementation from registry.
|
||||
id: string | *"" @grafanamaturity(NeedsExpertReview)
|
||||
// The matcher options. This is specific to the matcher implementation.
|
||||
options?: _ @grafanamaturity(NeedsExpertReview)
|
||||
} @cuetsy(kind="interface") @grafana(TSVeneer="type")
|
||||
|
||||
#DynamicConfigValue: {
|
||||
@ -512,6 +625,9 @@ lineage: schemas: [{
|
||||
value?: _ @grafanamaturity(NeedsExpertReview)
|
||||
}
|
||||
|
||||
// The data model used in Grafana, namely the data frame, is a columnar-oriented table structure that unifies both time series and table query results.
|
||||
// Each column within this structure is called a field. A field can represent a single time series or table column.
|
||||
// Field options allow you to change how the data is displayed in your visualizations.
|
||||
#FieldConfig: {
|
||||
// The display value for this field. This supports template variables blank is auto
|
||||
displayName?: string @grafanamaturity(NeedsExpertReview)
|
||||
@ -530,19 +646,33 @@ lineage: schemas: [{
|
||||
// may be used to update the results
|
||||
path?: string @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// True if data source can write a value to the path. Auth/authz are supported separately
|
||||
// True if data source can write a value to the path. Auth/authz are supported separately
|
||||
writeable?: bool @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// True if data source field supports ad-hoc filters
|
||||
filterable?: bool @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// Numeric Options
|
||||
// Unit a field should use. The unit you select is applied to all fields except time.
|
||||
// You can use the units ID availables in Grafana or a custom unit.
|
||||
// Available units in Grafana: https://github.com/grafana/grafana/blob/main/packages/grafana-data/src/valueFormats/categories.ts
|
||||
// As custom unit, you can use the following formats:
|
||||
// `suffix:<suffix>` for custom unit that should go after value.
|
||||
// `prefix:<prefix>` for custom unit that should go before value.
|
||||
// `time:<format>` For custom date time formats type for example `time:YYYY-MM-DD`.
|
||||
// `si:<base scale><unit characters>` for custom SI units. For example: `si: mF`. This one is a bit more advanced as you can specify both a unit and the source data scale. So if your source data is represented as milli (thousands of) something prefix the unit with that SI scale character.
|
||||
// `count:<unit>` for a custom count unit.
|
||||
// `currency:<unit>` for custom a currency unit.
|
||||
unit?: string @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// Significant digits (for display)
|
||||
// Specify the number of decimals Grafana includes in the rendered value.
|
||||
// If you leave this field blank, Grafana automatically truncates the number of decimals based on the value.
|
||||
// For example 1.1234 will display as 1.12 and 100.456 will display as 100.
|
||||
// To display all decimals, set the unit to `String`.
|
||||
decimals?: number @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// The minimum value used in percentage threshold calculations. Leave blank for auto calculation based on all series and fields.
|
||||
min?: number @grafanamaturity(NeedsExpertReview)
|
||||
// The maximum value used in percentage threshold calculations. Leave blank for auto calculation based on all series and fields.
|
||||
max?: number @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// Convert input values into a display string
|
||||
@ -551,11 +681,8 @@ lineage: schemas: [{
|
||||
// Map numeric values to states
|
||||
thresholds?: #ThresholdsConfig @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// Map values to a display color
|
||||
color?: #FieldColor @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// Used when reducing field values
|
||||
// nullValueMode?: NullValueMode
|
||||
// Panel color configuration
|
||||
color?: #FieldColor
|
||||
|
||||
// The behavior when clicking on a result
|
||||
links?: [...] @grafanamaturity(NeedsExpertReview)
|
||||
@ -570,26 +697,35 @@ lineage: schemas: [{
|
||||
|
||||
// Row panel
|
||||
#RowPanel: {
|
||||
type: "row" @grafanamaturity(NeedsExpertReview)
|
||||
collapsed: bool | *false @grafanamaturity(NeedsExpertReview)
|
||||
title?: string @grafanamaturity(NeedsExpertReview)
|
||||
// The panel type
|
||||
type: "row"
|
||||
|
||||
// Name of default datasource.
|
||||
datasource?: {
|
||||
type?: string @grafanamaturity(NeedsExpertReview)
|
||||
uid?: string @grafanamaturity(NeedsExpertReview)
|
||||
} @grafanamaturity(NeedsExpertReview)
|
||||
// Whether this row should be collapsed or not.
|
||||
collapsed: bool | *false
|
||||
|
||||
// Row title
|
||||
title?: string
|
||||
|
||||
// Name of default datasource for the row
|
||||
datasource?: #DataSourceRef
|
||||
|
||||
// Row grid position
|
||||
gridPos?: #GridPos
|
||||
id: uint32 @grafanamaturity(NeedsExpertReview)
|
||||
panels: [...(#Panel | #GraphPanel | #HeatmapPanel)] @grafanamaturity(NeedsExpertReview)
|
||||
// Name of template variable to repeat for.
|
||||
repeat?: string @grafanamaturity(NeedsExpertReview)
|
||||
} @cuetsy(kind="interface") @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// Support for legacy graph and heatmap panels.
|
||||
// Unique identifier of the panel. Generated by Grafana when creating a new panel. It must be unique within a dashboard, but not globally.
|
||||
id: uint32
|
||||
|
||||
// List of panels in the row
|
||||
panels: [...(#Panel | #GraphPanel | #HeatmapPanel)]
|
||||
|
||||
// Name of template variable to repeat for.
|
||||
repeat?: string
|
||||
} @cuetsy(kind="interface") @grafana(TSVeneer="type")
|
||||
|
||||
// Support for legacy graph panel.
|
||||
// @deprecated this a deprecated panel type
|
||||
#GraphPanel: {
|
||||
type: "graph" @grafanamaturity(NeedsExpertReview)
|
||||
type: "graph"
|
||||
// @deprecated this is part of deprecated graph panel
|
||||
legend?: {
|
||||
show: bool | *true
|
||||
@ -597,12 +733,14 @@ lineage: schemas: [{
|
||||
sortDesc?: bool
|
||||
}
|
||||
...
|
||||
} @cuetsy(kind="interface") @grafanamaturity(NeedsExpertReview)
|
||||
} @cuetsy(kind="interface")
|
||||
|
||||
// Support for legacy heatmap panel.
|
||||
// @deprecated this a deprecated panel type
|
||||
#HeatmapPanel: {
|
||||
type: "heatmap" @grafanamaturity(NeedsExpertReview)
|
||||
type: "heatmap"
|
||||
...
|
||||
} @cuetsy(kind="interface") @grafanamaturity(NeedsExpertReview)
|
||||
} @cuetsy(kind="interface")
|
||||
}
|
||||
},
|
||||
]
|
||||
|
@ -22,22 +22,18 @@ export { defaultAccessPolicy } from './raw/accesspolicy/x/accesspolicy_types.gen
|
||||
export type {
|
||||
AnnotationTarget,
|
||||
AnnotationPanelFilter,
|
||||
VariableOption,
|
||||
DashboardLink,
|
||||
DashboardLinkType,
|
||||
VariableType,
|
||||
FieldColorSeriesByMode,
|
||||
FieldColor,
|
||||
GridPos,
|
||||
Threshold,
|
||||
ThresholdsConfig,
|
||||
ValueMapping,
|
||||
ValueMap,
|
||||
RangeMap,
|
||||
RegexMap,
|
||||
SpecialValueMap,
|
||||
ValueMappingResult,
|
||||
LibraryPanelRef,
|
||||
RowPanel,
|
||||
GraphPanel,
|
||||
HeatmapPanel
|
||||
} from './raw/dashboard/x/dashboard_types.gen';
|
||||
@ -46,17 +42,17 @@ export type {
|
||||
export {
|
||||
defaultAnnotationTarget,
|
||||
defaultAnnotationPanelFilter,
|
||||
VariableRefresh,
|
||||
VariableSort,
|
||||
LoadingState,
|
||||
defaultDashboardLink,
|
||||
FieldColorModeId,
|
||||
defaultGridPos,
|
||||
ThresholdsMode,
|
||||
defaultThresholdsConfig,
|
||||
MappingType,
|
||||
SpecialValueMatch,
|
||||
DashboardCursorSync,
|
||||
defaultDashboardCursorSync,
|
||||
defaultRowPanel
|
||||
defaultDashboardCursorSync
|
||||
} from './raw/dashboard/x/dashboard_types.gen';
|
||||
|
||||
// The following exported declarations correspond to types in the dashboard@0.0 kind's
|
||||
@ -74,11 +70,16 @@ export type {
|
||||
AnnotationQuery,
|
||||
VariableModel,
|
||||
DataSourceRef,
|
||||
Threshold,
|
||||
ThresholdsConfig,
|
||||
ValueMapping,
|
||||
RangeMap,
|
||||
DataTransformerConfig,
|
||||
Panel,
|
||||
FieldConfigSource,
|
||||
MatcherConfig,
|
||||
FieldConfig
|
||||
FieldConfig,
|
||||
RowPanel
|
||||
} from './veneer/dashboard.types';
|
||||
|
||||
// The following exported declarations correspond to types in the dashboard@0.0 kind's
|
||||
@ -96,10 +97,12 @@ export {
|
||||
defaultAnnotationQuery,
|
||||
defaultVariableModel,
|
||||
VariableHide,
|
||||
defaultThresholdsConfig,
|
||||
defaultPanel,
|
||||
defaultFieldConfigSource,
|
||||
defaultMatcherConfig,
|
||||
defaultFieldConfig
|
||||
defaultFieldConfig,
|
||||
defaultRowPanel
|
||||
} from './veneer/dashboard.types';
|
||||
|
||||
// Raw generated types from Folder kind.
|
||||
|
@ -56,9 +56,15 @@ export const defaultAnnotationPanelFilter: Partial<AnnotationPanelFilter> = {
|
||||
};
|
||||
|
||||
/**
|
||||
* TODO -- should not be a public interface on its own, but required for Veneer
|
||||
* Contains the list of annotations that are associated with the dashboard.
|
||||
* Annotations are used to overlay event markers and overlay event tags on graphs.
|
||||
* Grafana comes with a native annotation store and the ability to add annotation events directly from the graph panel or via the HTTP API.
|
||||
* See https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/annotate-visualizations/
|
||||
*/
|
||||
export interface AnnotationContainer {
|
||||
/**
|
||||
* List of annotations
|
||||
*/
|
||||
list?: Array<AnnotationQuery>;
|
||||
}
|
||||
|
||||
@ -111,6 +117,137 @@ export const defaultAnnotationQuery: Partial<AnnotationQuery> = {
|
||||
hide: false,
|
||||
};
|
||||
|
||||
/**
|
||||
* A variable is a placeholder for a value. You can use variables in metric queries and in panel titles.
|
||||
*/
|
||||
export interface VariableModel {
|
||||
/**
|
||||
* Format to use while fetching all values from data source, eg: wildcard, glob, regex, pipe, etc.
|
||||
*/
|
||||
allFormat?: string;
|
||||
/**
|
||||
* Shows current selected variable text/value on the dashboard
|
||||
*/
|
||||
current?: VariableOption;
|
||||
/**
|
||||
* Data source used to fetch values for a variable. It can be defined but `null`.
|
||||
*/
|
||||
datasource?: DataSourceRef;
|
||||
/**
|
||||
* Description of variable. It can be defined but `null`.
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* Visibility configuration for the variable
|
||||
*/
|
||||
hide: VariableHide;
|
||||
/**
|
||||
* Unique numeric identifier for the variable.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Optional display name
|
||||
*/
|
||||
label?: string;
|
||||
/**
|
||||
* Whether multiple values can be selected or not from variable value list
|
||||
*/
|
||||
multi?: boolean;
|
||||
/**
|
||||
* Name of variable
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Options that can be selected for a variable.
|
||||
*/
|
||||
options?: Array<VariableOption>;
|
||||
/**
|
||||
* Query used to fetch values for a variable
|
||||
*/
|
||||
query?: (string | Record<string, unknown>);
|
||||
refresh?: VariableRefresh;
|
||||
/**
|
||||
* Whether the variable value should be managed by URL query params or not
|
||||
*/
|
||||
skipUrlSync: boolean;
|
||||
/**
|
||||
* Type of variable
|
||||
*/
|
||||
type: VariableType;
|
||||
}
|
||||
|
||||
export const defaultVariableModel: Partial<VariableModel> = {
|
||||
id: '00000000-0000-0000-0000-000000000000',
|
||||
multi: false,
|
||||
options: [],
|
||||
skipUrlSync: false,
|
||||
};
|
||||
|
||||
/**
|
||||
* Option to be selected in a variable.
|
||||
*/
|
||||
export interface VariableOption {
|
||||
/**
|
||||
* Whether the option is selected or not
|
||||
*/
|
||||
selected?: boolean;
|
||||
/**
|
||||
* Text to be displayed for the option
|
||||
*/
|
||||
text: (string | Array<string>);
|
||||
/**
|
||||
* Value of the option
|
||||
*/
|
||||
value: (string | Array<string>);
|
||||
}
|
||||
|
||||
/**
|
||||
* Options to config when to refresh a variable
|
||||
* `0`: Never refresh the variable
|
||||
* `1`: Queries the data source every time the dashboard loads.
|
||||
* `2`: Queries the data source when the dashboard time range changes.
|
||||
*/
|
||||
export enum VariableRefresh {
|
||||
never = 0,
|
||||
onDashboardLoad = 1,
|
||||
onTimeRangeChanged = 2,
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the variable shows on dashboard
|
||||
* Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing).
|
||||
*/
|
||||
export enum VariableHide {
|
||||
dontHide = 0,
|
||||
hideLabel = 1,
|
||||
hideVariable = 2,
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort variable options
|
||||
* Accepted values are:
|
||||
* `0`: No sorting
|
||||
* `1`: Alphabetical ASC
|
||||
* `2`: Alphabetical DESC
|
||||
* `3`: Numerical ASC
|
||||
* `4`: Numerical DESC
|
||||
* `5`: Alphabetical Case Insensitive ASC
|
||||
* `6`: Alphabetical Case Insensitive DESC
|
||||
*/
|
||||
export enum VariableSort {
|
||||
alphabeticalAsc = 1,
|
||||
alphabeticalCaseInsensitiveAsc = 5,
|
||||
alphabeticalCaseInsensitiveDesc = 6,
|
||||
alphabeticalDesc = 2,
|
||||
disabled = 0,
|
||||
numericalAsc = 3,
|
||||
numericalDesc = 4,
|
||||
}
|
||||
|
||||
/**
|
||||
* Loading status
|
||||
* Accepted values are `NotStarted` (the request is not started), `Loading` (waiting for response), `Streaming` (pulling continuous data), `Done` (response received successfully) or `Error` (failed request).
|
||||
*/
|
||||
export enum LoadingState {
|
||||
Done = 'Done',
|
||||
Error = 'Error',
|
||||
@ -119,45 +256,6 @@ export enum LoadingState {
|
||||
Streaming = 'Streaming',
|
||||
}
|
||||
|
||||
/**
|
||||
* FROM: packages/grafana-data/src/types/templateVars.ts
|
||||
* TODO docs
|
||||
* TODO what about what's in public/app/features/types.ts?
|
||||
* TODO there appear to be a lot of different kinds of [template] vars here? if so need a disjunction
|
||||
*/
|
||||
export interface VariableModel {
|
||||
datasource?: DataSourceRef;
|
||||
description?: string;
|
||||
error?: Record<string, unknown>;
|
||||
global: boolean;
|
||||
hide: VariableHide;
|
||||
id: string;
|
||||
index: number;
|
||||
label?: string;
|
||||
name: string;
|
||||
/**
|
||||
* TODO: Move this into a separated QueryVariableModel type
|
||||
*/
|
||||
query?: (string | Record<string, unknown>);
|
||||
rootStateKey?: string;
|
||||
skipUrlSync: boolean;
|
||||
state: LoadingState;
|
||||
type: VariableType;
|
||||
}
|
||||
|
||||
export const defaultVariableModel: Partial<VariableModel> = {
|
||||
global: false,
|
||||
id: '00000000-0000-0000-0000-000000000000',
|
||||
index: -1,
|
||||
skipUrlSync: false,
|
||||
};
|
||||
|
||||
export enum VariableHide {
|
||||
dontHide = 0,
|
||||
hideLabel = 1,
|
||||
hideVariable = 2,
|
||||
}
|
||||
|
||||
/**
|
||||
* Ref to a DataSource instance
|
||||
*/
|
||||
@ -232,65 +330,101 @@ export const defaultDashboardLink: Partial<DashboardLink> = {
|
||||
export type DashboardLinkType = ('link' | 'dashboards');
|
||||
|
||||
/**
|
||||
* FROM: packages/grafana-data/src/types/templateVars.ts
|
||||
* TODO docs
|
||||
* TODO this implies some wider pattern/discriminated union, probably?
|
||||
* Dashboard variable type
|
||||
* `query`: Query-generated list of values such as metric names, server names, sensor IDs, data centers, and so on.
|
||||
* `adhoc`: Key/value filters that are automatically added to all metric queries for a data source (Prometheus, Loki, InfluxDB, and Elasticsearch only).
|
||||
* `constant`: Define a hidden constant.
|
||||
* `datasource`: Quickly change the data source for an entire dashboard.
|
||||
* `interval`: Interval variables represent time spans.
|
||||
* `textbox`: Display a free text input field with an optional default value.
|
||||
* `custom`: Define the variable options manually using a comma-separated list.
|
||||
* `system`: Variables defined by Grafana. See: https://grafana.com/docs/grafana/latest/dashboards/variables/add-template-variables/#global-variables
|
||||
*/
|
||||
export type VariableType = ('query' | 'adhoc' | 'constant' | 'datasource' | 'interval' | 'textbox' | 'custom' | 'system');
|
||||
|
||||
/**
|
||||
* TODO docs
|
||||
* Color mode for a field. You can specify a single color, or select a continuous (gradient) color schemes, based on a value.
|
||||
* Continuous color interpolates a color using the percentage of a value relative to min and max.
|
||||
* Accepted values are:
|
||||
* `thresholds`: From thresholds. Informs Grafana to take the color from the matching threshold
|
||||
* `palette-classic`: Classic palette. Grafana will assign color by looking up a color in a palette by series index. Useful for Graphs and pie charts and other categorical data visualizations
|
||||
* `palette-classic-by-name`: Classic palette (by name). Grafana will assign color by looking up a color in a palette by series name. Useful for Graphs and pie charts and other categorical data visualizations
|
||||
* `continuous-GrYlRd`: ontinuous Green-Yellow-Red palette mode
|
||||
* `continuous-RdYlGr`: Continuous Red-Yellow-Green palette mode
|
||||
* `continuous-BlYlRd`: Continuous Blue-Yellow-Red palette mode
|
||||
* `continuous-YlRd`: Continuous Yellow-Red palette mode
|
||||
* `continuous-BlPu`: Continuous Blue-Purple palette mode
|
||||
* `continuous-YlBl`: Continuous Yellow-Blue palette mode
|
||||
* `continuous-blues`: Continuous Blue palette mode
|
||||
* `continuous-reds`: Continuous Red palette mode
|
||||
* `continuous-greens`: Continuous Green palette mode
|
||||
* `continuous-purples`: Continuous Purple palette mode
|
||||
* `shades`: Shades of a single color. Specify a single color, useful in an override rule.
|
||||
* `fixed`: Fixed color mode. Specify a single color, useful in an override rule.
|
||||
*/
|
||||
export enum FieldColorModeId {
|
||||
ContinuousBlPu = 'continuous-BlPu',
|
||||
ContinuousBlYlRd = 'continuous-BlYlRd',
|
||||
ContinuousBlues = 'continuous-blues',
|
||||
ContinuousGrYlRd = 'continuous-GrYlRd',
|
||||
ContinuousGreens = 'continuous-greens',
|
||||
ContinuousPurples = 'continuous-purples',
|
||||
ContinuousRdYlGr = 'continuous-RdYlGr',
|
||||
ContinuousReds = 'continuous-reds',
|
||||
ContinuousYlBl = 'continuous-YlBl',
|
||||
ContinuousYlRd = 'continuous-YlRd',
|
||||
Fixed = 'fixed',
|
||||
PaletteClassic = 'palette-classic',
|
||||
PaletteSaturated = 'palette-saturated',
|
||||
PaletteClassicByName = 'palette-classic-by-name',
|
||||
Shades = 'shades',
|
||||
Thresholds = 'thresholds',
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO docs
|
||||
* Defines how to assign a series color from "by value" color schemes. For example for an aggregated data points like a timeseries, the color can be assigned by the min, max or last value.
|
||||
*/
|
||||
export type FieldColorSeriesByMode = ('min' | 'max' | 'last');
|
||||
|
||||
/**
|
||||
* TODO docs
|
||||
* Map a field to a color.
|
||||
*/
|
||||
export interface FieldColor {
|
||||
/**
|
||||
* Stores the fixed color value if mode is fixed
|
||||
* The fixed color value for fixed or shades color modes.
|
||||
*/
|
||||
fixedColor?: string;
|
||||
/**
|
||||
* The main color scheme mode
|
||||
* The main color scheme mode.
|
||||
*/
|
||||
mode: (FieldColorModeId | string);
|
||||
mode: FieldColorModeId;
|
||||
/**
|
||||
* Some visualizations need to know how to assign a series color from by value color schemes
|
||||
* Some visualizations need to know how to assign a series color from by value color schemes.
|
||||
*/
|
||||
seriesBy?: FieldColorSeriesByMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Position and dimensions of a panel in the grid
|
||||
*/
|
||||
export interface GridPos {
|
||||
/**
|
||||
* Panel
|
||||
* Panel height. The height is the number of rows from the top edge of the panel.
|
||||
*/
|
||||
h: number;
|
||||
/**
|
||||
* Whether the panel is fixed within the grid
|
||||
* Whether the panel is fixed within the grid. If true, the panel will not be affected by other panels' interactions
|
||||
*/
|
||||
static?: boolean;
|
||||
/**
|
||||
* Panel
|
||||
* Panel width. The width is the number of columns from the left edge of the panel.
|
||||
*/
|
||||
w: number;
|
||||
/**
|
||||
* Panel x
|
||||
* Panel x. The x coordinate is the number of columns from the left edge of the grid
|
||||
*/
|
||||
x: number;
|
||||
/**
|
||||
* Panel y
|
||||
* Panel y. The y coordinate is the number of rows from the top edge of the grid
|
||||
*/
|
||||
y: number;
|
||||
}
|
||||
@ -311,32 +445,28 @@ export interface Threshold {
|
||||
* Color represents the color of the visual change that will occur in the dashboard when the threshold value is met or exceeded.
|
||||
*/
|
||||
color: string;
|
||||
/**
|
||||
* Threshold index, an old property that is not needed an should only appear in older dashboards
|
||||
*/
|
||||
index?: number;
|
||||
/**
|
||||
* TODO docs
|
||||
* TODO are the values here enumerable into a disjunction?
|
||||
* Some seem to be listed in typescript comment
|
||||
*/
|
||||
state?: string;
|
||||
/**
|
||||
* Value represents a specified metric for the threshold, which triggers a visual change in the dashboard when this value is met or exceeded.
|
||||
* FIXME the corresponding typescript field is required/non-optional, but nulls currently appear here when serializing -Infinity to JSON
|
||||
* Nulls currently appear here when serializing -Infinity to JSON.
|
||||
*/
|
||||
value?: number;
|
||||
value: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Thresholds can either be absolute (specific number) or percentage (relative to min or max).
|
||||
* Thresholds can either be `absolute` (specific number) or `percentage` (relative to min or max, it will be values between 0 and 1).
|
||||
*/
|
||||
export enum ThresholdsMode {
|
||||
Absolute = 'absolute',
|
||||
Percentage = 'percentage',
|
||||
}
|
||||
|
||||
/**
|
||||
* Thresholds configuration for the panel
|
||||
*/
|
||||
export interface ThresholdsConfig {
|
||||
/**
|
||||
* Thresholds mode.
|
||||
*/
|
||||
mode: ThresholdsMode;
|
||||
/**
|
||||
* Must be sorted by 'value', first value is always -Infinity
|
||||
@ -355,6 +485,10 @@ export type ValueMapping = (ValueMap | RangeMap | RegexMap | SpecialValueMap);
|
||||
|
||||
/**
|
||||
* Supported value mapping types
|
||||
* `value`: Maps text values to a color or different display text and color. For example, you can configure a value mapping so that all instances of the value 10 appear as Perfection! rather than the number.
|
||||
* `range`: Maps numerical ranges to a display text and color. For example, if a value is within a certain range, you can configure a range value mapping to display Low or High rather than the number.
|
||||
* `regex`: Maps regular expressions to replacement text and a color. For example, if a value is www.example.com, you can configure a regex value mapping so that Grafana displays www and truncates the domain.
|
||||
* `special`: Maps special values like Null, NaN (not a number), and boolean values like true and false to a display text and color. See SpecialValueMatch to see the list of special values. For example, you can configure a special value mapping so that null values appear as N/A.
|
||||
*/
|
||||
export enum MappingType {
|
||||
RangeToText = 'range',
|
||||
@ -364,54 +498,84 @@ export enum MappingType {
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps text values to a color or different display text
|
||||
* Maps text values to a color or different display text and color.
|
||||
* For example, you can configure a value mapping so that all instances of the value 10 appear as Perfection! rather than the number.
|
||||
*/
|
||||
export interface ValueMap {
|
||||
/**
|
||||
* Map with <value_to_match>: ValueMappingResult. For example: { "10": { text: "Perfection!", color: "green" } }
|
||||
*/
|
||||
options: Record<string, ValueMappingResult>;
|
||||
type: MappingType.ValueToText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps numeric ranges to a color or different display text
|
||||
* Maps numerical ranges to a display text and color.
|
||||
* For example, if a value is within a certain range, you can configure a range value mapping to display Low or High rather than the number.
|
||||
*/
|
||||
export interface RangeMap {
|
||||
/**
|
||||
* Range to match against and the result to apply when the value is within the range
|
||||
*/
|
||||
options: {
|
||||
/**
|
||||
* to and from are `number | null` in current ts, really not sure what to do
|
||||
* Min value of the range. It can be null which means -Infinity
|
||||
*/
|
||||
from: number;
|
||||
/**
|
||||
* Max value of the range. It can be null which means +Infinity
|
||||
*/
|
||||
to: number;
|
||||
/**
|
||||
* Config to apply when the value is within the range
|
||||
*/
|
||||
result: ValueMappingResult;
|
||||
};
|
||||
type: MappingType.RangeToText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps regular expressions to replacement text and a color
|
||||
* Maps regular expressions to replacement text and a color.
|
||||
* For example, if a value is www.example.com, you can configure a regex value mapping so that Grafana displays www and truncates the domain.
|
||||
*/
|
||||
export interface RegexMap {
|
||||
/**
|
||||
* Regular expression to match against and the result to apply when the value matches the regex
|
||||
*/
|
||||
options: {
|
||||
/**
|
||||
* Regular expression to match against
|
||||
*/
|
||||
pattern: string;
|
||||
/**
|
||||
* Config to apply when the value matches the regex
|
||||
*/
|
||||
result: ValueMappingResult;
|
||||
};
|
||||
type: MappingType.RegexToText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps special values like Null, NaN (not a number), and boolean values like true and false to a display text
|
||||
* and color
|
||||
* Maps special values like Null, NaN (not a number), and boolean values like true and false to a display text and color.
|
||||
* See SpecialValueMatch to see the list of special values.
|
||||
* For example, you can configure a special value mapping so that null values appear as N/A.
|
||||
*/
|
||||
export interface SpecialValueMap {
|
||||
options: {
|
||||
match: ('true' | 'false');
|
||||
pattern: string;
|
||||
/**
|
||||
* Special value to match against
|
||||
*/
|
||||
match: SpecialValueMatch;
|
||||
/**
|
||||
* Config to apply when the value matches the special value
|
||||
*/
|
||||
result: ValueMappingResult;
|
||||
};
|
||||
type: MappingType.SpecialValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Special value types supported by the SpecialValueMap
|
||||
* Special value types supported by the `SpecialValueMap`
|
||||
*/
|
||||
export enum SpecialValueMatch {
|
||||
Empty = 'empty',
|
||||
@ -423,17 +587,31 @@ export enum SpecialValueMatch {
|
||||
}
|
||||
|
||||
/**
|
||||
* Result used as replacement text and color for RegexMap and SpecialValueMap
|
||||
* Result used as replacement with text and color when the value matches
|
||||
*/
|
||||
export interface ValueMappingResult {
|
||||
/**
|
||||
* Text to use when the value matches
|
||||
*/
|
||||
color?: string;
|
||||
/**
|
||||
* Icon to display when the value matches. Only specific visualizations.
|
||||
*/
|
||||
icon?: string;
|
||||
/**
|
||||
* Position in the mapping array. Only used internally.
|
||||
*/
|
||||
index?: number;
|
||||
/**
|
||||
* Text to display when the value matches
|
||||
*/
|
||||
text?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO docs
|
||||
* Transformations allow to manipulate data returned by a query before the system applies a visualization.
|
||||
* Using transformations you can: rename fields, join time series data, perform mathematical operations across queries,
|
||||
* use the output of one transformation as the input to another transformation, etc.
|
||||
*/
|
||||
export interface DataTransformerConfig {
|
||||
/**
|
||||
@ -441,7 +619,7 @@ export interface DataTransformerConfig {
|
||||
*/
|
||||
disabled?: boolean;
|
||||
/**
|
||||
* Optional frame matcher. When missing it will be applied to all results
|
||||
* Optional frame matcher. When missing it will be applied to all results
|
||||
*/
|
||||
filter?: MatcherConfig;
|
||||
/**
|
||||
@ -469,29 +647,27 @@ export enum DashboardCursorSync {
|
||||
export const defaultDashboardCursorSync: DashboardCursorSync = DashboardCursorSync.Off;
|
||||
|
||||
/**
|
||||
* Dashboard panels. Panels are canonically defined inline
|
||||
* because they share a version timeline with the dashboard
|
||||
* schema; they do not evolve independently.
|
||||
* Dashboard panels are the basic visualization building blocks.
|
||||
*/
|
||||
export interface Panel {
|
||||
/**
|
||||
* The datasource used in all targets.
|
||||
*/
|
||||
datasource?: {
|
||||
type?: string;
|
||||
uid?: string;
|
||||
};
|
||||
datasource?: DataSourceRef;
|
||||
/**
|
||||
* Description.
|
||||
* Panel description.
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* Field options allow you to change how the data is displayed in your visualizations.
|
||||
*/
|
||||
fieldConfig: FieldConfigSource;
|
||||
/**
|
||||
* Grid position.
|
||||
*/
|
||||
gridPos?: GridPos;
|
||||
/**
|
||||
* TODO docs
|
||||
* Unique identifier of the panel. Generated by Grafana when creating a new panel. It must be unique within a dashboard, but not globally.
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
@ -507,7 +683,6 @@ export interface Panel {
|
||||
libraryPanel?: LibraryPanelRef;
|
||||
/**
|
||||
* Panel links.
|
||||
* TODO fill this out - seems there are a couple variants?
|
||||
*/
|
||||
links?: Array<DashboardLink>;
|
||||
/**
|
||||
@ -515,12 +690,11 @@ export interface Panel {
|
||||
*/
|
||||
maxDataPoints?: number;
|
||||
/**
|
||||
* options is specified by the Options field in panel
|
||||
* plugin schemas.
|
||||
* It depends on the panel plugin. They are specified by the Options field in panel plugin schemas.
|
||||
*/
|
||||
options: Record<string, unknown>;
|
||||
/**
|
||||
* FIXME this almost certainly has to be changed in favor of scuemata versions
|
||||
* The version of the plugin that is used for this panel. This is used to find the plugin to display the panel and to migrate old panel configs.
|
||||
*/
|
||||
pluginVersion?: string;
|
||||
/**
|
||||
@ -529,26 +703,21 @@ export interface Panel {
|
||||
repeat?: string;
|
||||
/**
|
||||
* Direction to repeat in if 'repeat' is set.
|
||||
* "h" for horizontal, "v" for vertical.
|
||||
* TODO this is probably optional
|
||||
* `h` for horizontal, `v` for vertical.
|
||||
*/
|
||||
repeatDirection: ('h' | 'v');
|
||||
repeatDirection?: ('h' | 'v');
|
||||
/**
|
||||
* Id of the repeating panel.
|
||||
*/
|
||||
repeatPanelId?: number;
|
||||
/**
|
||||
* TODO docs
|
||||
* Tags for the panel.
|
||||
*/
|
||||
tags?: Array<string>;
|
||||
/**
|
||||
* TODO docs
|
||||
* Depends on the panel plugin. See the plugin documentation for details.
|
||||
*/
|
||||
targets?: Array<Record<string, unknown>>;
|
||||
/**
|
||||
* TODO docs - seems to be an old field from old dashboard alerts?
|
||||
*/
|
||||
thresholds?: Array<unknown>;
|
||||
/**
|
||||
* Overrides the relative time range for individual panels,
|
||||
* which causes them to be different than what is selected in
|
||||
@ -560,10 +729,6 @@ export interface Panel {
|
||||
* See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options
|
||||
*/
|
||||
timeFrom?: string;
|
||||
/**
|
||||
* TODO docs
|
||||
*/
|
||||
timeRegions?: Array<unknown>;
|
||||
/**
|
||||
* Overrides the time range for individual panels by shifting its start and end relative to the time picker.
|
||||
* For example, you can shift the time range for the panel to be two hours earlier than the dashboard time picker setting `2h`.
|
||||
@ -575,13 +740,18 @@ export interface Panel {
|
||||
* Panel title.
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* List of transformations that are applied to the panel data before rendering.
|
||||
* When there are multiple transformations, Grafana applies them in the order they are listed.
|
||||
* Each transformation creates a result set that then passes on to the next transformation in the processing pipeline.
|
||||
*/
|
||||
transformations: Array<DataTransformerConfig>;
|
||||
/**
|
||||
* Whether to display the panel without a background.
|
||||
*/
|
||||
transparent: boolean;
|
||||
/**
|
||||
* The panel plugin type id. May not be empty.
|
||||
* The panel plugin type id. This is used to find the plugin to display the panel.
|
||||
*/
|
||||
type: string;
|
||||
}
|
||||
@ -591,14 +761,23 @@ export const defaultPanel: Partial<Panel> = {
|
||||
repeatDirection: 'h',
|
||||
tags: [],
|
||||
targets: [],
|
||||
thresholds: [],
|
||||
timeRegions: [],
|
||||
transformations: [],
|
||||
transparent: false,
|
||||
};
|
||||
|
||||
/**
|
||||
* The data model used in Grafana, namely the data frame, is a columnar-oriented table structure that unifies both time series and table query results.
|
||||
* Each column within this structure is called a field. A field can represent a single time series or table column.
|
||||
* Field options allow you to change how the data is displayed in your visualizations.
|
||||
*/
|
||||
export interface FieldConfigSource {
|
||||
/**
|
||||
* Defaults are the options applied to all fields.
|
||||
*/
|
||||
defaults: FieldConfig;
|
||||
/**
|
||||
* Overrides are the options applied to specific fields overriding the defaults.
|
||||
*/
|
||||
overrides: Array<{
|
||||
matcher: MatcherConfig;
|
||||
properties: Array<{
|
||||
@ -612,13 +791,34 @@ export const defaultFieldConfigSource: Partial<FieldConfigSource> = {
|
||||
overrides: [],
|
||||
};
|
||||
|
||||
/**
|
||||
* A library panel is a reusable panel that you can use in any dashboard.
|
||||
* When you make a change to a library panel, that change propagates to all instances of where the panel is used.
|
||||
* Library panels streamline reuse of panels across multiple dashboards.
|
||||
*/
|
||||
export interface LibraryPanelRef {
|
||||
/**
|
||||
* Library panel name
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Library panel uid
|
||||
*/
|
||||
uid: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Matcher is a predicate configuration. Based on the config a set of field(s) or values is filtered in order to apply override / transformation.
|
||||
* It comes with in id ( to resolve implementation from registry) and a configuration that’s specific to a particular matcher type.
|
||||
*/
|
||||
export interface MatcherConfig {
|
||||
/**
|
||||
* The matcher id. This is used to find the matcher implementation from registry.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The matcher options. This is specific to the matcher implementation.
|
||||
*/
|
||||
options?: unknown;
|
||||
}
|
||||
|
||||
@ -626,9 +826,14 @@ export const defaultMatcherConfig: Partial<MatcherConfig> = {
|
||||
id: '',
|
||||
};
|
||||
|
||||
/**
|
||||
* The data model used in Grafana, namely the data frame, is a columnar-oriented table structure that unifies both time series and table query results.
|
||||
* Each column within this structure is called a field. A field can represent a single time series or table column.
|
||||
* Field options allow you to change how the data is displayed in your visualizations.
|
||||
*/
|
||||
export interface FieldConfig {
|
||||
/**
|
||||
* Map values to a display color
|
||||
* Panel color configuration
|
||||
*/
|
||||
color?: FieldColor;
|
||||
/**
|
||||
@ -637,7 +842,10 @@ export interface FieldConfig {
|
||||
*/
|
||||
custom?: Record<string, unknown>;
|
||||
/**
|
||||
* Significant digits (for display)
|
||||
* Specify the number of decimals Grafana includes in the rendered value.
|
||||
* If you leave this field blank, Grafana automatically truncates the number of decimals based on the value.
|
||||
* For example 1.1234 will display as 1.12 and 100.456 will display as 100.
|
||||
* To display all decimals, set the unit to `String`.
|
||||
*/
|
||||
decimals?: number;
|
||||
/**
|
||||
@ -665,7 +873,13 @@ export interface FieldConfig {
|
||||
* Convert input values into a display string
|
||||
*/
|
||||
mappings?: Array<ValueMapping>;
|
||||
/**
|
||||
* The maximum value used in percentage threshold calculations. Leave blank for auto calculation based on all series and fields.
|
||||
*/
|
||||
max?: number;
|
||||
/**
|
||||
* The minimum value used in percentage threshold calculations. Leave blank for auto calculation based on all series and fields.
|
||||
*/
|
||||
min?: number;
|
||||
/**
|
||||
* Alternative to empty string
|
||||
@ -684,11 +898,20 @@ export interface FieldConfig {
|
||||
*/
|
||||
thresholds?: ThresholdsConfig;
|
||||
/**
|
||||
* Numeric Options
|
||||
* Unit a field should use. The unit you select is applied to all fields except time.
|
||||
* You can use the units ID availables in Grafana or a custom unit.
|
||||
* Available units in Grafana: https://github.com/grafana/grafana/blob/main/packages/grafana-data/src/valueFormats/categories.ts
|
||||
* As custom unit, you can use the following formats:
|
||||
* `suffix:<suffix>` for custom unit that should go after value.
|
||||
* `prefix:<prefix>` for custom unit that should go before value.
|
||||
* `time:<format>` For custom date time formats type for example `time:YYYY-MM-DD`.
|
||||
* `si:<base scale><unit characters>` for custom SI units. For example: `si: mF`. This one is a bit more advanced as you can specify both a unit and the source data scale. So if your source data is represented as milli (thousands of) something prefix the unit with that SI scale character.
|
||||
* `count:<unit>` for a custom count unit.
|
||||
* `currency:<unit>` for custom a currency unit.
|
||||
*/
|
||||
unit?: string;
|
||||
/**
|
||||
* True if data source can write a value to the path. Auth/authz are supported separately
|
||||
* True if data source can write a value to the path. Auth/authz are supported separately
|
||||
*/
|
||||
writeable?: boolean;
|
||||
}
|
||||
@ -702,22 +925,37 @@ export const defaultFieldConfig: Partial<FieldConfig> = {
|
||||
* Row panel
|
||||
*/
|
||||
export interface RowPanel {
|
||||
/**
|
||||
* Whether this row should be collapsed or not.
|
||||
*/
|
||||
collapsed: boolean;
|
||||
/**
|
||||
* Name of default datasource.
|
||||
* Name of default datasource for the row
|
||||
*/
|
||||
datasource?: DataSourceRef;
|
||||
/**
|
||||
* Row grid position
|
||||
*/
|
||||
datasource?: {
|
||||
type?: string;
|
||||
uid?: string;
|
||||
};
|
||||
gridPos?: GridPos;
|
||||
/**
|
||||
* Unique identifier of the panel. Generated by Grafana when creating a new panel. It must be unique within a dashboard, but not globally.
|
||||
*/
|
||||
id: number;
|
||||
/**
|
||||
* List of panels in the row
|
||||
*/
|
||||
panels: Array<(Panel | GraphPanel | HeatmapPanel)>;
|
||||
/**
|
||||
* Name of template variable to repeat for.
|
||||
*/
|
||||
repeat?: string;
|
||||
/**
|
||||
* Row title
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* The panel type
|
||||
*/
|
||||
type: 'row';
|
||||
}
|
||||
|
||||
@ -727,7 +965,8 @@ export const defaultRowPanel: Partial<RowPanel> = {
|
||||
};
|
||||
|
||||
/**
|
||||
* Support for legacy graph and heatmap panels.
|
||||
* Support for legacy graph panel.
|
||||
* @deprecated this a deprecated panel type
|
||||
*/
|
||||
export interface GraphPanel {
|
||||
/**
|
||||
@ -741,13 +980,20 @@ export interface GraphPanel {
|
||||
type: 'graph';
|
||||
}
|
||||
|
||||
/**
|
||||
* Support for legacy heatmap panel.
|
||||
* @deprecated this a deprecated panel type
|
||||
*/
|
||||
export interface HeatmapPanel {
|
||||
type: 'heatmap';
|
||||
}
|
||||
|
||||
export interface Dashboard {
|
||||
/**
|
||||
* TODO docs
|
||||
* Contains the list of annotations that are associated with the dashboard.
|
||||
* Annotations are used to overlay event markers and overlay event tags on graphs.
|
||||
* Grafana comes with a native annotation store and the ability to add annotation events directly from the graph panel or via the HTTP API.
|
||||
* See https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/annotate-visualizations/
|
||||
*/
|
||||
annotations?: AnnotationContainer;
|
||||
/**
|
||||
@ -773,7 +1019,7 @@ export interface Dashboard {
|
||||
graphTooltip: DashboardCursorSync;
|
||||
/**
|
||||
* Unique numeric identifier for the dashboard.
|
||||
* TODO must isolate or remove identifiers local to a Grafana instance...?
|
||||
* `id` is internal to a specific Grafana instance. `uid` should be used to identify a dashboard across Grafana instances.
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
@ -782,10 +1028,13 @@ export interface Dashboard {
|
||||
links?: Array<DashboardLink>;
|
||||
/**
|
||||
* When set to true, the dashboard will redraw panels at an interval matching the pixel width.
|
||||
* This will keep data "moving left" regardless of the query refresh rate. This setting helps
|
||||
* This will keep data "moving left" regardless of the query refresh rate. This setting helps
|
||||
* avoid dashboards presenting stale live data
|
||||
*/
|
||||
liveNow?: boolean;
|
||||
/**
|
||||
* List of dashboard panels
|
||||
*/
|
||||
panels?: Array<(Panel | RowPanel | GraphPanel | HeatmapPanel)>;
|
||||
/**
|
||||
* Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d".
|
||||
@ -793,16 +1042,17 @@ export interface Dashboard {
|
||||
refresh?: (string | false);
|
||||
/**
|
||||
* This property should only be used in dashboards defined by plugins. It is a quick check
|
||||
* to see if the version has changed since the last time. Unclear why using the version property
|
||||
* is insufficient.
|
||||
* to see if the version has changed since the last time.
|
||||
*/
|
||||
revision?: number;
|
||||
/**
|
||||
* Version of the JSON schema, incremented each time a Grafana update brings
|
||||
* changes to said schema.
|
||||
* TODO this is the existing schema numbering system. It will be replaced by Thema's themaVersion
|
||||
*/
|
||||
schemaVersion: number;
|
||||
/**
|
||||
* Snapshot options. They are present only if the dashboard is a snapshot.
|
||||
*/
|
||||
snapshot?: {
|
||||
/**
|
||||
* Time when the snapshot was created
|
||||
@ -851,6 +1101,7 @@ export interface Dashboard {
|
||||
};
|
||||
/**
|
||||
* Theme of dashboard.
|
||||
* Default value: dark.
|
||||
*/
|
||||
style: ('light' | 'dark');
|
||||
/**
|
||||
@ -858,9 +1109,12 @@ export interface Dashboard {
|
||||
*/
|
||||
tags?: Array<string>;
|
||||
/**
|
||||
* Contains the list of configured template variables with their saved values along with some other metadata
|
||||
* Configured template variables
|
||||
*/
|
||||
templating?: {
|
||||
/**
|
||||
* List of configured template variables with their saved values along with some other metadata
|
||||
*/
|
||||
list?: Array<VariableModel>;
|
||||
};
|
||||
/**
|
||||
|
@ -6,33 +6,30 @@ import { DataQuery } from './common.types';
|
||||
export type { CommonDataSourceRef as DataSourceRef };
|
||||
|
||||
export interface Panel<TOptions = Record<string, unknown>, TCustomFieldConfig = Record<string, unknown>>
|
||||
extends raw.Panel {
|
||||
extends Omit<raw.Panel, 'fieldConfig'> {
|
||||
fieldConfig: FieldConfigSource<TCustomFieldConfig>;
|
||||
}
|
||||
|
||||
export interface RowPanel extends Omit<raw.RowPanel, 'panels'> {
|
||||
panels: Array<Panel | raw.GraphPanel | raw.HeatmapPanel>;
|
||||
}
|
||||
|
||||
export enum VariableHide {
|
||||
dontHide,
|
||||
hideLabel,
|
||||
hideVariable,
|
||||
}
|
||||
|
||||
export interface VariableModel
|
||||
extends Omit<raw.VariableModel, 'rootStateKey' | 'error' | 'description' | 'hide' | 'datasource'> {
|
||||
// Overrides nullable properties because CUE doesn't support null values
|
||||
// TODO remove explicit nulls
|
||||
rootStateKey: string | null;
|
||||
// TODO remove explicit nulls
|
||||
error: any | null;
|
||||
// TODO remove explicit nulls
|
||||
description: string | null;
|
||||
export interface VariableModel extends Omit<raw.VariableModel, 'hide' | 'description' | 'datasource'> {
|
||||
hide: VariableHide;
|
||||
// TODO remove explicit nulls
|
||||
datasource: CommonDataSourceRef | null;
|
||||
description?: string | null;
|
||||
datasource: DataSourceRef | null;
|
||||
}
|
||||
|
||||
export interface Dashboard extends Omit<raw.Dashboard, 'templating' | 'annotations'> {
|
||||
panels?: Array<Panel | raw.RowPanel | raw.GraphPanel | raw.HeatmapPanel>;
|
||||
export interface Dashboard extends Omit<raw.Dashboard, 'templating' | 'annotations' | 'thresholds' | 'panels'> {
|
||||
panels?: Array<Panel | RowPanel | raw.GraphPanel | raw.HeatmapPanel>;
|
||||
annotations?: AnnotationContainer;
|
||||
thresholds?: ThresholdsConfig;
|
||||
templating?: {
|
||||
list?: VariableModel[];
|
||||
};
|
||||
@ -48,11 +45,36 @@ export interface AnnotationContainer extends Omit<raw.AnnotationContainer, 'list
|
||||
list?: AnnotationQuery[]; // use the version from this file
|
||||
}
|
||||
|
||||
export interface FieldConfig<TOptions = Record<string, unknown>> extends raw.FieldConfig {
|
||||
custom?: TOptions & Record<string, unknown>;
|
||||
export interface Threshold extends Omit<raw.Threshold, 'value'> {
|
||||
// Value represents a lower bound of a threshold. This triggers a visual change in the dashboard when a graphed value is within the bounds of a threshold.
|
||||
// Nulls currently appear here when serializing -Infinity to JSON.
|
||||
value: number | null;
|
||||
}
|
||||
|
||||
export interface FieldConfigSource<TOptions = Record<string, unknown>> extends raw.FieldConfigSource {
|
||||
export interface ThresholdsConfig extends Omit<raw.ThresholdsConfig, 'steps'> {
|
||||
steps: Threshold[];
|
||||
}
|
||||
|
||||
export interface FieldConfig<TOptions = Record<string, unknown>> extends Omit<raw.FieldConfig, 'mappings'> {
|
||||
custom?: TOptions & Record<string, unknown>;
|
||||
mappings?: ValueMapping[];
|
||||
}
|
||||
|
||||
export type ValueMapping = raw.ValueMap | RangeMap | raw.RegexMap | raw.SpecialValueMap;
|
||||
|
||||
export interface RangeMap extends Omit<raw.RangeMap, 'options'> {
|
||||
// Range to match against and the result to apply when the value is within the range
|
||||
options: {
|
||||
// Min value of the range. It can be null which means -Infinity
|
||||
from: number | null;
|
||||
// Max value of the range. It can be null which means +Infinity
|
||||
to: number | null;
|
||||
// Config to apply when the value is within the range
|
||||
result: raw.ValueMappingResult;
|
||||
};
|
||||
}
|
||||
|
||||
export interface FieldConfigSource<TOptions = Record<string, unknown>> extends Omit<raw.FieldConfigSource, 'defaults'> {
|
||||
defaults: FieldConfig<TOptions>;
|
||||
}
|
||||
|
||||
@ -67,21 +89,16 @@ export interface DataTransformerConfig<TOptions = any> extends raw.DataTransform
|
||||
export const defaultDashboard = raw.defaultDashboard as Dashboard;
|
||||
export const defaultVariableModel = {
|
||||
...raw.defaultVariableModel,
|
||||
// TODO remove explicit nulls
|
||||
rootStateKey: null,
|
||||
// TODO remove explicit nulls
|
||||
error: null,
|
||||
// TODO remove explicit nulls
|
||||
description: null,
|
||||
hide: VariableHide.dontHide,
|
||||
state: raw.LoadingState.NotStarted,
|
||||
// TODO remove explicit nulls
|
||||
datasource: null,
|
||||
} as VariableModel;
|
||||
export const defaultPanel: Partial<Panel> = raw.defaultPanel;
|
||||
export const defaultRowPanel: Partial<Panel> = raw.defaultRowPanel;
|
||||
export const defaultFieldConfig: Partial<FieldConfig> = raw.defaultFieldConfig;
|
||||
export const defaultFieldConfigSource: Partial<FieldConfigSource> = raw.defaultFieldConfigSource;
|
||||
export const defaultMatcherConfig: Partial<MatcherConfig> = raw.defaultMatcherConfig;
|
||||
export const defaultAnnotationQuery: Partial<AnnotationQuery> = raw.defaultAnnotationQuery as AnnotationQuery;
|
||||
export const defaultAnnotationContainer: Partial<AnnotationContainer> =
|
||||
raw.defaultAnnotationContainer as AnnotationContainer;
|
||||
export const defaultThresholdsConfig: Partial<ThresholdsConfig> = raw.defaultThresholdsConfig as ThresholdsConfig;
|
||||
|
@ -26,6 +26,25 @@ const (
|
||||
LinkTypeLink LinkType = "link"
|
||||
)
|
||||
|
||||
// Defines values for FieldColorModeId.
|
||||
const (
|
||||
FieldColorModeIdContinuousBlPu FieldColorModeId = "continuous-BlPu"
|
||||
FieldColorModeIdContinuousBlYlRd FieldColorModeId = "continuous-BlYlRd"
|
||||
FieldColorModeIdContinuousBlues FieldColorModeId = "continuous-blues"
|
||||
FieldColorModeIdContinuousGrYlRd FieldColorModeId = "continuous-GrYlRd"
|
||||
FieldColorModeIdContinuousGreens FieldColorModeId = "continuous-greens"
|
||||
FieldColorModeIdContinuousPurples FieldColorModeId = "continuous-purples"
|
||||
FieldColorModeIdContinuousRdYlGr FieldColorModeId = "continuous-RdYlGr"
|
||||
FieldColorModeIdContinuousReds FieldColorModeId = "continuous-reds"
|
||||
FieldColorModeIdContinuousYlBl FieldColorModeId = "continuous-YlBl"
|
||||
FieldColorModeIdContinuousYlRd FieldColorModeId = "continuous-YlRd"
|
||||
FieldColorModeIdFixed FieldColorModeId = "fixed"
|
||||
FieldColorModeIdPaletteClassic FieldColorModeId = "palette-classic"
|
||||
FieldColorModeIdPaletteClassicByName FieldColorModeId = "palette-classic-by-name"
|
||||
FieldColorModeIdShades FieldColorModeId = "shades"
|
||||
FieldColorModeIdThresholds FieldColorModeId = "thresholds"
|
||||
)
|
||||
|
||||
// Defines values for FieldColorSeriesByMode.
|
||||
const (
|
||||
FieldColorSeriesByModeLast FieldColorSeriesByMode = "last"
|
||||
@ -43,15 +62,6 @@ const (
|
||||
HeatmapPanelTypeHeatmap HeatmapPanelType = "heatmap"
|
||||
)
|
||||
|
||||
// Defines values for LoadingState.
|
||||
const (
|
||||
LoadingStateDone LoadingState = "Done"
|
||||
LoadingStateError LoadingState = "Error"
|
||||
LoadingStateLoading LoadingState = "Loading"
|
||||
LoadingStateNotStarted LoadingState = "NotStarted"
|
||||
LoadingStateStreaming LoadingState = "Streaming"
|
||||
)
|
||||
|
||||
// Defines values for MappingType.
|
||||
const (
|
||||
MappingTypeRange MappingType = "range"
|
||||
@ -93,12 +103,6 @@ const (
|
||||
SpecStyleLight SpecStyle = "light"
|
||||
)
|
||||
|
||||
// Defines values for SpecialValueMapOptionsMatch.
|
||||
const (
|
||||
SpecialValueMapOptionsMatchFalse SpecialValueMapOptionsMatch = "false"
|
||||
SpecialValueMapOptionsMatchTrue SpecialValueMapOptionsMatch = "true"
|
||||
)
|
||||
|
||||
// Defines values for SpecialValueMapType.
|
||||
const (
|
||||
SpecialValueMapTypeRange SpecialValueMapType = "range"
|
||||
@ -107,6 +111,16 @@ const (
|
||||
SpecialValueMapTypeValue SpecialValueMapType = "value"
|
||||
)
|
||||
|
||||
// Defines values for SpecialValueMatch.
|
||||
const (
|
||||
SpecialValueMatchEmpty SpecialValueMatch = "empty"
|
||||
SpecialValueMatchFalse SpecialValueMatch = "false"
|
||||
SpecialValueMatchNan SpecialValueMatch = "nan"
|
||||
SpecialValueMatchNull SpecialValueMatch = "null"
|
||||
SpecialValueMatchNullNan SpecialValueMatch = "null+nan"
|
||||
SpecialValueMatchTrue SpecialValueMatch = "true"
|
||||
)
|
||||
|
||||
// Defines values for ThresholdsMode.
|
||||
const (
|
||||
ThresholdsModeAbsolute ThresholdsMode = "absolute"
|
||||
@ -128,6 +142,13 @@ const (
|
||||
VariableHideN2 VariableHide = 2
|
||||
)
|
||||
|
||||
// Defines values for VariableRefresh.
|
||||
const (
|
||||
VariableRefreshN0 VariableRefresh = 0
|
||||
VariableRefreshN1 VariableRefresh = 1
|
||||
VariableRefreshN2 VariableRefresh = 2
|
||||
)
|
||||
|
||||
// Defines values for VariableType.
|
||||
const (
|
||||
VariableTypeAdhoc VariableType = "adhoc"
|
||||
@ -140,8 +161,12 @@ const (
|
||||
VariableTypeTextbox VariableType = "textbox"
|
||||
)
|
||||
|
||||
// TODO -- should not be a public interface on its own, but required for Veneer
|
||||
// Contains the list of annotations that are associated with the dashboard.
|
||||
// Annotations are used to overlay event markers and overlay event tags on graphs.
|
||||
// Grafana comes with a native annotation store and the ability to add annotation events directly from the graph panel or via the HTTP API.
|
||||
// See https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/annotate-visualizations/
|
||||
type AnnotationContainer struct {
|
||||
// List of annotations
|
||||
List []AnnotationQuery `json:"list,omitempty"`
|
||||
}
|
||||
|
||||
@ -252,11 +277,16 @@ type DataSourceRef struct {
|
||||
Uid *string `json:"uid,omitempty"`
|
||||
}
|
||||
|
||||
// TODO docs
|
||||
// Transformations allow to manipulate data returned by a query before the system applies a visualization.
|
||||
// Using transformations you can: rename fields, join time series data, perform mathematical operations across queries,
|
||||
// use the output of one transformation as the input to another transformation, etc.
|
||||
type DataTransformerConfig struct {
|
||||
// Disabled transformations are skipped
|
||||
Disabled *bool `json:"disabled,omitempty"`
|
||||
Filter *MatcherConfig `json:"filter,omitempty"`
|
||||
Disabled *bool `json:"disabled,omitempty"`
|
||||
|
||||
// Matcher is a predicate configuration. Based on the config a set of field(s) or values is filtered in order to apply override / transformation.
|
||||
// It comes with in id ( to resolve implementation from registry) and a configuration that’s specific to a particular matcher type.
|
||||
Filter *MatcherConfig `json:"filter,omitempty"`
|
||||
|
||||
// Unique identifier of transformer
|
||||
Id string `json:"id"`
|
||||
@ -272,31 +302,73 @@ type DynamicConfigValue struct {
|
||||
Value *interface{} `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// TODO docs
|
||||
// Map a field to a color.
|
||||
type FieldColor struct {
|
||||
// Stores the fixed color value if mode is fixed
|
||||
// The fixed color value for fixed or shades color modes.
|
||||
FixedColor *string `json:"fixedColor,omitempty"`
|
||||
|
||||
// The main color scheme mode
|
||||
Mode string `json:"mode"`
|
||||
// Color mode for a field. You can specify a single color, or select a continuous (gradient) color schemes, based on a value.
|
||||
// Continuous color interpolates a color using the percentage of a value relative to min and max.
|
||||
// Accepted values are:
|
||||
// `thresholds`: From thresholds. Informs Grafana to take the color from the matching threshold
|
||||
// `palette-classic`: Classic palette. Grafana will assign color by looking up a color in a palette by series index. Useful for Graphs and pie charts and other categorical data visualizations
|
||||
// `palette-classic-by-name`: Classic palette (by name). Grafana will assign color by looking up a color in a palette by series name. Useful for Graphs and pie charts and other categorical data visualizations
|
||||
// `continuous-GrYlRd`: ontinuous Green-Yellow-Red palette mode
|
||||
// `continuous-RdYlGr`: Continuous Red-Yellow-Green palette mode
|
||||
// `continuous-BlYlRd`: Continuous Blue-Yellow-Red palette mode
|
||||
// `continuous-YlRd`: Continuous Yellow-Red palette mode
|
||||
// `continuous-BlPu`: Continuous Blue-Purple palette mode
|
||||
// `continuous-YlBl`: Continuous Yellow-Blue palette mode
|
||||
// `continuous-blues`: Continuous Blue palette mode
|
||||
// `continuous-reds`: Continuous Red palette mode
|
||||
// `continuous-greens`: Continuous Green palette mode
|
||||
// `continuous-purples`: Continuous Purple palette mode
|
||||
// `shades`: Shades of a single color. Specify a single color, useful in an override rule.
|
||||
// `fixed`: Fixed color mode. Specify a single color, useful in an override rule.
|
||||
Mode FieldColorModeId `json:"mode"`
|
||||
|
||||
// TODO docs
|
||||
// Defines how to assign a series color from "by value" color schemes. For example for an aggregated data points like a timeseries, the color can be assigned by the min, max or last value.
|
||||
SeriesBy *FieldColorSeriesByMode `json:"seriesBy,omitempty"`
|
||||
}
|
||||
|
||||
// TODO docs
|
||||
// Color mode for a field. You can specify a single color, or select a continuous (gradient) color schemes, based on a value.
|
||||
// Continuous color interpolates a color using the percentage of a value relative to min and max.
|
||||
// Accepted values are:
|
||||
// `thresholds`: From thresholds. Informs Grafana to take the color from the matching threshold
|
||||
// `palette-classic`: Classic palette. Grafana will assign color by looking up a color in a palette by series index. Useful for Graphs and pie charts and other categorical data visualizations
|
||||
// `palette-classic-by-name`: Classic palette (by name). Grafana will assign color by looking up a color in a palette by series name. Useful for Graphs and pie charts and other categorical data visualizations
|
||||
// `continuous-GrYlRd`: ontinuous Green-Yellow-Red palette mode
|
||||
// `continuous-RdYlGr`: Continuous Red-Yellow-Green palette mode
|
||||
// `continuous-BlYlRd`: Continuous Blue-Yellow-Red palette mode
|
||||
// `continuous-YlRd`: Continuous Yellow-Red palette mode
|
||||
// `continuous-BlPu`: Continuous Blue-Purple palette mode
|
||||
// `continuous-YlBl`: Continuous Yellow-Blue palette mode
|
||||
// `continuous-blues`: Continuous Blue palette mode
|
||||
// `continuous-reds`: Continuous Red palette mode
|
||||
// `continuous-greens`: Continuous Green palette mode
|
||||
// `continuous-purples`: Continuous Purple palette mode
|
||||
// `shades`: Shades of a single color. Specify a single color, useful in an override rule.
|
||||
// `fixed`: Fixed color mode. Specify a single color, useful in an override rule.
|
||||
type FieldColorModeId string
|
||||
|
||||
// Defines how to assign a series color from "by value" color schemes. For example for an aggregated data points like a timeseries, the color can be assigned by the min, max or last value.
|
||||
type FieldColorSeriesByMode string
|
||||
|
||||
// FieldConfig defines model for FieldConfig.
|
||||
// The data model used in Grafana, namely the data frame, is a columnar-oriented table structure that unifies both time series and table query results.
|
||||
// Each column within this structure is called a field. A field can represent a single time series or table column.
|
||||
// Field options allow you to change how the data is displayed in your visualizations.
|
||||
type FieldConfig struct {
|
||||
// TODO docs
|
||||
// Map a field to a color.
|
||||
Color *FieldColor `json:"color,omitempty"`
|
||||
|
||||
// custom is specified by the FieldConfig field
|
||||
// in panel plugin schemas.
|
||||
Custom map[string]interface{} `json:"custom,omitempty"`
|
||||
|
||||
// Significant digits (for display)
|
||||
// Specify the number of decimals Grafana includes in the rendered value.
|
||||
// If you leave this field blank, Grafana automatically truncates the number of decimals based on the value.
|
||||
// For example 1.1234 will display as 1.12 and 100.456 will display as 100.
|
||||
// To display all decimals, set the unit to `String`.
|
||||
Decimals *float32 `json:"decimals,omitempty"`
|
||||
|
||||
// Human readable field metadata
|
||||
@ -317,8 +389,12 @@ type FieldConfig struct {
|
||||
|
||||
// Convert input values into a display string
|
||||
Mappings []interface{} `json:"mappings,omitempty"`
|
||||
Max *float32 `json:"max,omitempty"`
|
||||
Min *float32 `json:"min,omitempty"`
|
||||
|
||||
// The maximum value used in percentage threshold calculations. Leave blank for auto calculation based on all series and fields.
|
||||
Max *float32 `json:"max,omitempty"`
|
||||
|
||||
// The minimum value used in percentage threshold calculations. Leave blank for auto calculation based on all series and fields.
|
||||
Min *float32 `json:"min,omitempty"`
|
||||
|
||||
// Alternative to empty string
|
||||
NoValue *string `json:"noValue,omitempty"`
|
||||
@ -328,26 +404,47 @@ type FieldConfig struct {
|
||||
//
|
||||
// When defined, this value can be used as an identifier within the datasource scope, and
|
||||
// may be used to update the results
|
||||
Path *string `json:"path,omitempty"`
|
||||
Path *string `json:"path,omitempty"`
|
||||
|
||||
// Thresholds configuration for the panel
|
||||
Thresholds *ThresholdsConfig `json:"thresholds,omitempty"`
|
||||
|
||||
// Numeric Options
|
||||
// Unit a field should use. The unit you select is applied to all fields except time.
|
||||
// You can use the units ID availables in Grafana or a custom unit.
|
||||
// Available units in Grafana: https://github.com/grafana/grafana/blob/main/packages/grafana-data/src/valueFormats/categories.ts
|
||||
// As custom unit, you can use the following formats:
|
||||
// `suffix:<suffix>` for custom unit that should go after value.
|
||||
// `prefix:<prefix>` for custom unit that should go before value.
|
||||
// `time:<format>` For custom date time formats type for example `time:YYYY-MM-DD`.
|
||||
// `si:<base scale><unit characters>` for custom SI units. For example: `si: mF`. This one is a bit more advanced as you can specify both a unit and the source data scale. So if your source data is represented as milli (thousands of) something prefix the unit with that SI scale character.
|
||||
// `count:<unit>` for a custom count unit.
|
||||
// `currency:<unit>` for custom a currency unit.
|
||||
Unit *string `json:"unit,omitempty"`
|
||||
|
||||
// True if data source can write a value to the path. Auth/authz are supported separately
|
||||
// True if data source can write a value to the path. Auth/authz are supported separately
|
||||
Writeable *bool `json:"writeable,omitempty"`
|
||||
}
|
||||
|
||||
// FieldConfigSource defines model for FieldConfigSource.
|
||||
// The data model used in Grafana, namely the data frame, is a columnar-oriented table structure that unifies both time series and table query results.
|
||||
// Each column within this structure is called a field. A field can represent a single time series or table column.
|
||||
// Field options allow you to change how the data is displayed in your visualizations.
|
||||
type FieldConfigSource struct {
|
||||
Defaults FieldConfig `json:"defaults"`
|
||||
// The data model used in Grafana, namely the data frame, is a columnar-oriented table structure that unifies both time series and table query results.
|
||||
// Each column within this structure is called a field. A field can represent a single time series or table column.
|
||||
// Field options allow you to change how the data is displayed in your visualizations.
|
||||
Defaults FieldConfig `json:"defaults"`
|
||||
|
||||
// Overrides are the options applied to specific fields overriding the defaults.
|
||||
Overrides []struct {
|
||||
// Matcher is a predicate configuration. Based on the config a set of field(s) or values is filtered in order to apply override / transformation.
|
||||
// It comes with in id ( to resolve implementation from registry) and a configuration that’s specific to a particular matcher type.
|
||||
Matcher MatcherConfig `json:"matcher"`
|
||||
Properties []DynamicConfigValue `json:"properties"`
|
||||
} `json:"overrides"`
|
||||
}
|
||||
|
||||
// Support for legacy graph and heatmap panels.
|
||||
// Support for legacy graph panel.
|
||||
// @deprecated this a deprecated panel type
|
||||
type GraphPanel struct {
|
||||
// @deprecated this is part of deprecated graph panel
|
||||
Legend *struct {
|
||||
@ -361,25 +458,26 @@ type GraphPanel struct {
|
||||
// GraphPanelType defines model for GraphPanel.Type.
|
||||
type GraphPanelType string
|
||||
|
||||
// GridPos defines model for GridPos.
|
||||
// Position and dimensions of a panel in the grid
|
||||
type GridPos struct {
|
||||
// H Panel
|
||||
// Panel height. The height is the number of rows from the top edge of the panel.
|
||||
H int `json:"h"`
|
||||
|
||||
// Whether the panel is fixed within the grid
|
||||
// Whether the panel is fixed within the grid. If true, the panel will not be affected by other panels' interactions
|
||||
Static *bool `json:"static,omitempty"`
|
||||
|
||||
// W Panel
|
||||
// Panel width. The width is the number of columns from the left edge of the panel.
|
||||
W int `json:"w"`
|
||||
|
||||
// Panel x
|
||||
// Panel x. The x coordinate is the number of columns from the left edge of the grid
|
||||
X int `json:"x"`
|
||||
|
||||
// Panel y
|
||||
// Panel y. The y coordinate is the number of rows from the top edge of the grid
|
||||
Y int `json:"y"`
|
||||
}
|
||||
|
||||
// HeatmapPanel defines model for HeatmapPanel.
|
||||
// Support for legacy heatmap panel.
|
||||
// @deprecated this a deprecated panel type
|
||||
type HeatmapPanel struct {
|
||||
Type HeatmapPanelType `json:"type"`
|
||||
}
|
||||
@ -387,83 +485,92 @@ type HeatmapPanel struct {
|
||||
// HeatmapPanelType defines model for HeatmapPanel.Type.
|
||||
type HeatmapPanelType string
|
||||
|
||||
// LibraryPanelRef defines model for LibraryPanelRef.
|
||||
// A library panel is a reusable panel that you can use in any dashboard.
|
||||
// When you make a change to a library panel, that change propagates to all instances of where the panel is used.
|
||||
// Library panels streamline reuse of panels across multiple dashboards.
|
||||
type LibraryPanelRef struct {
|
||||
// Library panel name
|
||||
Name string `json:"name"`
|
||||
Uid string `json:"uid"`
|
||||
|
||||
// Library panel uid
|
||||
Uid string `json:"uid"`
|
||||
}
|
||||
|
||||
// LoadingState defines model for LoadingState.
|
||||
type LoadingState string
|
||||
|
||||
// Supported value mapping types
|
||||
// `value`: Maps text values to a color or different display text and color. For example, you can configure a value mapping so that all instances of the value 10 appear as Perfection! rather than the number.
|
||||
// `range`: Maps numerical ranges to a display text and color. For example, if a value is within a certain range, you can configure a range value mapping to display Low or High rather than the number.
|
||||
// `regex`: Maps regular expressions to replacement text and a color. For example, if a value is www.example.com, you can configure a regex value mapping so that Grafana displays www and truncates the domain.
|
||||
// `special`: Maps special values like Null, NaN (not a number), and boolean values like true and false to a display text and color. See SpecialValueMatch to see the list of special values. For example, you can configure a special value mapping so that null values appear as N/A.
|
||||
type MappingType string
|
||||
|
||||
// MatcherConfig defines model for MatcherConfig.
|
||||
// Matcher is a predicate configuration. Based on the config a set of field(s) or values is filtered in order to apply override / transformation.
|
||||
// It comes with in id ( to resolve implementation from registry) and a configuration that’s specific to a particular matcher type.
|
||||
type MatcherConfig struct {
|
||||
Id string `json:"id"`
|
||||
// The matcher id. This is used to find the matcher implementation from registry.
|
||||
Id string `json:"id"`
|
||||
|
||||
// The matcher options. This is specific to the matcher implementation.
|
||||
Options *interface{} `json:"options,omitempty"`
|
||||
}
|
||||
|
||||
// Dashboard panels. Panels are canonically defined inline
|
||||
// because they share a version timeline with the dashboard
|
||||
// schema; they do not evolve independently.
|
||||
// Dashboard panels are the basic visualization building blocks.
|
||||
type Panel struct {
|
||||
// The datasource used in all targets.
|
||||
Datasource *struct {
|
||||
Type *string `json:"type,omitempty"`
|
||||
Uid *string `json:"uid,omitempty"`
|
||||
} `json:"datasource,omitempty"`
|
||||
// Ref to a DataSource instance
|
||||
Datasource *DataSourceRef `json:"datasource,omitempty"`
|
||||
|
||||
// Description Description.
|
||||
Description *string `json:"description,omitempty"`
|
||||
// Panel description.
|
||||
Description *string `json:"description,omitempty"`
|
||||
|
||||
// The data model used in Grafana, namely the data frame, is a columnar-oriented table structure that unifies both time series and table query results.
|
||||
// Each column within this structure is called a field. A field can represent a single time series or table column.
|
||||
// Field options allow you to change how the data is displayed in your visualizations.
|
||||
FieldConfig FieldConfigSource `json:"fieldConfig"`
|
||||
GridPos *GridPos `json:"gridPos,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
// Position and dimensions of a panel in the grid
|
||||
GridPos *GridPos `json:"gridPos,omitempty"`
|
||||
|
||||
// Unique identifier of the panel. Generated by Grafana when creating a new panel. It must be unique within a dashboard, but not globally.
|
||||
Id *int `json:"id,omitempty"`
|
||||
|
||||
// The min time interval setting defines a lower limit for the $__interval and $__interval_ms variables.
|
||||
// This value must be formatted as a number followed by a valid time
|
||||
// identifier like: "40s", "3d", etc.
|
||||
// See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options
|
||||
Interval *string `json:"interval,omitempty"`
|
||||
Interval *string `json:"interval,omitempty"`
|
||||
|
||||
// A library panel is a reusable panel that you can use in any dashboard.
|
||||
// When you make a change to a library panel, that change propagates to all instances of where the panel is used.
|
||||
// Library panels streamline reuse of panels across multiple dashboards.
|
||||
LibraryPanel *LibraryPanelRef `json:"libraryPanel,omitempty"`
|
||||
|
||||
// Panel links.
|
||||
// TODO fill this out - seems there are a couple variants?
|
||||
Links []Link `json:"links,omitempty"`
|
||||
|
||||
// The maximum number of data points that the panel queries are retrieving.
|
||||
MaxDataPoints *float32 `json:"maxDataPoints,omitempty"`
|
||||
|
||||
// options is specified by the Options field in panel
|
||||
// plugin schemas.
|
||||
// It depends on the panel plugin. They are specified by the Options field in panel plugin schemas.
|
||||
Options map[string]interface{} `json:"options"`
|
||||
|
||||
// FIXME this almost certainly has to be changed in favor of scuemata versions
|
||||
// The version of the plugin that is used for this panel. This is used to find the plugin to display the panel and to migrate old panel configs.
|
||||
PluginVersion *string `json:"pluginVersion,omitempty"`
|
||||
|
||||
// Name of template variable to repeat for.
|
||||
Repeat *string `json:"repeat,omitempty"`
|
||||
|
||||
// Direction to repeat in if 'repeat' is set.
|
||||
// "h" for horizontal, "v" for vertical.
|
||||
// TODO this is probably optional
|
||||
RepeatDirection PanelRepeatDirection `json:"repeatDirection"`
|
||||
// `h` for horizontal, `v` for vertical.
|
||||
RepeatDirection *PanelRepeatDirection `json:"repeatDirection,omitempty"`
|
||||
|
||||
// Id of the repeating panel.
|
||||
RepeatPanelId *int64 `json:"repeatPanelId,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
// Tags for the panel.
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
// Depends on the panel plugin. See the plugin documentation for details.
|
||||
Targets []Target `json:"targets,omitempty"`
|
||||
|
||||
// TODO docs - seems to be an old field from old dashboard alerts?
|
||||
Thresholds []interface{} `json:"thresholds,omitempty"`
|
||||
|
||||
// Overrides the relative time range for individual panels,
|
||||
// which causes them to be different than what is selected in
|
||||
// the dashboard time picker in the top-right corner of the dashboard. You can use this to show metrics from different
|
||||
@ -474,9 +581,6 @@ type Panel struct {
|
||||
// See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options
|
||||
TimeFrom *string `json:"timeFrom,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
TimeRegions []interface{} `json:"timeRegions,omitempty"`
|
||||
|
||||
// Overrides the time range for individual panels by shifting its start and end relative to the time picker.
|
||||
// For example, you can shift the time range for the panel to be two hours earlier than the dashboard time picker setting `2h`.
|
||||
// Note: Panel time overrides have no effect when the dashboard’s time range is absolute.
|
||||
@ -484,30 +588,37 @@ type Panel struct {
|
||||
TimeShift *string `json:"timeShift,omitempty"`
|
||||
|
||||
// Panel title.
|
||||
Title *string `json:"title,omitempty"`
|
||||
Title *string `json:"title,omitempty"`
|
||||
|
||||
// List of transformations that are applied to the panel data before rendering.
|
||||
// When there are multiple transformations, Grafana applies them in the order they are listed.
|
||||
// Each transformation creates a result set that then passes on to the next transformation in the processing pipeline.
|
||||
Transformations []DataTransformerConfig `json:"transformations"`
|
||||
|
||||
// Whether to display the panel without a background.
|
||||
Transparent bool `json:"transparent"`
|
||||
|
||||
// The panel plugin type id. May not be empty.
|
||||
// The panel plugin type id. This is used to find the plugin to display the panel.
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
// Direction to repeat in if 'repeat' is set.
|
||||
// "h" for horizontal, "v" for vertical.
|
||||
// TODO this is probably optional
|
||||
// `h` for horizontal, `v` for vertical.
|
||||
type PanelRepeatDirection string
|
||||
|
||||
// Maps numeric ranges to a color or different display text
|
||||
// Maps numerical ranges to a display text and color.
|
||||
// For example, if a value is within a certain range, you can configure a range value mapping to display Low or High rather than the number.
|
||||
type RangeMap struct {
|
||||
// Range to match against and the result to apply when the value is within the range
|
||||
Options struct {
|
||||
// From to and from are `number | null` in current ts, really not sure what to do
|
||||
// Min value of the range. It can be null which means -Infinity
|
||||
From float64 `json:"from"`
|
||||
|
||||
// Result used as replacement text and color for RegexMap and SpecialValueMap
|
||||
// Result used as replacement with text and color when the value matches
|
||||
Result ValueMappingResult `json:"result"`
|
||||
To float64 `json:"to"`
|
||||
|
||||
// Max value of the range. It can be null which means +Infinity
|
||||
To float64 `json:"to"`
|
||||
} `json:"options"`
|
||||
Type RangeMapType `json:"type"`
|
||||
}
|
||||
@ -515,12 +626,15 @@ type RangeMap struct {
|
||||
// RangeMapType defines model for RangeMap.Type.
|
||||
type RangeMapType string
|
||||
|
||||
// Maps regular expressions to replacement text and a color
|
||||
// Maps regular expressions to replacement text and a color.
|
||||
// For example, if a value is www.example.com, you can configure a regex value mapping so that Grafana displays www and truncates the domain.
|
||||
type RegexMap struct {
|
||||
// Regular expression to match against and the result to apply when the value matches the regex
|
||||
Options struct {
|
||||
// Regular expression to match against
|
||||
Pattern string `json:"pattern"`
|
||||
|
||||
// Result used as replacement text and color for RegexMap and SpecialValueMap
|
||||
// Result used as replacement with text and color when the value matches
|
||||
Result ValueMappingResult `json:"result"`
|
||||
} `json:"options"`
|
||||
Type RegexMapType `json:"type"`
|
||||
@ -531,24 +645,32 @@ type RegexMapType string
|
||||
|
||||
// Row panel
|
||||
type RowPanel struct {
|
||||
// Whether this row should be collapsed or not.
|
||||
Collapsed bool `json:"collapsed"`
|
||||
|
||||
// Name of default datasource.
|
||||
Datasource *struct {
|
||||
Type *string `json:"type,omitempty"`
|
||||
Uid *string `json:"uid,omitempty"`
|
||||
} `json:"datasource,omitempty"`
|
||||
GridPos *GridPos `json:"gridPos,omitempty"`
|
||||
Id int `json:"id"`
|
||||
Panels []interface{} `json:"panels"`
|
||||
// Ref to a DataSource instance
|
||||
Datasource *DataSourceRef `json:"datasource,omitempty"`
|
||||
|
||||
// Position and dimensions of a panel in the grid
|
||||
GridPos *GridPos `json:"gridPos,omitempty"`
|
||||
|
||||
// Unique identifier of the panel. Generated by Grafana when creating a new panel. It must be unique within a dashboard, but not globally.
|
||||
Id int `json:"id"`
|
||||
|
||||
// List of panels in the row
|
||||
Panels []interface{} `json:"panels"`
|
||||
|
||||
// Name of template variable to repeat for.
|
||||
Repeat *string `json:"repeat,omitempty"`
|
||||
Title *string `json:"title,omitempty"`
|
||||
Type RowPanelType `json:"type"`
|
||||
Repeat *string `json:"repeat,omitempty"`
|
||||
|
||||
// Row title
|
||||
Title *string `json:"title,omitempty"`
|
||||
|
||||
// The panel type
|
||||
Type RowPanelType `json:"type"`
|
||||
}
|
||||
|
||||
// RowPanelType defines model for RowPanel.Type.
|
||||
// The panel type
|
||||
type RowPanelType string
|
||||
|
||||
// A dashboard snapshot shares an interactive dashboard publicly.
|
||||
@ -593,7 +715,10 @@ type Snapshot struct {
|
||||
|
||||
// Spec defines model for Spec.
|
||||
type Spec struct {
|
||||
// TODO -- should not be a public interface on its own, but required for Veneer
|
||||
// Contains the list of annotations that are associated with the dashboard.
|
||||
// Annotations are used to overlay event markers and overlay event tags on graphs.
|
||||
// Grafana comes with a native annotation store and the ability to add annotation events directly from the graph panel or via the HTTP API.
|
||||
// See https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/annotate-visualizations/
|
||||
Annotations *AnnotationContainer `json:"annotations,omitempty"`
|
||||
|
||||
// Description of dashboard.
|
||||
@ -614,29 +739,29 @@ type Spec struct {
|
||||
GraphTooltip CursorSync `json:"graphTooltip"`
|
||||
|
||||
// Unique numeric identifier for the dashboard.
|
||||
// TODO must isolate or remove identifiers local to a Grafana instance...?
|
||||
// `id` is internal to a specific Grafana instance. `uid` should be used to identify a dashboard across Grafana instances.
|
||||
Id *int64 `json:"id,omitempty"`
|
||||
|
||||
// Links with references to other dashboards or external websites.
|
||||
Links []Link `json:"links,omitempty"`
|
||||
|
||||
// When set to true, the dashboard will redraw panels at an interval matching the pixel width.
|
||||
// This will keep data "moving left" regardless of the query refresh rate. This setting helps
|
||||
// This will keep data "moving left" regardless of the query refresh rate. This setting helps
|
||||
// avoid dashboards presenting stale live data
|
||||
LiveNow *bool `json:"liveNow,omitempty"`
|
||||
Panels []interface{} `json:"panels,omitempty"`
|
||||
LiveNow *bool `json:"liveNow,omitempty"`
|
||||
|
||||
// List of dashboard panels
|
||||
Panels []interface{} `json:"panels,omitempty"`
|
||||
|
||||
// Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d".
|
||||
Refresh *interface{} `json:"refresh,omitempty"`
|
||||
|
||||
// This property should only be used in dashboards defined by plugins. It is a quick check
|
||||
// to see if the version has changed since the last time. Unclear why using the version property
|
||||
// is insufficient.
|
||||
// to see if the version has changed since the last time.
|
||||
Revision *int64 `json:"revision,omitempty"`
|
||||
|
||||
// Version of the JSON schema, incremented each time a Grafana update brings
|
||||
// changes to said schema.
|
||||
// TODO this is the existing schema numbering system. It will be replaced by Thema's themaVersion
|
||||
SchemaVersion int `json:"schemaVersion"`
|
||||
|
||||
// A dashboard snapshot shares an interactive dashboard publicly.
|
||||
@ -647,13 +772,15 @@ type Spec struct {
|
||||
Snapshot *Snapshot `json:"snapshot,omitempty"`
|
||||
|
||||
// Theme of dashboard.
|
||||
// Default value: dark.
|
||||
Style SpecStyle `json:"style"`
|
||||
|
||||
// Tags associated with dashboard.
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
|
||||
// Contains the list of configured template variables with their saved values along with some other metadata
|
||||
// Configured template variables
|
||||
Templating *struct {
|
||||
// List of configured template variables with their saved values along with some other metadata
|
||||
List []VariableModel `json:"list,omitempty"`
|
||||
} `json:"templating,omitempty"`
|
||||
|
||||
@ -699,27 +826,29 @@ type Spec struct {
|
||||
}
|
||||
|
||||
// Theme of dashboard.
|
||||
// Default value: dark.
|
||||
type SpecStyle string
|
||||
|
||||
// Maps special values like Null, NaN (not a number), and boolean values like true and false to a display text
|
||||
// and color
|
||||
// Maps special values like Null, NaN (not a number), and boolean values like true and false to a display text and color.
|
||||
// See SpecialValueMatch to see the list of special values.
|
||||
// For example, you can configure a special value mapping so that null values appear as N/A.
|
||||
type SpecialValueMap struct {
|
||||
Options struct {
|
||||
Match SpecialValueMapOptionsMatch `json:"match"`
|
||||
Pattern string `json:"pattern"`
|
||||
// Special value types supported by the `SpecialValueMap`
|
||||
Match SpecialValueMatch `json:"match"`
|
||||
|
||||
// Result used as replacement text and color for RegexMap and SpecialValueMap
|
||||
// Result used as replacement with text and color when the value matches
|
||||
Result ValueMappingResult `json:"result"`
|
||||
} `json:"options"`
|
||||
Type SpecialValueMapType `json:"type"`
|
||||
}
|
||||
|
||||
// SpecialValueMapOptionsMatch defines model for SpecialValueMap.Options.Match.
|
||||
type SpecialValueMapOptionsMatch string
|
||||
|
||||
// SpecialValueMapType defines model for SpecialValueMap.Type.
|
||||
type SpecialValueMapType string
|
||||
|
||||
// Special value types supported by the `SpecialValueMap`
|
||||
type SpecialValueMatch string
|
||||
|
||||
// Schema for panel targets is specified by datasource
|
||||
// plugins. We use a placeholder definition, which the Go
|
||||
// schema loader either left open/as-is with the Base
|
||||
@ -735,33 +864,27 @@ type Threshold struct {
|
||||
// Color represents the color of the visual change that will occur in the dashboard when the threshold value is met or exceeded.
|
||||
Color string `json:"color"`
|
||||
|
||||
// Threshold index, an old property that is not needed an should only appear in older dashboards
|
||||
Index *int32 `json:"index,omitempty"`
|
||||
|
||||
// TODO docs
|
||||
// TODO are the values here enumerable into a disjunction?
|
||||
// Some seem to be listed in typescript comment
|
||||
State *string `json:"state,omitempty"`
|
||||
|
||||
// Value represents a specified metric for the threshold, which triggers a visual change in the dashboard when this value is met or exceeded.
|
||||
// FIXME the corresponding typescript field is required/non-optional, but nulls currently appear here when serializing -Infinity to JSON
|
||||
Value *float32 `json:"value,omitempty"`
|
||||
// Nulls currently appear here when serializing -Infinity to JSON.
|
||||
Value float32 `json:"value"`
|
||||
}
|
||||
|
||||
// ThresholdsConfig defines model for ThresholdsConfig.
|
||||
// Thresholds configuration for the panel
|
||||
type ThresholdsConfig struct {
|
||||
// Thresholds can either be absolute (specific number) or percentage (relative to min or max).
|
||||
// Thresholds can either be `absolute` (specific number) or `percentage` (relative to min or max, it will be values between 0 and 1).
|
||||
Mode ThresholdsMode `json:"mode"`
|
||||
|
||||
// Must be sorted by 'value', first value is always -Infinity
|
||||
Steps []Threshold `json:"steps"`
|
||||
}
|
||||
|
||||
// Thresholds can either be absolute (specific number) or percentage (relative to min or max).
|
||||
// Thresholds can either be `absolute` (specific number) or `percentage` (relative to min or max, it will be values between 0 and 1).
|
||||
type ThresholdsMode string
|
||||
|
||||
// Maps text values to a color or different display text
|
||||
// Maps text values to a color or different display text and color.
|
||||
// For example, you can configure a value mapping so that all instances of the value 10 appear as Perfection! rather than the number.
|
||||
type ValueMap struct {
|
||||
// Map with <value_to_match>: ValueMappingResult. For example: { "10": { text: "Perfection!", color: "green" } }
|
||||
Options map[string]ValueMappingResult `json:"options"`
|
||||
Type ValueMapType `json:"type"`
|
||||
}
|
||||
@ -769,46 +892,107 @@ type ValueMap struct {
|
||||
// ValueMapType defines model for ValueMap.Type.
|
||||
type ValueMapType string
|
||||
|
||||
// Result used as replacement text and color for RegexMap and SpecialValueMap
|
||||
// Result used as replacement with text and color when the value matches
|
||||
type ValueMappingResult struct {
|
||||
// Text to use when the value matches
|
||||
Color *string `json:"color,omitempty"`
|
||||
Icon *string `json:"icon,omitempty"`
|
||||
Index *int32 `json:"index,omitempty"`
|
||||
Text *string `json:"text,omitempty"`
|
||||
|
||||
// Icon to display when the value matches. Only specific visualizations.
|
||||
Icon *string `json:"icon,omitempty"`
|
||||
|
||||
// Position in the mapping array. Only used internally.
|
||||
Index *int32 `json:"index,omitempty"`
|
||||
|
||||
// Text to display when the value matches
|
||||
Text *string `json:"text,omitempty"`
|
||||
}
|
||||
|
||||
// VariableHide defines model for VariableHide.
|
||||
// Determine if the variable shows on dashboard
|
||||
// Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing).
|
||||
type VariableHide int
|
||||
|
||||
// FROM: packages/grafana-data/src/types/templateVars.ts
|
||||
// TODO docs
|
||||
// TODO what about what's in public/app/features/types.ts?
|
||||
// TODO there appear to be a lot of different kinds of [template] vars here? if so need a disjunction
|
||||
// A variable is a placeholder for a value. You can use variables in metric queries and in panel titles.
|
||||
type VariableModel struct {
|
||||
// Format to use while fetching all values from data source, eg: wildcard, glob, regex, pipe, etc.
|
||||
AllFormat *string `json:"allFormat,omitempty"`
|
||||
|
||||
// Option to be selected in a variable.
|
||||
Current *VariableOption `json:"current,omitempty"`
|
||||
|
||||
// Ref to a DataSource instance
|
||||
Datasource *DataSourceRef `json:"datasource,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Error map[string]interface{} `json:"error,omitempty"`
|
||||
Global bool `json:"global"`
|
||||
Hide VariableHide `json:"hide"`
|
||||
Id string `json:"id"`
|
||||
Index int `json:"index"`
|
||||
Label *string `json:"label,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Datasource *DataSourceRef `json:"datasource,omitempty"`
|
||||
|
||||
// TODO: Move this into a separated QueryVariableModel type
|
||||
Query *interface{} `json:"query,omitempty"`
|
||||
RootStateKey *string `json:"rootStateKey,omitempty"`
|
||||
SkipUrlSync bool `json:"skipUrlSync"`
|
||||
State LoadingState `json:"state"`
|
||||
// Description of variable. It can be defined but `null`.
|
||||
Description *string `json:"description,omitempty"`
|
||||
|
||||
// FROM: packages/grafana-data/src/types/templateVars.ts
|
||||
// TODO docs
|
||||
// TODO this implies some wider pattern/discriminated union, probably?
|
||||
// Determine if the variable shows on dashboard
|
||||
// Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing).
|
||||
Hide VariableHide `json:"hide"`
|
||||
|
||||
// Unique numeric identifier for the variable.
|
||||
Id string `json:"id"`
|
||||
|
||||
// Optional display name
|
||||
Label *string `json:"label,omitempty"`
|
||||
|
||||
// Whether multiple values can be selected or not from variable value list
|
||||
Multi *bool `json:"multi,omitempty"`
|
||||
|
||||
// Name of variable
|
||||
Name string `json:"name"`
|
||||
|
||||
// Options that can be selected for a variable.
|
||||
Options []VariableOption `json:"options,omitempty"`
|
||||
|
||||
// Query used to fetch values for a variable
|
||||
Query *interface{} `json:"query,omitempty"`
|
||||
|
||||
// Options to config when to refresh a variable
|
||||
// `0`: Never refresh the variable
|
||||
// `1`: Queries the data source every time the dashboard loads.
|
||||
// `2`: Queries the data source when the dashboard time range changes.
|
||||
Refresh *VariableRefresh `json:"refresh,omitempty"`
|
||||
|
||||
// Whether the variable value should be managed by URL query params or not
|
||||
SkipUrlSync bool `json:"skipUrlSync"`
|
||||
|
||||
// Dashboard variable type
|
||||
// `query`: Query-generated list of values such as metric names, server names, sensor IDs, data centers, and so on.
|
||||
// `adhoc`: Key/value filters that are automatically added to all metric queries for a data source (Prometheus, Loki, InfluxDB, and Elasticsearch only).
|
||||
// `constant`: Define a hidden constant.
|
||||
// `datasource`: Quickly change the data source for an entire dashboard.
|
||||
// `interval`: Interval variables represent time spans.
|
||||
// `textbox`: Display a free text input field with an optional default value.
|
||||
// `custom`: Define the variable options manually using a comma-separated list.
|
||||
// `system`: Variables defined by Grafana. See: https://grafana.com/docs/grafana/latest/dashboards/variables/add-template-variables/#global-variables
|
||||
Type VariableType `json:"type"`
|
||||
}
|
||||
|
||||
// FROM: packages/grafana-data/src/types/templateVars.ts
|
||||
// TODO docs
|
||||
// TODO this implies some wider pattern/discriminated union, probably?
|
||||
// Option to be selected in a variable.
|
||||
type VariableOption struct {
|
||||
// Whether the option is selected or not
|
||||
Selected *bool `json:"selected,omitempty"`
|
||||
|
||||
// Text to be displayed for the option
|
||||
Text interface{} `json:"text"`
|
||||
|
||||
// Value of the option
|
||||
Value interface{} `json:"value"`
|
||||
}
|
||||
|
||||
// Options to config when to refresh a variable
|
||||
// `0`: Never refresh the variable
|
||||
// `1`: Queries the data source every time the dashboard loads.
|
||||
// `2`: Queries the data source when the dashboard time range changes.
|
||||
type VariableRefresh int
|
||||
|
||||
// Dashboard variable type
|
||||
// `query`: Query-generated list of values such as metric names, server names, sensor IDs, data centers, and so on.
|
||||
// `adhoc`: Key/value filters that are automatically added to all metric queries for a data source (Prometheus, Loki, InfluxDB, and Elasticsearch only).
|
||||
// `constant`: Define a hidden constant.
|
||||
// `datasource`: Quickly change the data source for an entire dashboard.
|
||||
// `interval`: Interval variables represent time spans.
|
||||
// `textbox`: Display a free text input field with an optional default value.
|
||||
// `custom`: Define the variable options manually using a comma-separated list.
|
||||
// `system`: Variables defined by Grafana. See: https://grafana.com/docs/grafana/latest/dashboards/variables/add-template-variables/#global-variables
|
||||
type VariableType string
|
||||
|
@ -88,8 +88,8 @@ describe('DashboardModel', () => {
|
||||
},
|
||||
{
|
||||
type: 'singlestat',
|
||||
legend: true,
|
||||
// @ts-expect-error
|
||||
legend: true,
|
||||
thresholds: '10,20,30',
|
||||
colors: ['#FF0000', 'green', 'orange'],
|
||||
aliasYAxis: { test: 2 },
|
||||
@ -665,16 +665,16 @@ describe('DashboardModel', () => {
|
||||
model = new DashboardModel({
|
||||
templating: {
|
||||
list: [
|
||||
// @ts-expect-error
|
||||
{
|
||||
// @ts-expect-error
|
||||
multi: false,
|
||||
current: {
|
||||
value: ['value'],
|
||||
text: ['text'],
|
||||
},
|
||||
},
|
||||
// @ts-expect-error
|
||||
{
|
||||
// @ts-expect-error
|
||||
multi: true,
|
||||
current: {
|
||||
value: ['value'],
|
||||
@ -724,8 +724,8 @@ describe('DashboardModel', () => {
|
||||
},
|
||||
{
|
||||
type: 'query',
|
||||
// @ts-expect-error
|
||||
current: {
|
||||
// @ts-expect-error
|
||||
tags: [
|
||||
{
|
||||
selected: true,
|
||||
@ -888,52 +888,52 @@ describe('DashboardModel', () => {
|
||||
model = new DashboardModel({
|
||||
templating: {
|
||||
list: [
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'query',
|
||||
hide: VariableHide.dontHide,
|
||||
datasource: null,
|
||||
// @ts-expect-error
|
||||
allFormat: '',
|
||||
},
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'query',
|
||||
hide: VariableHide.hideLabel,
|
||||
datasource: null,
|
||||
// @ts-expect-error
|
||||
allFormat: '',
|
||||
},
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'query',
|
||||
hide: VariableHide.hideVariable,
|
||||
datasource: null,
|
||||
// @ts-expect-error
|
||||
allFormat: '',
|
||||
},
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'constant',
|
||||
hide: VariableHide.dontHide,
|
||||
query: 'default value',
|
||||
// @ts-expect-error
|
||||
current: { selected: true, text: 'A', value: 'B' },
|
||||
options: [{ selected: true, text: 'A', value: 'B' }],
|
||||
datasource: null,
|
||||
allFormat: '',
|
||||
},
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'constant',
|
||||
hide: VariableHide.hideLabel,
|
||||
query: 'default value',
|
||||
// @ts-expect-error
|
||||
current: { selected: true, text: 'A', value: 'B' },
|
||||
options: [{ selected: true, text: 'A', value: 'B' }],
|
||||
datasource: null,
|
||||
allFormat: '',
|
||||
},
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'constant',
|
||||
hide: VariableHide.hideVariable,
|
||||
query: 'default value',
|
||||
// @ts-expect-error
|
||||
current: { selected: true, text: 'A', value: 'B' },
|
||||
options: [{ selected: true, text: 'A', value: 'B' }],
|
||||
datasource: null,
|
||||
@ -995,96 +995,96 @@ describe('DashboardModel', () => {
|
||||
model = new DashboardModel({
|
||||
templating: {
|
||||
list: [
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'query',
|
||||
name: 'variable_with_never_refresh_with_options',
|
||||
// @ts-expect-error
|
||||
options: [{ text: 'A', value: 'A' }],
|
||||
refresh: 0,
|
||||
},
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'query',
|
||||
name: 'variable_with_never_refresh_without_options',
|
||||
// @ts-expect-error
|
||||
options: [],
|
||||
refresh: 0,
|
||||
},
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'query',
|
||||
name: 'variable_with_dashboard_refresh_with_options',
|
||||
// @ts-expect-error
|
||||
options: [{ text: 'A', value: 'A' }],
|
||||
refresh: 1,
|
||||
},
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'query',
|
||||
name: 'variable_with_dashboard_refresh_without_options',
|
||||
// @ts-expect-error
|
||||
options: [],
|
||||
refresh: 1,
|
||||
},
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'query',
|
||||
name: 'variable_with_timerange_refresh_with_options',
|
||||
// @ts-expect-error
|
||||
options: [{ text: 'A', value: 'A' }],
|
||||
refresh: 2,
|
||||
},
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'query',
|
||||
name: 'variable_with_timerange_refresh_without_options',
|
||||
// @ts-expect-error
|
||||
options: [],
|
||||
refresh: 2,
|
||||
},
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'query',
|
||||
name: 'variable_with_no_refresh_with_options',
|
||||
// @ts-expect-error
|
||||
options: [{ text: 'A', value: 'A' }],
|
||||
},
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'query',
|
||||
name: 'variable_with_no_refresh_without_options',
|
||||
// @ts-expect-error
|
||||
options: [],
|
||||
},
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'query',
|
||||
name: 'variable_with_unknown_refresh_with_options',
|
||||
// @ts-expect-error
|
||||
options: [{ text: 'A', value: 'A' }],
|
||||
refresh: 2001,
|
||||
},
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'query',
|
||||
name: 'variable_with_unknown_refresh_without_options',
|
||||
// @ts-expect-error
|
||||
options: [],
|
||||
refresh: 2001,
|
||||
},
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'custom',
|
||||
name: 'custom',
|
||||
// @ts-expect-error
|
||||
options: [{ text: 'custom', value: 'custom' }],
|
||||
},
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'textbox',
|
||||
name: 'textbox',
|
||||
// @ts-expect-error
|
||||
options: [{ text: 'Hello', value: 'World' }],
|
||||
},
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'datasource',
|
||||
name: 'datasource',
|
||||
// @ts-expect-error
|
||||
options: [{ text: 'ds', value: 'ds' }], // fake example doesn't exist
|
||||
},
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'interval',
|
||||
name: 'interval',
|
||||
// @ts-expect-error
|
||||
options: [{ text: '1m', value: '1m' }],
|
||||
},
|
||||
],
|
||||
@ -1334,8 +1334,8 @@ describe('DashboardModel', () => {
|
||||
panels: [
|
||||
{
|
||||
type: 'singlestat',
|
||||
legend: true,
|
||||
// @ts-expect-error
|
||||
legend: true,
|
||||
thresholds: '10,20,30',
|
||||
colors: ['#FF0000', 'green', 'orange'],
|
||||
aliasYAxis: { test: 2 },
|
||||
@ -1396,8 +1396,8 @@ describe('DashboardModel', () => {
|
||||
panels: [
|
||||
{
|
||||
type: 'singlestat',
|
||||
legend: true,
|
||||
// @ts-expect-error
|
||||
legend: true,
|
||||
thresholds: '10,20,30',
|
||||
colors: ['#FF0000', 'green', 'orange'],
|
||||
aliasYAxis: { test: 2 },
|
||||
@ -2004,10 +2004,10 @@ describe('DashboardModel', () => {
|
||||
model = new DashboardModel({
|
||||
templating: {
|
||||
list: [
|
||||
// @ts-expect-error
|
||||
{
|
||||
type: 'query',
|
||||
name: 'var',
|
||||
// @ts-expect-error
|
||||
options: [{ text: 'A', value: 'A' }],
|
||||
refresh: 0,
|
||||
datasource: null,
|
||||
|
Loading…
Reference in New Issue
Block a user