Need unified Grafana variable across Prometheus + Infinity datasource (model name mapping fails)

Hi everyone,
I am trying to build a single unified dropdown variable in Grafana that filters panels coming from two different datasources:

1. vLLM Prometheus metrics

Models look like:

gpt-4o
gpt-4.1
o1-mini

2. AI Analysis API (Infinity datasource)

Models come as slugs:

gpt-4o-latest
gpt-4.1-preview
o1-mini-2024-12


:fire: Goal

I need ONE Grafana dropdown variable (for example: model) that can filter both:

  • Prometheus panels

  • Infinity datasource panels

at the same time.

Example:
If user selects gpt-4o, both panels should show only that model’s data, regardless of how each datasource names it internally.


:puzzle_piece: The problem

The naming between the two datasources is inconsistent:

Prometheus (vLLM) Infinity API slug
gpt-4o gpt-4o-latest
gpt-4.1 gpt-4.1-preview
o1-mini o1-mini-2024-12

I need mapping like:

gpt-4o β†’ gpt-4o-latest
gpt-4.1 β†’ gpt-4.1-preview
o1-mini β†’ o1-mini-2024-12


:warning: Constraints

These constraints make it difficult:

  • Custom variables only allow static comma-separated values (no mapping)

  • Query variables work only with:

    • Regex

    • Value β†’ Text mapping

  • Infinity datasource does NOT allow variables inside jq parsing

  • I want one dropdown, not multiple variables

  • Need to access both values:

    • ${model_prom}

    • ${model_api}

but I cannot define two linked variables automatically.


:test_tube: What I tried (and why it failed)

1. Defining a single variable with combined values

Example:

gpt-4o : gpt-4o-latest
gpt-4.1 : gpt-4.1-preview

Grafana ignores mapping inside Custom variables β†’ fails.

2. Using regex in Query variable

Prometheus supports it, Infinity does not β†’ fails.

3. Using transformations to rewrite variable values

Transformation UI does not expose variable context β†’ fails.

4. Using Chained variables

Works only if the second variable can access the first,
but Infinity datasource prevents using ${var} in jq β†’ fails.

5. Hard-coded mapping in JQ

Infinity parser can’t evaluate Grafana template variables β†’ fails.

I’ve tried many mapping approaches, but Grafana always fails to read the variable in one of the two datasources.


:red_question_mark: The Question

:backhand_index_pointing_right: How can I create ONE Grafana dropdown that selects a model and automatically maps it to:

  • the Prometheus model name

  • the Infinity API slug

so both datasource panels filter correctly?

Ideally, I need:

  • one variable like ${model}

  • and automatically generate ${model_prom} + ${model_api}
    or something equivalent.

Is there a recommended Grafana pattern for cross-datasource variable mapping when variable substitution is partially unsupported?

If not, is there a known workaround for the Infinity datasource so it can use variables inside jq?

Any guidance, patterns, or examples would really help.


:folded_hands: Thanks!

This is a blocker for making a unified dashboard, so any help from the community, Grafana engineers, or Infinity plugin maintainers would be very appreciated.


Try infinity data source with these values

grafana will understand those custom __text and __value column headers to mean key: value, hide __valueshow __text.

Then use ${combined:text} and ${combined:value}

Thank you but the issue when I called this way in jq Query, it is is inteprpreted as string and it didnt get passed as parameter to jq query .data as $row

| $row.over_time_performance\[\]
| {
    time: .date,
    tftt_ai: .median_time_to_first_token_seconds,
    model_name: $row.model_name,
    model_slug: $row.model_slug,
    selected_value: "${model__value}"  # Add this to see what value is being passed
  }

What if you used single quote instead of double quotes

| $row.over_time_performance
| {
time: .date,
tftt_ai: .median_time_to_first_token_seconds,
model_name: $row.model_name,
model_slug: $row.model_slug,
selected_value: β€˜${model__value}’ # Add this to see what value is being passed
}

1 Like