Create lib to read internal Prometheus address from config
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:
-
A new class at
Prometheus::Internal
which contains methods to:-
Read the Prometheus
listen_address
from the config file. -
Read the Prometheus
enable
flag from the config file. -
Convert the Prometheus listen_address into a valid URL.
-
Issue: #32353 (closed)
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation created/updated or follow-up review issue created -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers
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