Support for basic auth on the Prometheus API
requested to merge 462021-database-indicators-support-for-basic-auth-on-the-prometheus-api into master
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
MimirClient
To test the 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.
- Connect to a Rails Console using Teleport
- Instantiate the
MimirClient
in the rails session and test theready
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