Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

package migrate

import "github.com/perses/shared/cue/common"

#target: {
datasource?: {
type?: "prometheus"
Expand All @@ -31,9 +33,14 @@ package migrate
kind: "PrometheusTimeSeriesQuery"
spec: {
if #target.datasource != _|_ {
datasource: {
kind: "PrometheusDatasource"
name: #target.datasource.uid
if #target.datasource.uid =~ common.#variableSyntaxRegex {
datasource: #target.datasource.uid
}
if #target.datasource.uid !~ common.#variableSyntaxRegex {
datasource: {
kind: "PrometheusDatasource"
name: #target.datasource.uid
}
}
}
query: #target.expr
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"kind": "PrometheusTimeSeriesQuery",
"spec": {
"datasource": {
"kind": "PrometheusDatasource",
"name": "${datasource}"
},
"datasource": "${datasource}",
"minStep": "",
"query": "avg without (instance) (hadoop_hdfs_datanode_capacity{bar_stack_id=\"$bar_stack_id\", _target=~\"$datanode\"})",
"seriesNameFormat": "{{_target}}"
Expand Down
2 changes: 0 additions & 2 deletions prometheus/schemas/prometheus-time-series-query/query.cue
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,3 @@ spec: close({
minStep?: =~ds.#durationRegex | =~common.#variableSyntaxRegex
resolution?: number
})

#variableSyntaxRegex: "^\\$\\w+$"
Loading