2 * collectd - src/statsd.c
3 * Copyright (C) 2013 Florian octo Forster
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 * Florian octo Forster <octo at collectd.org>
30 #include "configfile.h"
31 #include "utils_avltree.h"
32 #include "utils_complain.h"
33 #include "utils_latency.h"
35 #include <sys/types.h>
39 /* AIX doesn't have MSG_DONTWAIT */
41 # define MSG_DONTWAIT MSG_NONBLOCK
44 #ifndef STATSD_DEFAULT_NODE
45 # define STATSD_DEFAULT_NODE NULL
48 #ifndef STATSD_DEFAULT_SERVICE
49 # define STATSD_DEFAULT_SERVICE "8125"
59 typedef enum metric_type_e metric_type_t;
61 struct statsd_metric_s
66 latency_counter_t *latency;
68 unsigned long updates_num;
70 typedef struct statsd_metric_s statsd_metric_t;
72 static c_avl_tree_t *metrics_tree = NULL;
73 static pthread_mutex_t metrics_lock = PTHREAD_MUTEX_INITIALIZER;
75 static pthread_t network_thread;
76 static _Bool network_thread_running = 0;
77 static _Bool network_thread_shutdown = 0;
79 static char *conf_node = NULL;
80 static char *conf_service = NULL;
82 static _Bool conf_delete_counters = 0;
83 static _Bool conf_delete_timers = 0;
84 static _Bool conf_delete_gauges = 0;
85 static _Bool conf_delete_sets = 0;
87 static double *conf_timer_percentile = NULL;
88 static size_t conf_timer_percentile_num = 0;
90 static _Bool conf_counter_sum = 0;
91 static _Bool conf_timer_lower = 0;
92 static _Bool conf_timer_upper = 0;
93 static _Bool conf_timer_sum = 0;
94 static _Bool conf_timer_count = 0;
96 /* Must hold metrics_lock when calling this function. */
97 static statsd_metric_t *statsd_metric_lookup_unsafe (char const *name, /* {{{ */
100 char key[DATA_MAX_NAME_LEN + 2];
102 statsd_metric_t *metric;
107 case STATSD_COUNTER: key[0] = 'c'; break;
108 case STATSD_TIMER: key[0] = 't'; break;
109 case STATSD_GAUGE: key[0] = 'g'; break;
110 case STATSD_SET: key[0] = 's'; break;
111 default: return (NULL);
115 sstrncpy (&key[2], name, sizeof (key) - 2);
117 status = c_avl_get (metrics_tree, key, (void *) &metric);
121 key_copy = strdup (key);
122 if (key_copy == NULL)
124 ERROR ("statsd plugin: strdup failed.");
128 metric = calloc (1, sizeof (*metric));
131 ERROR ("statsd plugin: calloc failed.");
137 metric->latency = NULL;
140 status = c_avl_insert (metrics_tree, key_copy, metric);
143 ERROR ("statsd plugin: c_avl_insert failed.");
150 } /* }}} statsd_metric_lookup_unsafe */
152 static int statsd_metric_set (char const *name, double value, /* {{{ */
155 statsd_metric_t *metric;
157 pthread_mutex_lock (&metrics_lock);
159 metric = statsd_metric_lookup_unsafe (name, type);
162 pthread_mutex_unlock (&metrics_lock);
166 metric->value = value;
167 metric->updates_num++;
169 pthread_mutex_unlock (&metrics_lock);
172 } /* }}} int statsd_metric_set */
174 static int statsd_metric_add (char const *name, double delta, /* {{{ */
177 statsd_metric_t *metric;
179 pthread_mutex_lock (&metrics_lock);
181 metric = statsd_metric_lookup_unsafe (name, type);
184 pthread_mutex_unlock (&metrics_lock);
188 metric->value += delta;
189 metric->updates_num++;
191 pthread_mutex_unlock (&metrics_lock);
194 } /* }}} int statsd_metric_add */
196 static void statsd_metric_free (statsd_metric_t *metric) /* {{{ */
201 if (metric->latency != NULL)
203 latency_counter_destroy (metric->latency);
204 metric->latency = NULL;
207 if (metric->set != NULL)
212 while (c_avl_pick (metric->set, &key, &value) == 0)
215 assert (value == NULL);
218 c_avl_destroy (metric->set);
223 } /* }}} void statsd_metric_free */
225 static int statsd_parse_value (char const *str, value_t *ret_value) /* {{{ */
229 ret_value->gauge = (gauge_t) strtod (str, &endptr);
230 if ((str == endptr) || ((endptr != NULL) && (*endptr != 0)))
234 } /* }}} int statsd_parse_value */
236 static int statsd_handle_counter (char const *name, /* {{{ */
237 char const *value_str,
244 if ((extra != NULL) && (extra[0] != '@'))
250 status = statsd_parse_value (extra + 1, &scale);
254 if (!isfinite (scale.gauge) || (scale.gauge <= 0.0) || (scale.gauge > 1.0))
259 status = statsd_parse_value (value_str, &value);
263 /* Changes to the counter are added to (statsd_metric_t*)->value. ->counter is
264 * only updated in statsd_metric_submit_unsafe(). */
265 return (statsd_metric_add (name, (double) (value.gauge / scale.gauge),
267 } /* }}} int statsd_handle_counter */
269 static int statsd_handle_gauge (char const *name, /* {{{ */
270 char const *value_str)
276 status = statsd_parse_value (value_str, &value);
280 if ((value_str[0] == '+') || (value_str[0] == '-'))
281 return (statsd_metric_add (name, (double) value.gauge, STATSD_GAUGE));
283 return (statsd_metric_set (name, (double) value.gauge, STATSD_GAUGE));
284 } /* }}} int statsd_handle_gauge */
286 static int statsd_handle_timer (char const *name, /* {{{ */
287 char const *value_str,
290 statsd_metric_t *metric;
296 if ((extra != NULL) && (extra[0] != '@'))
302 status = statsd_parse_value (extra + 1, &scale);
306 if (!isfinite (scale.gauge) || (scale.gauge <= 0.0) || (scale.gauge > 1.0))
311 status = statsd_parse_value (value_str, &value_ms);
315 value = MS_TO_CDTIME_T (value_ms.gauge / scale.gauge);
317 pthread_mutex_lock (&metrics_lock);
319 metric = statsd_metric_lookup_unsafe (name, STATSD_TIMER);
322 pthread_mutex_unlock (&metrics_lock);
326 if (metric->latency == NULL)
327 metric->latency = latency_counter_create ();
328 if (metric->latency == NULL)
330 pthread_mutex_unlock (&metrics_lock);
334 latency_counter_add (metric->latency, value);
335 metric->updates_num++;
337 pthread_mutex_unlock (&metrics_lock);
339 } /* }}} int statsd_handle_timer */
341 static int statsd_handle_set (char const *name, /* {{{ */
342 char const *set_key_orig)
344 statsd_metric_t *metric = NULL;
348 pthread_mutex_lock (&metrics_lock);
350 metric = statsd_metric_lookup_unsafe (name, STATSD_SET);
353 pthread_mutex_unlock (&metrics_lock);
357 /* Make sure metric->set exists. */
358 if (metric->set == NULL)
359 metric->set = c_avl_create ((void *) strcmp);
361 if (metric->set == NULL)
363 pthread_mutex_unlock (&metrics_lock);
364 ERROR ("statsd plugin: c_avl_create failed.");
368 set_key = strdup (set_key_orig);
371 pthread_mutex_unlock (&metrics_lock);
372 ERROR ("statsd plugin: strdup failed.");
376 status = c_avl_insert (metric->set, set_key, /* value = */ NULL);
379 pthread_mutex_unlock (&metrics_lock);
381 ERROR ("statsd plugin: c_avl_insert (\"%s\") failed with status %i.",
386 else if (status > 0) /* key already exists */
391 metric->updates_num++;
393 pthread_mutex_unlock (&metrics_lock);
395 } /* }}} int statsd_handle_set */
397 static int statsd_parse_line (char *buffer) /* {{{ */
404 type = strchr (name, '|');
410 value = strrchr (name, ':');
416 extra = strchr (type, '|');
423 if (strcmp ("c", type) == 0)
424 return (statsd_handle_counter (name, value, extra));
425 else if (strcmp ("ms", type) == 0)
426 return (statsd_handle_timer (name, value, extra));
428 /* extra is only valid for counters and timers */
432 if (strcmp ("g", type) == 0)
433 return (statsd_handle_gauge (name, value));
434 else if (strcmp ("s", type) == 0)
435 return (statsd_handle_set (name, value));
438 } /* }}} void statsd_parse_line */
440 static void statsd_parse_buffer (char *buffer) /* {{{ */
442 while (buffer != NULL)
448 next = strchr (buffer, '\n');
461 sstrncpy (orig, buffer, sizeof (orig));
463 status = statsd_parse_line (buffer);
465 ERROR ("statsd plugin: Unable to parse line: \"%s\"", orig);
469 } /* }}} void statsd_parse_buffer */
471 static void statsd_network_read (int fd) /* {{{ */
477 status = recv (fd, buffer, sizeof (buffer), /* flags = */ MSG_DONTWAIT);
482 if ((errno == EAGAIN) || (errno == EWOULDBLOCK))
485 ERROR ("statsd plugin: recv(2) failed: %s",
486 sstrerror (errno, errbuf, sizeof (errbuf)));
490 buffer_size = (size_t) status;
491 if (buffer_size >= sizeof (buffer))
492 buffer_size = sizeof (buffer) - 1;
493 buffer[buffer_size] = 0;
495 statsd_parse_buffer (buffer);
496 } /* }}} void statsd_network_read */
498 static int statsd_network_init (struct pollfd **ret_fds, /* {{{ */
501 struct pollfd *fds = NULL;
504 struct addrinfo ai_hints;
505 struct addrinfo *ai_list = NULL;
506 struct addrinfo *ai_ptr;
509 char const *node = (conf_node != NULL) ? conf_node : STATSD_DEFAULT_NODE;
510 char const *service = (conf_service != NULL)
511 ? conf_service : STATSD_DEFAULT_SERVICE;
513 memset (&ai_hints, 0, sizeof (ai_hints));
514 ai_hints.ai_flags = AI_PASSIVE;
516 ai_hints.ai_flags |= AI_ADDRCONFIG;
518 ai_hints.ai_family = AF_UNSPEC;
519 ai_hints.ai_socktype = SOCK_DGRAM;
521 status = getaddrinfo (node, service, &ai_hints, &ai_list);
524 ERROR ("statsd plugin: getaddrinfo (\"%s\", \"%s\") failed: %s",
525 node, service, gai_strerror (status));
529 for (ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next)
534 char dbg_node[NI_MAXHOST];
535 char dbg_service[NI_MAXSERV];
537 fd = socket (ai_ptr->ai_family, ai_ptr->ai_socktype, ai_ptr->ai_protocol);
541 ERROR ("statsd plugin: socket(2) failed: %s",
542 sstrerror (errno, errbuf, sizeof (errbuf)));
546 getnameinfo (ai_ptr->ai_addr, ai_ptr->ai_addrlen,
547 dbg_node, sizeof (dbg_node), dbg_service, sizeof (dbg_service),
548 NI_DGRAM | NI_NUMERICHOST | NI_NUMERICSERV);
549 DEBUG ("statsd plugin: Trying to bind to [%s]:%s ...", dbg_node, dbg_service);
551 status = bind (fd, ai_ptr->ai_addr, ai_ptr->ai_addrlen);
555 ERROR ("statsd plugin: bind(2) failed: %s",
556 sstrerror (errno, errbuf, sizeof (errbuf)));
561 tmp = realloc (fds, sizeof (*fds) * (fds_num + 1));
564 ERROR ("statsd plugin: realloc failed.");
572 memset (tmp, 0, sizeof (*tmp));
574 tmp->events = POLLIN | POLLPRI;
577 freeaddrinfo (ai_list);
581 ERROR ("statsd plugin: Unable to create listening socket for [%s]:%s.",
582 (node != NULL) ? node : "::", service);
587 *ret_fds_num = fds_num;
589 } /* }}} int statsd_network_init */
591 static void *statsd_network_thread (void *args) /* {{{ */
593 struct pollfd *fds = NULL;
598 status = statsd_network_init (&fds, &fds_num);
601 ERROR ("statsd plugin: Unable to open listening sockets.");
602 pthread_exit ((void *) 0);
605 while (!network_thread_shutdown)
607 status = poll (fds, (nfds_t) fds_num, /* timeout = */ -1);
612 if ((errno == EINTR) || (errno == EAGAIN))
615 ERROR ("statsd plugin: poll(2) failed: %s",
616 sstrerror (errno, errbuf, sizeof (errbuf)));
620 for (i = 0; i < fds_num; i++)
622 if ((fds[i].revents & (POLLIN | POLLPRI)) == 0)
625 statsd_network_read (fds[i].fd);
628 } /* while (!network_thread_shutdown) */
631 for (i = 0; i < fds_num; i++)
636 } /* }}} void *statsd_network_thread */
638 static int statsd_config_timer_percentile (oconfig_item_t *ci) /* {{{ */
640 double percent = NAN;
644 status = cf_util_get_double (ci, &percent);
648 if ((percent <= 0.0) || (percent >= 100))
650 ERROR ("statsd plugin: The value for \"%s\" must be between 0 and 100, "
651 "exclusively.", ci->key);
655 tmp = realloc (conf_timer_percentile,
656 sizeof (*conf_timer_percentile) * (conf_timer_percentile_num + 1));
659 ERROR ("statsd plugin: realloc failed.");
662 conf_timer_percentile = tmp;
663 conf_timer_percentile[conf_timer_percentile_num] = percent;
664 conf_timer_percentile_num++;
667 } /* }}} int statsd_config_timer_percentile */
669 static int statsd_config (oconfig_item_t *ci) /* {{{ */
673 for (i = 0; i < ci->children_num; i++)
675 oconfig_item_t *child = ci->children + i;
677 if (strcasecmp ("Host", child->key) == 0)
678 cf_util_get_string (child, &conf_node);
679 else if (strcasecmp ("Port", child->key) == 0)
680 cf_util_get_service (child, &conf_service);
681 else if (strcasecmp ("DeleteCounters", child->key) == 0)
682 cf_util_get_boolean (child, &conf_delete_counters);
683 else if (strcasecmp ("DeleteTimers", child->key) == 0)
684 cf_util_get_boolean (child, &conf_delete_timers);
685 else if (strcasecmp ("DeleteGauges", child->key) == 0)
686 cf_util_get_boolean (child, &conf_delete_gauges);
687 else if (strcasecmp ("DeleteSets", child->key) == 0)
688 cf_util_get_boolean (child, &conf_delete_sets);
689 else if (strcasecmp ("CounterSum", child->key) == 0)
690 cf_util_get_boolean (child, &conf_counter_sum);
691 else if (strcasecmp ("TimerLower", child->key) == 0)
692 cf_util_get_boolean (child, &conf_timer_lower);
693 else if (strcasecmp ("TimerUpper", child->key) == 0)
694 cf_util_get_boolean (child, &conf_timer_upper);
695 else if (strcasecmp ("TimerSum", child->key) == 0)
696 cf_util_get_boolean (child, &conf_timer_sum);
697 else if (strcasecmp ("TimerCount", child->key) == 0)
698 cf_util_get_boolean (child, &conf_timer_count);
699 else if (strcasecmp ("TimerPercentile", child->key) == 0)
700 statsd_config_timer_percentile (child);
702 ERROR ("statsd plugin: The \"%s\" config option is not valid.",
707 } /* }}} int statsd_config */
709 static int statsd_init (void) /* {{{ */
711 pthread_mutex_lock (&metrics_lock);
712 if (metrics_tree == NULL)
713 metrics_tree = c_avl_create ((void *) strcmp);
715 if (!network_thread_running)
719 status = pthread_create (&network_thread,
721 statsd_network_thread,
726 pthread_mutex_unlock (&metrics_lock);
727 ERROR ("statsd plugin: pthread_create failed: %s",
728 sstrerror (errno, errbuf, sizeof (errbuf)));
732 network_thread_running = 1;
734 pthread_mutex_unlock (&metrics_lock);
737 } /* }}} int statsd_init */
739 /* Must hold metrics_lock when calling this function. */
740 static int statsd_metric_clear_set_unsafe (statsd_metric_t *metric) /* {{{ */
745 if ((metric == NULL) || (metric->type != STATSD_SET))
748 if (metric->set == NULL)
751 while (c_avl_pick (metric->set, &key, &value) == 0)
758 } /* }}} int statsd_metric_clear_set_unsafe */
760 /* Must hold metrics_lock when calling this function. */
761 static int statsd_metric_submit_unsafe (char const *name, statsd_metric_t *metric) /* {{{ */
764 value_list_t vl = VALUE_LIST_INIT;
768 sstrncpy (vl.host, hostname_g, sizeof (vl.host));
769 sstrncpy (vl.plugin, "statsd", sizeof (vl.plugin));
771 if (metric->type == STATSD_GAUGE)
772 sstrncpy (vl.type, "gauge", sizeof (vl.type));
773 else if (metric->type == STATSD_TIMER)
774 sstrncpy (vl.type, "latency", sizeof (vl.type));
775 else if (metric->type == STATSD_SET)
776 sstrncpy (vl.type, "objects", sizeof (vl.type));
777 else /* if (metric->type == STATSD_COUNTER) */
778 sstrncpy (vl.type, "derive", sizeof (vl.type));
780 sstrncpy (vl.type_instance, name, sizeof (vl.type_instance));
782 if (metric->type == STATSD_GAUGE)
783 values[0].gauge = (gauge_t) metric->value;
784 else if (metric->type == STATSD_TIMER)
787 _Bool have_events = (metric->updates_num > 0);
789 /* Make sure all timer metrics share the *same* timestamp. */
792 ssnprintf (vl.type_instance, sizeof (vl.type_instance),
794 values[0].gauge = have_events
795 ? CDTIME_T_TO_DOUBLE (latency_counter_get_average (metric->latency))
797 plugin_dispatch_values (&vl);
799 if (conf_timer_lower) {
800 ssnprintf (vl.type_instance, sizeof (vl.type_instance),
802 values[0].gauge = have_events
803 ? CDTIME_T_TO_DOUBLE (latency_counter_get_min (metric->latency))
805 plugin_dispatch_values (&vl);
808 if (conf_timer_upper) {
809 ssnprintf (vl.type_instance, sizeof (vl.type_instance),
811 values[0].gauge = have_events
812 ? CDTIME_T_TO_DOUBLE (latency_counter_get_max (metric->latency))
814 plugin_dispatch_values (&vl);
817 if (conf_timer_sum) {
818 ssnprintf (vl.type_instance, sizeof (vl.type_instance),
820 values[0].gauge = have_events
821 ? CDTIME_T_TO_DOUBLE (latency_counter_get_sum (metric->latency))
823 plugin_dispatch_values (&vl);
826 for (i = 0; i < conf_timer_percentile_num; i++)
828 ssnprintf (vl.type_instance, sizeof (vl.type_instance),
829 "%s-percentile-%.0f", name, conf_timer_percentile[i]);
830 values[0].gauge = have_events
831 ? CDTIME_T_TO_DOUBLE (latency_counter_get_percentile (metric->latency, conf_timer_percentile[i]))
833 plugin_dispatch_values (&vl);
836 /* Keep this at the end, since vl.type is set to "gauge" here. The
837 * vl.type's above are implicitly set to "latency". */
838 if (conf_timer_count) {
839 sstrncpy (vl.type, "gauge", sizeof (vl.type));
840 ssnprintf (vl.type_instance, sizeof (vl.type_instance),
842 values[0].gauge = latency_counter_get_num (metric->latency);
843 plugin_dispatch_values (&vl);
846 latency_counter_reset (metric->latency);
849 else if (metric->type == STATSD_SET)
851 if (metric->set == NULL)
852 values[0].gauge = 0.0;
854 values[0].gauge = (gauge_t) c_avl_size (metric->set);
856 else { /* STATSD_COUNTER */
857 gauge_t delta = nearbyint (metric->value);
859 /* Etsy's statsd writes counters as two metrics: a rate and the change since
860 * the last write. Since collectd does not reset its DERIVE metrics to zero,
861 * this makes little sense, but we're dispatching a "count" metric here
862 * anyway - if requested by the user - for compatibility reasons. */
863 if (conf_counter_sum)
865 sstrncpy (vl.type, "count", sizeof (vl.type));
866 values[0].gauge = delta;
867 plugin_dispatch_values (&vl);
869 /* restore vl.type */
870 sstrncpy (vl.type, "derive", sizeof (vl.type));
873 /* Rather than resetting value to zero, subtract delta so we correctly keep
874 * track of residuals. */
875 metric->value -= delta;
876 metric->counter += (derive_t) delta;
878 values[0].derive = metric->counter;
881 return (plugin_dispatch_values (&vl));
882 } /* }}} int statsd_metric_submit_unsafe */
884 static int statsd_read (void) /* {{{ */
886 c_avl_iterator_t *iter;
888 statsd_metric_t *metric;
890 char **to_be_deleted = NULL;
891 size_t to_be_deleted_num = 0;
894 pthread_mutex_lock (&metrics_lock);
896 if (metrics_tree == NULL)
898 pthread_mutex_unlock (&metrics_lock);
902 iter = c_avl_get_iterator (metrics_tree);
903 while (c_avl_iterator_next (iter, (void *) &name, (void *) &metric) == 0)
905 if ((metric->updates_num == 0)
906 && ((conf_delete_counters && (metric->type == STATSD_COUNTER))
907 || (conf_delete_timers && (metric->type == STATSD_TIMER))
908 || (conf_delete_gauges && (metric->type == STATSD_GAUGE))
909 || (conf_delete_sets && (metric->type == STATSD_SET))))
911 DEBUG ("statsd plugin: Deleting metric \"%s\".", name);
912 strarray_add (&to_be_deleted, &to_be_deleted_num, name);
916 /* Names have a prefix, e.g. "c:", which determines the (statsd) type.
917 * Remove this here. */
918 statsd_metric_submit_unsafe (name + 2, metric);
920 /* Reset the metric. */
921 metric->updates_num = 0;
922 if (metric->type == STATSD_SET)
923 statsd_metric_clear_set_unsafe (metric);
925 c_avl_iterator_destroy (iter);
927 for (i = 0; i < to_be_deleted_num; i++)
931 status = c_avl_remove (metrics_tree, to_be_deleted[i],
932 (void *) &name, (void *) &metric);
935 ERROR ("stats plugin: c_avl_remove (\"%s\") failed with status %i.",
936 to_be_deleted[i], status);
941 statsd_metric_free (metric);
944 pthread_mutex_unlock (&metrics_lock);
946 strarray_free (to_be_deleted, to_be_deleted_num);
949 } /* }}} int statsd_read */
951 static int statsd_shutdown (void) /* {{{ */
956 if (network_thread_running)
958 network_thread_shutdown = 1;
959 pthread_kill (network_thread, SIGTERM);
960 pthread_join (network_thread, /* retval = */ NULL);
962 network_thread_running = 0;
964 pthread_mutex_lock (&metrics_lock);
966 while (c_avl_pick (metrics_tree, &key, &value) == 0)
969 statsd_metric_free (value);
971 c_avl_destroy (metrics_tree);
975 sfree (conf_service);
977 pthread_mutex_unlock (&metrics_lock);
980 } /* }}} int statsd_shutdown */
982 void module_register (void)
984 plugin_register_complex_config ("statsd", statsd_config);
985 plugin_register_init ("statsd", statsd_init);
986 plugin_register_read ("statsd", statsd_read);
987 plugin_register_shutdown ("statsd", statsd_shutdown);
990 /* vim: set sw=2 sts=2 et fdm=marker : */