mirror of
https://github.com/falcosecurity/falco.git
synced 2025-06-29 08:07:24 +00:00
update(userspace): minor polishing
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
parent
f117d5273c
commit
5d35cda8dc
@ -70,7 +70,6 @@ uint64_t parse_metrics_interval(std::string interval_str)
|
||||
{
|
||||
/* todo: deprecate for Falco 0.36. */
|
||||
interval = std::stoull(interval_str, nullptr, 0);
|
||||
std::cerr << "Metrics interval was passed as numeric value without Prometheus time unit, this option will no longer be supported starting Falco 0.36" << std::endl;
|
||||
}
|
||||
/* Option 2: Passing a Prometheus time duration.
|
||||
* https://prometheus.io/docs/prometheus/latest/querying/basics/#time-durations
|
||||
|
@ -27,7 +27,7 @@ static void apply_deprecated_options(
|
||||
{
|
||||
if (!opts.stats_output_file.empty() || !opts.stats_interval.empty())
|
||||
{
|
||||
falco_logger::log(LOG_WARNING, "Options '-s' and '--stats-interval' are deprecated, metrics must be configured in the config file");
|
||||
falco_logger::log(LOG_WARNING, "Options '-s' and '--stats-interval' will be deprecated in the future, metrics must be configured through config file");
|
||||
if (!opts.stats_output_file.empty())
|
||||
{
|
||||
cfg->m_metrics_enabled = true;
|
||||
|
@ -412,6 +412,11 @@ static falco::app::run_result init_stats_writer(
|
||||
return falco::app::run_result::fatal("Metrics interval must have a minimum value of 100ms");
|
||||
}
|
||||
|
||||
if(std::all_of(config->m_metrics_interval_str.begin(), config->m_metrics_interval_str.end(), ::isdigit))
|
||||
{
|
||||
falco_logger::log(LOG_WARNING, "Metrics interval was passed as numeric value without Prometheus time unit, this option will be deprecated in the future");
|
||||
}
|
||||
|
||||
if (config->m_metrics_enabled && !sw->has_output())
|
||||
{
|
||||
falco_logger::log(LOG_WARNING, "Metrics are enabled with no output configured, no snapshot will be collected");
|
||||
|
@ -163,9 +163,8 @@ void stats_writer::worker() noexcept
|
||||
{
|
||||
std::string rule = "Falco internal: metrics snapshot";
|
||||
std::string msg = "Falco metrics snapshot";
|
||||
uint64_t ts = 0; // todo: pass timestamp in message
|
||||
std::map<std::string,std::string> fields = {m.output_fields.begin(), m.output_fields.end()};
|
||||
m_outputs->handle_msg(ts, falco_common::PRIORITY_INFORMATIONAL, msg, rule, fields);
|
||||
m_outputs->handle_msg(m.ts, falco_common::PRIORITY_INFORMATIONAL, msg, rule, fields);
|
||||
}
|
||||
|
||||
if (use_file)
|
||||
@ -369,6 +368,7 @@ void stats_writer::collector::collect(const std::shared_ptr<sinsp>& inspector, c
|
||||
|
||||
/* Send message in the queue */
|
||||
stats_writer::msg msg;
|
||||
msg.ts = now;
|
||||
msg.source = src;
|
||||
msg.output_fields = std::move(output_fields);
|
||||
m_writer->push(msg);
|
||||
|
@ -125,13 +125,14 @@ public:
|
||||
private:
|
||||
struct msg
|
||||
{
|
||||
msg(): stop(false) {}
|
||||
msg(): stop(false), ts(0) {}
|
||||
msg(msg&&) = default;
|
||||
msg& operator = (msg&&) = default;
|
||||
msg(const msg&) = default;
|
||||
msg& operator = (const msg&) = default;
|
||||
|
||||
bool stop;
|
||||
uint64_t ts;
|
||||
std::string source;
|
||||
std::unordered_map<std::string, std::string> output_fields;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user