Skip to content

Commit

Permalink
statistics: Improve iteration example
Browse files Browse the repository at this point in the history
Clarify a hidden gotcha: the stat name iterator does not include the
stat group!
  • Loading branch information
liviuchircu committed May 17, 2019
1 parent 9842085 commit 0dcbf9e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/statistics/doc/statistics_admin.xml
Expand Up @@ -246,9 +246,11 @@ stat_iter_init("packet", "iter");
<title><function>stat_iter_next</function> usage</title>
<programlisting format="linespecific">
...
stat_iter_init("packet", "iter");
while (stat_iter_next($var(k), $var(v), "iter")) {
...
# periodically clear packet-related data
timer_route [clear_packet_stats, 7200] {
stat_iter_init("packet", "iter");
while (stat_iter_next($var(stat), $var(val), "iter"))
reset_stat("packet:$var(stat)");
}
...
</programlisting>
Expand Down

0 comments on commit 0dcbf9e

Please sign in to comment.