Variable Group builder

The Variable Group builder takes care of generating a pattern that we often see in dashboards: when you have e.g 3 variables A, B and C, it’s quite common to “bind” them together so that B depends on A, and C depends on B + A.

Usage

package myDaC

import (
	varGroupBuilder "github.com/perses/perses/cue/dac-utils/variable/group"
)

varGroupBuilder & {} // input parameters expected

Parameters

ParameterTypeMandatory/OptionalDefaultDescription
#input[…varBuilder]MandatoryThe list of variables to be grouped.

Technically the array could contain any kind of object, still it is meant to receive variables builder entries that are going to do something with the dependencies appended by the Variable Group builder. You can also pass to it variables for which the notion of dependencies don’t/can’t apply (like text variables or static lists) but that will still be used as dependencies for the following variables.

Output

FieldTypeDescription
variables[…Variable]The final list of variables objects, to be passed to the dashboard.

Example

package myDaC

import (
	varGroupBuilder "github.com/perses/perses/cue/dac-utils/variable/group"
	textVarBuilder "github.com/perses/perses/cue/dac-utils/variable/text"
	promQLVarBuilder "github.com/perses/perses/cue/dac-utils/prometheus/variable/promql"
	labelValuesVarBuilder "github.com/perses/perses/cue/dac-utils/prometheus/variable/labelvalues"
)

{varGroupBuilder & {
	#input: [
		textVarBuilder & {
			#name:     "prometheus"
			#value:    "platform"
			#constant: true
		},
		labelValuesVarBuilder & {
			#name: "stack"
			#display: name: "PaaS"
			#metric:         "thanos_build_info"
			#label:          "stack"
			#datasourceName: "promDemo"
		},
		promQLVarBuilder & {
			#name:           "namespace"
			#metric:         "kube_namespace_labels"
			#allowMultiple:  true
			#datasourceName: "promDemo"
		}
	]
}}.variables