Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom variables don't interpolate into panel titles #561

Closed
rdubrock opened this issue Feb 1, 2024 · 1 comment
Closed

Custom variables don't interpolate into panel titles #561

rdubrock opened this issue Feb 1, 2024 · 1 comment
Labels
type/bug Something isn't working

Comments

@rdubrock
Copy link

rdubrock commented Feb 1, 2024

I've got a few panels that are using both query and custom variables in their title. The query variables always interpolate correctly, but the custom variables do not. I've confirmed it has nothing to do with the values (if I switch a query variable to a custom variable with the same value, it no longer interpolates into the panel title).

An example of a panel:

new VizPanel({
    pluginId: 'barchart',
    $data: getQueryRunner(metrics),
    title: 'Response latency by phase: $probe ⮕ $job / $instance',  <= these three are a mix of custom and query variables
    ...

How the variables are set up:

 const probe = new QueryVariable({
    includeAll: true,
    allValue: '.*',
    defaultToAll: true,
    isMulti: true,
    name: 'probe',
    query: `label_values(sm_check_info{check_name="${checkType}"},probe)`,
    refresh: VariableRefresh.onDashboardLoad,
    datasource: metrics,
  });

   const job = new CustomVariable({
      name: 'job',
      value: checks[0].job,                <= this value is a string
      hide: VariableHide.hideVariable,
   });
   const instance = new CustomVariable({
      name: 'instance',
      value: checks[0].target,                 <= this value is a string
      hide: VariableHide.hideVariable,
   });
@torkelo
Copy link
Member

torkelo commented Feb 12, 2024

@rdubrock variables have a value and text representation (think of them as id and display text), your only setting the value not the text representation. And in panel titles we use the text representation .

Possible PR to help with this scenario, but not sure it's the right thing
#591

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants