def test_basic_log_parsing(self): metric_name, timestamp, request_time, attrs = parse_nginx_timings(logging, SIMPLE) self.assertEqual(metric_name, 'nginx.timings') self.assertEqual(timestamp, 1446038294.0) self.assertEqual(request_time, 0.242) self.assertEqual(attrs['metric_type'], 'gauge') self.assertEqual(attrs['url'], '/a/*/api/case/attachment/*/VH016899R9_000839_20150922T034026.MP4') self.assertEqual(attrs['status_code'], '401') self.assertEqual(attrs['http_method'], 'GET') self.assertEqual(attrs['domain'], 'uth-rhd')
def test_nginx_formplayer(self): self.assertIsNotNone(parse_nginx_timings(logging, FORMPLAYER))
def test_id_normalization(self): metric_name, timestamp, request_time, attrs = parse_nginx_timings(logging, ID_NORMALIZE) self.assertEqual(attrs['url'], '/a/*/modules-*/forms-*/form_data/*/uuid:*/')
def test_skipped_line(self): self.assertIsNone(parse_nginx_timings(logging, SKIPPED))
def test_borked_log_line(self): self.assertIsNone(parse_nginx_timings(logging, BORKED))