diff --git a/plugins/stats_pusher_statsd/plugin.c b/plugins/stats_pusher_statsd/plugin.c index e7bca47f..fe0c8380 100644 --- a/plugins/stats_pusher_statsd/plugin.c +++ b/plugins/stats_pusher_statsd/plugin.c @@ -16,6 +16,14 @@ it exports values exposed by the metric subsystem extern struct uwsgi_server uwsgi; +struct uwsgi_stats_pusher_statsd { + int no_workers; +} u_stats_pusher_statsd; + +static struct uwsgi_option stats_pusher_statsd_options[] = { + {"statsd-no-workers", no_argument, 0, "disable generation of single worker metrics", uwsgi_opt_true, &u_stats_pusher_statsd.no_workers, 0} +}; + // configuration of a statsd node struct statsd_node { int fd; @@ -88,7 +96,10 @@ static void stats_pusher_statsd(struct uwsgi_stats_pusher_instance *uspi, time_t while(um) { uwsgi_rlock(uwsgi.metrics_lock); // ignore return value - if (um->type == UWSGI_METRIC_GAUGE) { + if (u_stats_pusher_statsd.no_workers && strstr(um->name, "worker.") != NULL) { + // no-op + } + else if (um->type == UWSGI_METRIC_GAUGE) { statsd_send_metric(ub, uspi, um->name, um->name_len, *um->value, "|g"); } else { @@ -114,6 +125,7 @@ static void stats_pusher_statsd_init(void) { struct uwsgi_plugin stats_pusher_statsd_plugin = { .name = "stats_pusher_statsd", + .options = stats_pusher_statsd_options, .on_load = stats_pusher_statsd_init, };