Skip to content

Create lib to read internal Prometheus address from config

Reuben Pereira requested to merge 32353-prometheus-internal into master

What does this MR do?

The internal Prometheus listen_address is present in the GitLab config file. However, it is not always a valid URL. For example, :9090 is a valid Prometheus listen_address and tells Prometheus to listen on 0.0.0.0 at port 9090. To get the address at which Prometheus can be accessed (API and UI), we need to convert the Prometheus listen_address into a valid URL.

The code to read the Prometheus config settings (listen_address and enable boolean) was already present in Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService. This MR moves out the code for reading the config into a new class.

In summary, the changes that this MR contains are:

  1. A new class at Prometheus::Internal which contains methods to:

    1. Read the Prometheus listen_address from the config file.

    2. Read the Prometheus enable flag from the config file.

    3. Convert the Prometheus listen_address into a valid URL.

Issue: #32353 (closed)

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by 🤖 GitLab Bot 🤖

Merge request reports