diff --git a/prometheus/schemas/prometheus-time-series-query/migrate/migrate.cue b/prometheus/schemas/prometheus-time-series-query/migrate/migrate.cue index 701f008a0..68a7e2229 100644 --- a/prometheus/schemas/prometheus-time-series-query/migrate/migrate.cue +++ b/prometheus/schemas/prometheus-time-series-query/migrate/migrate.cue @@ -14,13 +14,14 @@ package migrate #target: { - // /!\ Best-effort conversion logic that may wrongly convert not-prometheus queries to PrometheusTimeSeriesQuery: - // Ideally we should rely on datasource.type = "prometheus" to identify prometheus queries. But in some cases, - // this information is not be available. Thus the condition relies on the presence of the "expr" field, that - // likely indicates that this is a prometheus query. datasource?: { - uid: string + type?: "prometheus" + uid: string } + // /!\ Best-effort conversion logic that may wrongly convert not-prometheus queries to PrometheusTimeSeriesQuery: + // Ideally we should only rely on datasource.type = "prometheus" to identify prometheus queries. But in some cases, + // this information is not present. Thus, in addition to the check on the optional type above, the below condition + // relies on the presence of the "expr" field, that likely indicates that this is a prometheus query. expr: string legendFormat?: string interval?: string diff --git a/prometheus/schemas/prometheus-time-series-query/migrate/tests/legend-format/input.json b/prometheus/schemas/prometheus-time-series-query/migrate/tests/legend-format/input.json index 6eb0dcdca..1cb215da9 100644 --- a/prometheus/schemas/prometheus-time-series-query/migrate/tests/legend-format/input.json +++ b/prometheus/schemas/prometheus-time-series-query/migrate/tests/legend-format/input.json @@ -1,5 +1,6 @@ { "datasource": { + "type": "prometheus", "uid": "${datasource}" }, "editorMode": "code",