Exemplo n.º 1
0
 def extract(self, format, carrier):
     """
     return a span context
     :param format:
     :param carrier: dict: currently support:
         SofaHeader(dict)
     :return:
     """
     if format != opentracing.Format.TEXT_MAP:
         raise opentracing.UnsupportedFormatException()
     try:
         d = {
             k.split('.', 1)[1]: carrier[k]
             for k in carrier if k.startswith(self._prefix)
         }
         return self.spanContextCls(None, **d)
     except:
         raise opentracing.InvalidCarrierException()
Exemplo n.º 2
0
 def test_apply_tracing_invalid(self):
     tracer = PyramidTracer(
         DummyTracer(opentracing.InvalidCarrierException()))
     tracer._apply_tracing(DummyRequest(), [])