def test_has_header(self):
     '''Test that the hook properly parses honeycomb trace headers'''
     req = DictRequest({
         # case shouldn't matter
         'X-HoNEyComb-TrACE': header_value,
     })
     pc = hc.http_trace_parser_hook(req)
     self.assertEqual(pc.trace_id, "bloop")
     self.assertEqual(pc.parent_id, "scoop")
Exemple #2
0
def http_trace_parser_hook(request):
    """
    Retrieves the propagation context out of the request. Uses the honeycomb header, with W3C header as fallback.
    """
    honeycomb_header_value = honeycomb.http_trace_parser_hook(request)
    w3c_header_value = w3c.http_trace_parser_hook(request)
    if honeycomb_header_value:
        return honeycomb_header_value
    else:
        return w3c_header_value
 def test_no_header(self):
     req = DictRequest({})
     pc = hc.http_trace_parser_hook(req)
     self.assertIsNone(pc)