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 Datasource Custom query parameters (customQueryParame… #350

Merged

Conversation

kirchknopfc
Copy link
Contributor

Description

Grafana has an option to define Custom query parameters on an Prometheus data source.
Basically, it means that this query parameter add to the Promtheus or Thanos queries.

The query parameter example is required if OpenShift's user-defined monitoring is used as Prometheus datasource.
The OpenShift thanos-querier (https://thanos-querier.openshift-monitoring.svc.cluster.local:9092) needed the URL parameter "namespace=yournamespace" in the query as parameter.

The option on the Prometheus datasource is called "Custom query parameters" (customQueryParameters) in the section "Misc":
image

The proposed change adds support for set the Custom query parameters via the GrafanaDatasource CRD.

Relevant issues/tickets

PR #309

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • This change requires a documentation update
    I've added an example below, you might want to include it in the documentation. But not all option are documented

  • I have added a test case that will be used to verify my changes

  • Verified independently on a cluster by reviewer

Verification steps

  1. Deploy a data source (GrafanaDatasource) with the following specification:
apiVersion: integreatly.org/v1alpha1
kind: GrafanaDataSource
metadata:
  name: test-grafanadatasource
spec:
  name: prometheus.yaml
  datasources:
    - name: Prometheus
      type: prometheus
      access: proxy
      url: https://thanos-querier.openshift-monitoring.svc.cluster.local:9092
      isDefault: true
      version: 1
      editable: true
      jsonData:
        tlsSkipVerify: true
        customQueryParameters: "namespace=ns1"
  1. In Grafana go to the data source settings (Configuration -> Datasources -> Prometheus)
    The Custom query parameters option should be set to "namespace=ns1".
    image

@openshift-ci-robot
Copy link

Hi @kirchknopfc. Thanks for your PR.

I'm waiting for a integr8ly member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@kirchknopfc
Copy link
Contributor Author

/assign @pb82

Copy link
Collaborator

@HVBE HVBE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see inline comment, once that's addressed I'm happy to merge this in 👍

sure was my misstake

Co-authored-by: Hubert Stefanski <35736504+HubertStefanski@users.noreply.github.com>
Copy link
Collaborator

@HVBE HVBE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm, thanks for contributing @kirchknopfc

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: HubertStefanski

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@HVBE
Copy link
Collaborator

HVBE commented Feb 14, 2021

/lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants