Skip to content

Adhoc filters don't work on the panels with datasource variable #1114

Open
@sukhada369

Description

@sukhada369

What happened:
We are using following versions:
Grafana: v11.4.0
Grafana clickhouse-datasource plugin: v4.5.1
ClickHouse client version: 24.11.1.2557

Adhoc filters don't work on the panels with datasource variable. It works as expected when datasource is explicitly selected in the panel dropdown. In Query inspector we see that additional "additional_table_filters" setting is not getting appended in case of datasource variable is selected.

What you expected to happen:
additional_table_filters should append with datasource variable

How to reproduce it (as minimally and precisely as possible):

  1. Create a single Clickhouse datasource. Create a dashboard with two panels and ensure data is coming in. We are using SQL Editor to add our panel queries.
  2. From the "Logs" panel add a filter and notice that both the panels are showing only the filtered data.
  3. Create one more Clickhouse datasource. Update dashboard with a variable of type Datasources and ensure that both the Clickhouse datasources are available in the variable dropdown. Update both the panels to use the datasource variable.
  4. Refresh the dashboard and change the datasources to ensure that data is coming in from both the datasources and both the panels are updating
  5. From "Logs" panel add filter. Data won't change on both the panels [This is the problem]

How to further debug with Query Inspector:

  1. Edit the "Logs" panel with explicit datasource
  2. Expand one of the logs and filter a value
  3. Execute "Run Query" -> "Query Inspector" -> "Query" tab -> "Refresh" -> This will show what query was executed against Clickhouse
  4. Notice that the end of query is appended with "settings additional_table_filters=<your_filter>"
  5. Close the Query inspector and in Datasource select the Datasource variable and perform all the steps again

Screenshots

With datasource explicitly selected:

Image

With Datasource variable:

Image

Anything else we need to know?:

Environment:

  • Grafana version: 11.4.0
  • Plugin version: 4.5.1
  • OS Grafana is installed on: OEL8
  • User OS & Browser: MAC, Google Chrome
  • Others:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Incoming

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions