mirror of
https://github.com/falcosecurity/falco.git
synced 2025-06-28 07:37:32 +00:00
fix(userspace/faclco): output drop perc metric only if drops are present
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
parent
d550552fc1
commit
00acd17ba1
@ -343,6 +343,14 @@ void stats_writer::collector::get_metrics_output_fields_additional(
|
||||
{
|
||||
output_fields["scap.evts_drop_rate_sec"] = (double)(0);
|
||||
}
|
||||
if((n_evts - m_last_n_evts) > 0)
|
||||
{
|
||||
output_fields["scap.n_drops_perc"] = (double)((100.0 * (n_drops - m_last_n_drops)) / (n_evts - m_last_n_evts));
|
||||
}
|
||||
else
|
||||
{
|
||||
output_fields["scap.n_drops_perc"] = (double)(0);
|
||||
}
|
||||
output_fields["scap.n_drops_prev"] = m_last_n_drops;
|
||||
}
|
||||
output_fields[metric_name] = stats_v2[stat].value.u64;
|
||||
@ -351,14 +359,6 @@ void stats_writer::collector::get_metrics_output_fields_additional(
|
||||
break;
|
||||
}
|
||||
}
|
||||
if((n_evts - m_last_n_evts) > 0)
|
||||
{
|
||||
output_fields["scap.n_drops_perc"] = (double)((100.0 * (n_drops - m_last_n_drops)) / (n_evts - m_last_n_evts));
|
||||
}
|
||||
else
|
||||
{
|
||||
output_fields["scap.n_drops_perc"] = (double)(0);
|
||||
}
|
||||
m_last_n_evts = n_evts;
|
||||
m_last_n_drops = n_drops;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user