mirror of
https://github.com/falcosecurity/falco.git
synced 2025-06-29 08:07:24 +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,14 +343,6 @@ void stats_writer::collector::get_metrics_output_fields_additional(
|
|||||||
{
|
{
|
||||||
output_fields["scap.evts_drop_rate_sec"] = (double)(0);
|
output_fields["scap.evts_drop_rate_sec"] = (double)(0);
|
||||||
}
|
}
|
||||||
output_fields["scap.n_drops_prev"] = m_last_n_drops;
|
|
||||||
}
|
|
||||||
output_fields[metric_name] = stats_v2[stat].value.u64;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if((n_evts - m_last_n_evts) > 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));
|
output_fields["scap.n_drops_perc"] = (double)((100.0 * (n_drops - m_last_n_drops)) / (n_evts - m_last_n_evts));
|
||||||
@ -359,6 +351,14 @@ void stats_writer::collector::get_metrics_output_fields_additional(
|
|||||||
{
|
{
|
||||||
output_fields["scap.n_drops_perc"] = (double)(0);
|
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;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
m_last_n_evts = n_evts;
|
m_last_n_evts = n_evts;
|
||||||
m_last_n_drops = n_drops;
|
m_last_n_drops = n_drops;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user