Prometheus Label Names Variable CUE SDK

This library helps creating prometheus label names variables in the format expected by Perses.

Usage#

package myDaC

import (
	labelNamesVarBuilder "github.com/perses/plugins/prometheus/sdk/cue/variable/labelnames"
)

labelNamesVarBuilder & {} // input parameters expected

Parameters#

ParameterTypeMandatory/OptionalDefaultDescription
#namestringMandatoryThe name of this variable.
#datasourceNamestringMandatoryThe name of the datasource to query.
#allowAllValuebooleanOptionalfalseWhether to append the "All" value to the list.
#allowMultiplebooleanOptionalfalseWhether to allow multi-selection of values.
#capturingRegexpstringOptionalRegexp used to catch and filter the results of the query. If empty, then nothing is filtered (equivalent of setting it to (.*)).
#customAllValuestringOptionalCustom value that will be used if #allowAllValue is true and if All is selected.
#displayDisplayOptionalDisplay object to tune the display name, description and visibility (show/hide).
#metricstringOptionalThe name of the source metric to be used. /!\ Mandatory if you want to rely on the standard query pattern, thus didn't provide a value to the #query parameter.
#querystringOptionalCustom query to be used for this variable. /!\ Mandatory if you didn't provide a value to the #metric parameter.
#sortSortOptionalSort method to apply when rendering the list of values.

Output#

FieldTypeDescription
variableVariableThe final variable object, to be passed to the dashboard.

Example#

package myDaC

import (
	labelNamesVarBuilder "github.com/perses/plugins/prometheus/sdk/cue/variable/labelnames"
)

{labelNamesVarBuilder & {
	#name:           "namespaceLabels"
	#metric:         "kube_namespace_labels"
	#datasourceName: "promDemo"
}}.variable