Add env var toggle for StatsD

This commit is contained in:
Edznux
2020-10-08 20:48:46 +02:00
parent deab5a1532
commit 0220a8ff66
6 changed files with 23 additions and 17 deletions

View File

@ -423,17 +423,18 @@ void show_stats(afl_state_t *afl) {
}
#ifdef USE_STATSD
if (cur_ms - afl->statsd_last_send_ms > STATSD_UPDATE_SEC * 1000) {
if (unlikely(afl->afl_env.afl_statsd == 1)) {
/* reset counter, even if send failed. */
afl->statsd_last_send_ms = cur_ms;
if (statsd_send_metric(afl)) { WARNF("coundln't send statsd metric."); }
if (cur_ms - afl->statsd_last_send_ms > STATSD_UPDATE_SEC * 1000) {
/* reset counter, even if send failed. */
afl->statsd_last_send_ms = cur_ms;
if (statsd_send_metric(afl)) { WARNF("coundln't send statsd metric."); }
}
}
#endif
/* Every now and then, write plot data. */
if (cur_ms - afl->stats_last_plot_ms > PLOT_UPDATE_SEC * 1000) {