[v9.2.x] Expressions: Fixes the issue showing expressions editor (#62626)

* Expressions: Fixes the issue showing expressions editor (#62510)

* Use suggested value for uid

* update the snapshot

* use __expr__

* replace all -100 with __expr__

* update snapshot

* more changes

* revert redundant change

* Use expr.DatasourceUID where it's possible

* generate files

(cherry picked from commit 91221bc436)

* unit text fix
This commit is contained in:
ismail simsek
2023-01-31 19:59:01 +00:00
committed by GitHub
parent 71f7f534ff
commit e2e9479e53
49 changed files with 207 additions and 191 deletions
@@ -821,36 +821,36 @@ Status: Bad Request
**Properties**
| Name | Type | Go type | Required | Default | Description | Example |
| --------------------------------------------------------- | ----------------------------------------- | ------------------- | :------: | ------- | -------------------------------------------------------------------------------------------------- | ------- |
| DatasourceUID | string | `string` | | | Grafana data source unique identifier; it should be '-100' for a Server Side Expression operation. | |
| Model | object | `interface{}` | | | JSON is the raw JSON query and includes the above properties as well as custom properties. | |
| QueryType | string | `string` | | | QueryType is an optional identifier for the type of query. |
| Name | Type | Go type | Required | Default | Description | Example |
| --------------------------------------------------------- | ----------------------------------------- | ------------------- | :------: | ------- | ------------------------------------------------------------------------------------------------------ | ------- |
| DatasourceUID | string | `string` | | | Grafana data source unique identifier; it should be '**expr**' for a Server Side Expression operation. | |
| Model | object | `interface{}` | | | JSON is the raw JSON query and includes the above properties as well as custom properties. | |
| QueryType | string | `string` | | | QueryType is an optional identifier for the type of query. |
| It can be used to distinguish different types of queries. | |
| RefID | string | `string` | | | RefID is the unique identifier of the query, set by the frontend call. | |
| relativeTimeRange | [RelativeTimeRange](#relative-time-range) | `RelativeTimeRange` | | | | |
| RefID | string | `string` | | | RefID is the unique identifier of the query, set by the frontend call. | |
| relativeTimeRange | [RelativeTimeRange](#relative-time-range) | `RelativeTimeRange` | | | | |
### <span id="alert-rule"></span> AlertRule
**Properties**
| Name | Type | Go type | Required | Default | Description | Example |
| ------------ | ---------------------------- | ------------------- | :------: | ------- | ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Annotations | map of string | `map[string]string` | | | | `{"runbook_url":"https://supercoolrunbook.com/page/13"}` |
| Condition | string | `string` | ✓ | | | `A` |
| Data | [][alertquery](#alert-query) | `[]*AlertQuery` | ✓ | | | `[{"datasourceUid":"-100","model":{"conditions":[{"evaluator":{"params":[0,0],"type":"gt"},"operator":{"type":"and"},"query":{"params":[]},"reducer":{"params":[],"type":"avg"},"type":"query"}],"datasource":{"type":"__expr__","uid":"__expr__"},"expression":"1 == 1","hide":false,"intervalMs":1000,"maxDataPoints":43200,"refId":"A","type":"math"},"queryType":"","refId":"A","relativeTimeRange":{"from":0,"to":0}}]` |
| ExecErrState | string | `string` | ✓ | | Allowed values: "OK", "Alerting", "Error" | |
| FolderUID | string | `string` | ✓ | | | `project_x` |
| ID | int64 (formatted integer) | `int64` | | | | |
| Labels | map of string | `map[string]string` | | | | `{"team":"sre-team-1"}` |
| NoDataState | string | `string` | ✓ | | Allowed values: "OK", "NoData", "Error" | |
| OrgID | int64 (formatted integer) | `int64` | ✓ | | | |
| RuleGroup | string | `string` | ✓ | | | `eval_group_1` |
| Title | string | `string` | ✓ | | | `Always firing` |
| UID | string | `string` | | | | |
| Updated | date-time (formatted string) | `strfmt.DateTime` | | | | |
| for | [Duration](#duration) | `Duration` | ✓ | | | |
| provenance | string | `Provenance` | | | | |
| Name | Type | Go type | Required | Default | Description | Example |
| ------------ | ---------------------------- | ------------------- | :------: | ------- | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Annotations | map of string | `map[string]string` | | | | `{"runbook_url":"https://supercoolrunbook.com/page/13"}` |
| Condition | string | `string` | ✓ | | | `A` |
| Data | [][alertquery](#alert-query) | `[]*AlertQuery` | ✓ | | | `[{"datasourceUid":"__expr__","model":{"conditions":[{"evaluator":{"params":[0,0],"type":"gt"},"operator":{"type":"and"},"query":{"params":[]},"reducer":{"params":[],"type":"avg"},"type":"query"}],"datasource":{"type":"__expr__","uid":"__expr__"},"expression":"1 == 1","hide":false,"intervalMs":1000,"maxDataPoints":43200,"refId":"A","type":"math"},"queryType":"","refId":"A","relativeTimeRange":{"from":0,"to":0}}]` |
| ExecErrState | string | `string` | ✓ | | Allowed values: "OK", "Alerting", "Error" | |
| FolderUID | string | `string` | ✓ | | | `project_x` |
| ID | int64 (formatted integer) | `int64` | | | | |
| Labels | map of string | `map[string]string` | | | | `{"team":"sre-team-1"}` |
| NoDataState | string | `string` | ✓ | | Allowed values: "OK", "NoData", "Error" | |
| OrgID | int64 (formatted integer) | `int64` | ✓ | | | |
| RuleGroup | string | `string` | ✓ | | | `eval_group_1` |
| Title | string | `string` | ✓ | | | `Always firing` |
| UID | string | `string` | | | | |
| Updated | date-time (formatted string) | `strfmt.DateTime` | | | | |
| for | [Duration](#duration) | `Duration` | ✓ | | | |
| provenance | string | `Provenance` | | | | |
### <span id="alert-rule-group"></span> AlertRuleGroup