예제 #1
0
    def test_ot_dd_ot_dd_nested_trace(self, ot_tracer, dd_tracer, writer):
        """Ensure intertwined usage of the opentracer and ddtracer."""
        with ot_tracer.start_span("my_ot_span") as ot_span:
            with dd_tracer.trace("my_dd_span") as dd_span:
                with ot_tracer.start_span("my_ot_span") as ot_span2:
                    with dd_tracer.trace("my_dd_span") as dd_span2:
                        pass

        spans = writer.pop()
        assert len(spans) == 4

        # confirm the ordering
        assert spans[0] is ot_span._dd_span
        assert spans[1] is dd_span
        assert spans[2] is ot_span2._dd_span
        assert spans[3] is dd_span2

        # check the parenting
        assert spans[0].parent_id is None
        assert spans[1].parent_id is spans[0].span_id
        assert spans[2].parent_id is spans[1].span_id
        assert spans[3].parent_id is spans[2].span_id
예제 #2
0
 def fn():
     with ot_tracer.start_span("ot_span_inner"):
         pass