When using Mixed data-sources, missing props.data.request.scopedVars values

Hi
In my custom panel plugin, I am checking for the value of

props.data.request.scopedVars

When I use my custom data source it work fine, I get that value that was initially set.
But when I use the “Mixed” values, and use another data-source, the scopedVars is missing my custom data-source data.
Anyone knows why is this happening ?

Hello @ilibilibom

May you please add more context to this issue.

On my side I use mixed datasource with Influx and Prometheus and scopedVars is works fine.

Regards,
V.

Hi @vsergeyev
Sorry for the late replay,
I have a custom data source that is running in “mixed” mode along with a Prometheus DS.
When I try accessing the scopedVars in my custom panel (in mixed mode), I see only these variables (that are set by Grafana by default):

  1. __interval: {text: “6h”, value: “6h”}
  2. __interval_ms: {text: “21600000”, value: 21600000}

and missing all of the scoped vars that I set in my custom DS plugin.

The scope vars do appear in the “regular” DS mode (when only my custom DS is defined as the panel DS).
Do you have any clue why this is happening ?

Here is a solution that I found:

import { DataSourceApi } from '@grafana/data';
import { getDataSourceSrv } from '@grafana/runtime';

        let dataSource:DataSourceApi = getDataSourceSrv() as unknown as DataSourceApi;    
        let variable = _.find(dataSource.templateSrv.variables, {'name':'location_id'});
1 Like