Skip to content

Bug: Custom Query Parameters on Prometheus Datasource Have No Effect When Using Thanos #8455

@KUMNISIP

Description

@KUMNISIP

helm version - v3
kubectl version - 1.33.2
chart : kube-prometheus-stack
chart version - v72.3.1

Even though custom query parameters are configured for the Prometheus datasource, they do not appear to have any effect on queries that are routed through Thanos. The same queries, when executed directly against Prometheus (bypassing Thanos), work as expected with the custom parameters applied.

When configuring a Prometheus datasource in Grafana with custom query parameters, these parameters should be passed correctly to the Prometheus instance (or Thanos if used). The query should be modified as per the custom parameters, resulting in correct and expected data retrieval

Reproducing
Set up kube-prometheus-stack with Thanos as the Prometheus remote storage.
Configure a Prometheus datasource in Grafana, specifying custom query parameters (e.g., time range, filters, etc.).
Create a panel in Grafana that uses the Prometheus datasource with the custom parameters.
Observe that the custom parameters do not affect the query when routed through Thanos.

You can prove it by setting any label in the custom query parameters box. And then do a query against a metric that has that label value as well as other values ie
a namespace label for any metric "namespace=kube-prom" but you will still get metrics back from all namespaces

Basically if you do the customQueryParamaters setting in the thanos datasource in grafana, adding a label like we did has no effect

ArgoCD was used

The lines added to the .YAML were:

customQueryParameters: "environment=dev-k8s"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions