Skip to content

Commit

Permalink
refactor(webserver): move metrics endpoint activation under webserver
Browse files Browse the repository at this point in the history
Signed-off-by: Samuel Gaist <[email protected]>
  • Loading branch information
sgaist committed Mar 26, 2024
1 parent d3775ae commit 3dceb89
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion falco.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ webserver:
# Can be an IPV4 or IPV6 address, defaults to IPV4
listen_address: 0.0.0.0
k8s_healthz_endpoint: /healthz
metrics_enabled: false
ssl_enabled: false
ssl_certificate: /etc/falco/falco.pem

Expand Down Expand Up @@ -982,7 +983,6 @@ metrics:
libbpf_stats_enabled: true
convert_memory_to_mb: true
include_empty_values: false
prometheus_enabled: false

#######################################
# Falco performance tuning (advanced) #
Expand Down
2 changes: 1 addition & 1 deletion userspace/falco/app/actions/start_webserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ falco::app::run_result falco::app::actions::start_webserver(falco::app::state& s
+ ssl_option + "\n");

std::vector<libs::metrics::libs_metrics_collector> metrics_collectors;
if (s.config->m_metrics_enabled && s.config->m_metrics_prometheus_enabled)
if (s.config->m_metrics_enabled && s.config->m_webserver_metrics_enabled)
{
for (const auto& source_info: s.source_infos)
{
Expand Down
6 changes: 3 additions & 3 deletions userspace/falco/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ falco_configuration::falco_configuration():
m_webserver_listen_address("0.0.0.0"),
m_webserver_k8s_healthz_endpoint("/healthz"),
m_webserver_ssl_enabled(false),
m_webserver_metrics_enabled(false),
m_syscall_evt_drop_threshold(.1),
m_syscall_evt_drop_rate(.03333),
m_syscall_evt_drop_max_burst(1),
Expand All @@ -79,8 +80,7 @@ falco_configuration::falco_configuration():
m_metrics_output_file(""),
m_metrics_flags((METRICS_V2_KERNEL_COUNTERS | METRICS_V2_LIBBPF_STATS | METRICS_V2_RESOURCE_UTILIZATION | METRICS_V2_STATE_COUNTERS)),
m_metrics_convert_memory_to_mb(true),
m_metrics_include_empty_values(false),
m_metrics_prometheus_enabled(false)
m_metrics_include_empty_values(false)
{
}

Expand Down Expand Up @@ -388,6 +388,7 @@ void falco_configuration::load_yaml(const std::string& config_name, const yaml_h
{
m_webserver_threadiness = falco::utils::hardware_concurrency();
}
m_webserver_metrics_enabled = config.get_scalar<bool>("webserver.metrics_enabled", false);

std::list<std::string> syscall_event_drop_acts;
config.get_sequence(syscall_event_drop_acts, "syscall_event_drops.actions");
Expand Down Expand Up @@ -480,7 +481,6 @@ void falco_configuration::load_yaml(const std::string& config_name, const yaml_h

m_metrics_convert_memory_to_mb = config.get_scalar<bool>("metrics.convert_memory_to_mb", true);
m_metrics_include_empty_values = config.get_scalar<bool>("metrics.include_empty_values", false);
m_metrics_prometheus_enabled = config.get_scalar<bool>("metrics.prometheus_enabled", false);

std::vector<std::string> load_plugins;

Expand Down
2 changes: 1 addition & 1 deletion userspace/falco/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class falco_configuration
std::string m_webserver_k8s_healthz_endpoint;
bool m_webserver_ssl_enabled;
std::string m_webserver_ssl_certificate;
bool m_webserver_metrics_enabled;

syscall_evt_drop_actions m_syscall_evt_drop_actions;
double m_syscall_evt_drop_threshold;
Expand All @@ -151,7 +152,6 @@ class falco_configuration
uint32_t m_metrics_flags;
bool m_metrics_convert_memory_to_mb;
bool m_metrics_include_empty_values;
bool m_metrics_prometheus_enabled;
std::vector<plugin_config> m_plugins;

// Falco engine
Expand Down

0 comments on commit 3dceb89

Please sign in to comment.