Ejemplo n.º 1
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
Ejemplo n.º 2
0
 def test_has_header(self):
     '''Test that the hook properly parses W3C trace headers'''
     req = DictRequest(_TEST_HEADERS)
     pc = w3c.http_trace_parser_hook(req)
     self.assertEquals(pc.trace_id, _TEST_TRACE_ID)
     self.assertEquals(pc.parent_id, _TEST_PARENT_ID)
     self.assertEquals(pc.trace_fields, {
         "tracestate": _TEST_TRACESTATE,
         "traceflags": _TEST_TRACE_FLAGS
     })
Ejemplo n.º 3
0
 def test_no_header(self):
     req = DictRequest({})
     pc = w3c.http_trace_parser_hook(req)
     self.assertIsNone(pc)