refactor(metrics): use prometheus_metrics_enabled for configuration

As agreed upon during review, use this name to get started. If more
backends were to be added, the configuration structure will be updated.

Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
This commit is contained in:
Samuel Gaist 2024-04-16 09:21:48 +02:00 committed by poiana
parent 5c237a07dc
commit f90dbf9b77
4 changed files with 6 additions and 4 deletions

View File

@ -716,7 +716,9 @@ webserver:
# Can be an IPV4 or IPV6 address, defaults to IPV4
listen_address: 0.0.0.0
k8s_healthz_endpoint: /healthz
metrics_enabled: false
# Enable the metrics endpoint providing Prometheus values
# It will only have an effect if metrics.enabled is set to true as well.
prometheus_metrics_enabled: false
ssl_enabled: false
ssl_certificate: /etc/falco/falco.pem

View File

@ -456,7 +456,7 @@ void falco_configuration::load_yaml(const std::string& config_name)
{
m_webserver_config.m_threadiness = falco::utils::hardware_concurrency();
}
m_webserver_config.m_metrics_enabled = config.get_scalar<bool>("webserver.metrics_enabled", false);
m_webserver_config.m_prometheus_metrics_enabled = config.get_scalar<bool>("webserver.prometheus_metrics_enabled", false);
std::list<std::string> syscall_event_drop_acts;
config.get_sequence(syscall_event_drop_acts, "syscall_event_drops.actions");

View File

@ -90,7 +90,7 @@ public:
std::string m_k8s_healthz_endpoint = "/healthz";
bool m_ssl_enabled = false;
std::string m_ssl_certificate;
bool m_metrics_enabled = false;
bool m_prometheus_metrics_enabled = false;
};
falco_configuration();

View File

@ -65,7 +65,7 @@ void falco_webserver::start(
res.set_content(versions_json_str, "application/json");
});
if (state.config->m_metrics_enabled && webserver_config.m_metrics_enabled)
if (state.config->m_metrics_enabled && webserver_config.m_prometheus_metrics_enabled)
{
m_server->Get("/metrics",
[&state](const httplib::Request &, httplib::Response &res) {