import statsd

from . import compat


class Gauge(statsd.Client):
    '''Class to implement a statsd gauge

    '''

    def send(self, subname, value):
        '''Send the data to statsd via self.connection

        :keyword subname: The subname to report the data to (appended to the
            client name)
        :keyword value: The gauge value to send
        '''
        assert isinstance(value, compat.NUM_TYPES)
        name = self._get_name(self.name, subname)
        self.logger.info('%s: %s', name, value)
        return statsd.Client._send(self, {name: '%s|g' % value})


import statsd
import decimal


class Gauge(statsd.Client):
    '''Class to implement a statsd gauge

    '''

    def send(self, subname, value):
        '''Send the data to statsd via self.connection

        :keyword subname: The subname to report the data to (appended to the
            client name)
        :keyword value: The gauge value to send
        '''
        assert isinstance(value, (int, long, float, decimal.Decimal))
        name = self._get_name(self.name, subname)
        self.logger.info('%s: %s', name, value)
        return statsd.Client._send(self, {name: '%s|g' % value})


--- 
+++ 
@@ -1,5 +1,6 @@
 import statsd
-import decimal
+
+from . import compat
 
 
 class Gauge(statsd.Client):
@@ -14,7 +15,7 @@
             client name)
         :keyword value: The gauge value to send
         '''
-        assert isinstance(value, (int, long, float, decimal.Decimal))
+        assert isinstance(value, compat.NUM_TYPES)
         name = self._get_name(self.name, subname)
         self.logger.info('%s: %s', name, value)
         return statsd.Client._send(self, {name: '%s|g' % value})
Use compat.NUM_TYPES due to removal of long in py3k
