def _post(self, args): self.dog.timeout = args.timeout if args.localhostname: host = find_localhost() else: host = args.host if args.tags: tags = sorted(set([t.strip() for t in args.tags.split(',') if t])) else: tags = None # are we sending a counter? if args.counter: metric_type = MetricType.Counter else: metric_type = MetricType.Gauge res = self.dog.metric(args.name, args.value, host=host, device=args.device, tags=tags, metric_type=metric_type) report_warnings(res) report_errors(res)
def test_find_localhost(self): # Once run assert socket.getfqdn() == find_localhost() # Once memoized assert socket.getfqdn() == find_localhost()