pub fn format_stats(&self, buckets: &Buckets) -> String {
        let start = time::get_time().sec;
        let mut stats = String::new();

        write!(stats,
               "{}{} {} {}\n",
               self.global_prefix,
               "statsd.bad_messages",
               buckets.bad_messages(),
               start)
            .unwrap();
        write!(stats,
               "{}{} {} {}\n",
               self.global_prefix,
               "statsd.total_messages",
               buckets.total_messages(),
               start)
            .unwrap();
        write!(stats,
               "{}{} {} {}\n",
               self.global_prefix,
               "statsd.unique_metrics",
               buckets.unique_metrics(),
               start)
            .unwrap();

        for (key, value) in buckets.counters().iter() {
            write!(stats, "{}{} {} {}\n", self.counter_prefix, key,
                   value / self.flush_interval_seconds as f64, start).unwrap();
        }

        for (key, value) in buckets.gauges().iter() {
            write!(stats, "{}{} {} {}\n", self.gauge_prefix, key, value, start).unwrap();
        }

        // The raw timer data is not sent to graphite.
        for (key, value) in buckets.timer_data().iter() {
            write!(stats, "{}{} {} {}\n", self.timer_prefix, key, value, start).unwrap();
        }
        stats
    }
/// Convert the buckets into a String that
/// can be sent to graphite's newline API
Convert the buckets into a String that
can be sent to graphite's newline API
Convert the buckets into a String that can be sent to graphite ' s newline API
pub fn format_stats(&self, buckets: &Buckets) -> String {
        let start = time::get_time().sec;
        let mut stats = String::new();
        write!(stats,
               "{}{} {} {}\n",
               self.global_prefix,
               "statsd.bad_messages",
               buckets.bad_messages(),
               start)
            .unwrap();
        write!(stats,
               "{}{} {} {}\n",
               self.global_prefix,
               "statsd.total_messages",
               buckets.total_messages(),
               start)
            .unwrap();
        write!(stats,
               "{}{} {} {}\n",
               self.global_prefix,
               "statsd.unique_metrics",
               buckets.unique_metrics(),
               start)
            .unwrap();
        for (key, value) in buckets.counters().iter() {
            write!(stats, "{}{} {} {}\n", self.counter_prefix, key,
                   value / self.flush_interval_seconds as f64, start).unwrap();
        }
        for (key, value) in buckets.gauges().iter() {
            write!(stats, "{}{} {} {}\n", self.gauge_prefix, key, value, start).unwrap();
        }
        // The raw timer data is not sent to graphite.
        for (key, value) in buckets.timer_data().iter() {
            write!(stats, "{}{} {} {}\n", self.timer_prefix, key, value, start).unwrap();
        }
        stats
    }
pub fn format_stats ( & self , buckets : & Buckets ) -> String { let start = time :: get_time ( ) . sec ; let mut stats = String :: new ( ) ; write ! ( stats " \n " self global_prefix " " buckets bad_messages ( ) start ) . unwrap ( ) ; write ! ( stats " \n " self global_prefix " " buckets total_messages ( ) start ) . unwrap ( ) ; write ! ( stats " \n " self global_prefix " " buckets unique_metrics ( ) start ) . unwrap ( ) ; for ( key , value ) in buckets . counters ( ) . iter ( ) { write ! ( stats " \n " self counter_prefix key value self flush_interval_seconds as f64 start ) . unwrap ( ) ; } for ( key , value ) in buckets . gauges ( ) . iter ( ) { write ! ( stats " \n " self gauge_prefix key value start ) . unwrap ( ) ; } // The raw timer data is not sent to graphite. for ( key , value ) in buckets . timer_data ( ) . iter ( ) { write ! ( stats " \n " self timer_prefix key value start ) . unwrap ( ) ; } stats }
Convert the buckets into a String that
can be sent to graphite's newline API
Convert the buckets into a String that can be sent to graphite ' s newline API
&self
buckets
&Buckets