Skip to content

Support for basic auth on the Prometheus API

What does this MR do and why?

Adds a new connection client, MimirClient to connect to Prometheus via Mimir - using basic auth.

Needs to be merged before adding mimir_api_url to prometheus_alert_db_indicators_settings:

How to set up and validate locally

To test the MimirClient

As we don't have access from our local machine, the best way is through staging rails-ro@console-ro-01-sv-gstg. So far, we can only check if headers are being correctly sent, as we don't have the auth env variable set.

  1. Connect to a Rails Console using Teleport
  2. Instantiate the MimirClient in the rails session and test the ready endpoint:
# Copy `Gitlab::MimirClient` module code from the feature branch to gstg console (as it's not yet merged).

[ gstg ] production> client = Gitlab::MimirClient.new(api_url: 'https://mimir-internal.ops.gke.gitlab.net/prometheus', user: 'user', password: 'pass', options: { allow_local_requests: true, verify: true, debug_output: STDOUT })

[ gstg ] production> client.ready?
=> true

[ gstg ] production> client.healthy?
=> true

Numbered steps to set up and validate the change are strongly suggested.

Related to #462021 (closed)

Edited by Prabakaran Murugesan

Merge request reports