MCPcopy
hub / github.com/benoitc/gunicorn / __init__

Method __init__

gunicorn/instrument/statsd.py:26–41  ·  view source on GitHub ↗
(self, cfg)

Source from the content-addressed store, hash-verified

24 """statsD-based instrumentation, that passes as a logger
25 """
26 def __init__(self, cfg):
27 Logger.__init__(self, cfg)
28 self.prefix = sub(r"^(.+[^.]+)\.*$", "\\g<1>.", cfg.statsd_prefix)
29
30 if isinstance(cfg.statsd_host, str):
31 address_family = socket.AF_UNIX
32 else:
33 address_family = socket.AF_INET
34
35 try:
36 self.sock = socket.socket(address_family, socket.SOCK_DGRAM)
37 self.sock.connect(cfg.statsd_host)
38 except Exception:
39 self.sock = None
40
41 self.dogstatsd_tags = cfg.dogstatsd_tags
42
43 # Log errors and warnings
44 def critical(self, msg, *args, **kwargs):

Callers

nothing calls this directly

Calls 1

connectMethod · 0.45

Tested by

no test coverage detected