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

Add support for Custom query parameters #309

Closed
tjungbauer opened this issue Nov 29, 2020 · 1 comment
Closed

Add support for Custom query parameters #309

tjungbauer opened this issue Nov 29, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@tjungbauer
Copy link

Is your feature request related to a problem? Please describe.
Please add support for the setting: "Custom query parameters" (customQueryParameters) into the datasource.

Describe the solution you'd like
It would be great if the Operator considers the datasource setting customQueryParameters.
Currently, you can set it in the CRD, but it does not end up in the ConfigMap nor in Grafana.

Additional context
I am trying to leverage OpenShift's user-defined monitoring to bring custom metrics into Grafana dashboards. The datasource is configured to talk to "thanos-querier" to find all required data.

In OpenShift there are two services for the thanos-querier.
One is listening on port 9091... everything fine here, I can see data. The problem is, I see too many.
The serviceaccount requires cluster permissions for monitoring (cluster-monitoring-view).
This means you will see ALL metrics. You can create a dashboard, for example, which is displaying all pods from the system.

Therefore, thanos-querier has a service on a second port: 9092.
Here, all you need are project view permissions in order to display metrics from one project only. However, this port requires, that you send the URL parameter "namespace=yournamespace" with the query.
(Thats actually the same, the Developer UI of OpenShift does.)

In Grafana you can configure this, by setting "Custom query parameters" (customQueryParamters) ... the problem is that this parameter will be lost after the grafana Pods restart or a new configuration is done.

Now I have to admit that this setting is not heavily documented inside Grafana documentation, but when you configure it manually on Grafana UI it ends up in the database like this:

sqlite> select * from data_source;
1|1|2|prometheus|Prometheus|proxy|https://thanos-querier.openshift-monitoring.svc.cluster.local:9092||||0|||1|{"customQueryParameters":"namespace=ns1","httpHeaderName1":"Authorization" ...

So, it seems to be part of the struct: jsonData.

@david-martin
Copy link
Contributor

Closed by #350

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants