Presentation Interpolation

See it in the scaffold: the presentation and mapping files in the stackvista/stackpack-templates scaffold use both CEL expressions (for example tags.singleValue('service.namespace')) and ${…​} string templates throughout — see settings/presentations/cart.sty and settings/component-mappings/microservices.sty.

Interpolation

When defining Component Presentations, a couple of different types of expressions are used. When selecting a value to project in a highlight field, or when controlling whether a highlight link is visible, a CEL expression can be used. Some string fields, such as highlight link title, target, and tooltip, use string templates with embedded CEL placeholders.

CEL expression

CEL expressions are evaluated in an environment representing the component. This is the case on most projections in highlight fields or overview columns, metrics, and the presentation.highlight.links.filter field. The same CEL expressions can also be embedded in string templates using ${CEL_EXPRESSION} placeholders. The following variables are available. Example:

'service.namespace' in resource.attributes ?  resource.attributes['service.namespace'] : 'default'

String templates

String templates are literal strings that can include ${CEL_EXPRESSION} placeholders. Placeholder expressions are evaluated against the current component and inserted into the result.

For example:

title: "Service dashboard"
target: "https://example.com/dashboards/${name}"
tooltip: "Open dashboard for ${name}"

If no $\{…​} placeholder is present, the value is treated as literal text. To evaluate a CEL expression, wrap it in $\{…​}.

target: "${properties['dashboardUrl']}"

The presentation.highlight.links.filter field is not a string template. It is a pure CEL boolean expression.

Variable Type Description

name

string

The name of the component

typeName

string

The type of the component

identifiers

list<string>

Identifiers of the component

tags

map<string,string>

Labels of the component, in key-value pairs

properties

map<string,dyn>

Properties of the component

healthState

string

One of the supported health states (CLEAR, DEVIATING, CRITICAL, UNKNOWN)

lastUpdateTimestamp

uint

Timestamp of last update, in milliseconds since epoch

CEL provisioning expression

When selecting an source component to provide configuration and status details, the source variable is available. Example:

external.mapping.identifier == 'service-instance'
Variable Type Description

source.identifier

string

An identifier unique to the source component

source.tags

map<string,string>

Tags contributed by the source component

source.configuration

map<string,dyn>

Configuration of the (external) component

source.mapping.identifier

string

The identifier of the OTEL component mapping (empty when not applicable)

source.mapping.name

string

The name of the OTEL component mapping (empty when not applicable)

source.topologySync.identifier

string

The identifier of the topology sync (empty when not applicable)

source.topologySync.name

string

The name of the topology sync (empty when not applicable)

source.selectorProperties

map<string,dyn>

Additional properties published by the topology source for selection purposes

Variable expression

When the available variables are dependent on a query, straightforward variable interpolation is possible. This is the case when dealing with time series returned by a PromQL query (the alias and componentIdentifierTemplate fields).