예제 #1
0
 def __init__(self, cfg):
     """host, port: statsD server
     """
     Logger.__init__(self, cfg)
     try:
         host, port = cfg.statsd_host
         self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
         self.sock.connect((host, int(port)))
     except Exception:
         self.sock = None
예제 #2
0
 def __init__(self, cfg):
     """host, port: statsD server
     """
     Logger.__init__(self, cfg)
     try:
         host, port = cfg.statsd_host
         self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
         self.sock.connect((host, int(port)))
     except Exception:
         self.sock = None
예제 #3
0
 def __init__(self, cfg):
     """host, port: statsD server
     """
     Logger.__init__(self, cfg)
     self.prefix = sub(r"^(.+[^.]+)\.*$", "\\g<1>.", cfg.statsd_prefix)
     try:
         host, port = cfg.statsd_host
         self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
         self.sock.connect((host, int(port)))
     except Exception:
         self.sock = None
예제 #4
0
 def __init__(self, cfg):
     """host, port: statsD server
     """
     Logger.__init__(self, cfg)
     self.prefix = sub(r"^(.+[^.]+)\.*$", "\\g<1>.", cfg.statsd_prefix)
     try:
         host, port = cfg.statsd_host
         self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
         self.sock.connect((host, int(port)))
     except Exception:
         self.sock = None
예제 #5
0
 def __init__(self, cfg):
     Logger.__init__(self, cfg)
     self.is_statsd = False
     statsd_server = os.environ.get("statsd")
     if statsd_server:
         try:
             host, port = statsd_server.split(":")
             self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
             self.sock.connect((host, int(port)))
         except Exception:
             self.sock = None
         else:
             self.is_statsd = True
예제 #6
0
 def __init__(self, cfg):
     Logger.__init__(self, cfg)
     self.is_statsd = False
     statsd_server = os.environ.get("statsd")
     if statsd_server:
         try:
             host, port = statsd_server.split(":")
             self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
             self.sock.connect((host, int(port)))
         except Exception:
             self.sock = None
         else:
             self.is_statsd = True
예제 #7
0
    def __init__(self, cfg):
        """host, port: statsD server
        """
        Logger.__init__(self, cfg)
        self.prefix = sub(r"^(.+[^.]+)\.*$", "\\g<1>.", cfg.statsd_prefix)

        if cfg.statsd_socket:
            address_family = socket.AF_UNIX
            address = cfg.statsd_socket
        elif cfg.statsd_host:
            address_family = socket.AF_INET
            host, port = cfg.statsd_host
            address = (host, int(port))

        try:
            self.sock = socket.socket(address_family, socket.SOCK_DGRAM)
            self.sock.connect(address)
        except Exception:
            self.sock = None

        self.dogstatsd_tags = cfg.dogstatsd_tags
예제 #8
0
 def __init__(self, cfg):
     Logger.__init__(self, cfg)