Ejemplo n.º 1
0
    def test_push_tracer(self):
        dummy_tracer = object()
        dummy_tracer2 = object()

        push_tracer(dummy_tracer)
        self.assertEqual(get_tracers(), [dummy_tracer])

        push_tracer(dummy_tracer2)

        self.assertEqual(get_tracers(), [dummy_tracer, dummy_tracer2])
Ejemplo n.º 2
0
    def test_push_tracer(self):
        dummy_tracer = object()
        dummy_tracer2 = object()

        push_tracer(dummy_tracer)
        self.assertEqual(get_tracers(), [dummy_tracer])

        push_tracer(dummy_tracer2)

        self.assertEqual(get_tracers(), [dummy_tracer, dummy_tracer2])
Ejemplo n.º 3
0
    def __init__(self,
                 name,
                 trace_id=None,
                 span_id=None,
                 parent_span_id=None,
                 tracers=None):
        """
        @param name: C{str} describing the current span.
        @param trace_id: C{int} or C{None}
        @param span_id: C{int} or C{None}
        @param parent_span_id: C{int} or C{None}

        @param tracers: C{list} of L{ITracer} providers, primarily useful
            for unit testing.
        """
        self.name = name
        # If no trace_id and span_id are given we want to generate new
        # 64-bit integer ids.
        self.trace_id = trace_id or _uniq_id()
        self.span_id = span_id or _uniq_id()

        # If no parent_span_id is given then we assume there is no parent span
        # and leave it as None.
        self.parent_span_id = parent_span_id

        # If no tracers are given we get the global list of tracers.
        self._tracers = tracers or get_tracers()

        # By default no endpoint will be associated with annotations recorded
        # to this trace.
        self._endpoint = None
Ejemplo n.º 4
0
    def __init__(self, name, trace_id=None, span_id=None,
                 parent_span_id=None, tracers=None):
        """
        @param name: C{str} describing the current span.
        @param trace_id: C{int} or C{None}
        @param span_id: C{int} or C{None}
        @param parent_span_id: C{int} or C{None}

        @param tracers: C{list} of L{ITracer} providers, primarily useful
            for unit testing.
        """
        self.name = name
        # If no trace_id and span_id are given we want to generate new
        # 64-bit integer ids.
        self.trace_id = trace_id or _uniq_id()
        self.span_id = span_id or _uniq_id()

        # If no parent_span_id is given then we assume there is no parent span
        # and leave it as None.
        self.parent_span_id = parent_span_id

        # If no tracers are given we get the global list of tracers.
        self._tracers = tracers or get_tracers()

        # By default no endpoint will be associated with annotations recorded
        # to this trace.
        self._endpoint = None
Ejemplo n.º 5
0
    def test_set_tracers(self):
        dummy_tracer = object()

        set_tracers([dummy_tracer])
        self.assertEqual(get_tracers(), [dummy_tracer])
Ejemplo n.º 6
0
    def test_set_tracers(self):
        dummy_tracer = object()

        set_tracers([dummy_tracer])
        self.assertEqual(get_tracers(), [dummy_tracer])