Пример #1
0
        public void NewScope_FromExistingDDScope_WithoutFinishOnDispose()
        {
            var ddScope = _datadogTracer.StartActive("testSpan", finishOnClose: false);
            OpenTracingScope otScope = new OpenTracingScope(ddScope);

            var otSpan = (OpenTracingSpan)otScope.Span;
            var ddSpan = otSpan.Span;

            Assert.False(ddSpan.IsFinished);
            otScope.Dispose();
            Assert.False(ddSpan.IsFinished);

            otSpan.Finish();
            Assert.True(ddSpan.IsFinished);
        }
Пример #2
0
        public void NewScope_FromExistingDDScope_FinishOnDispose()
        {
            var ddScope = _datadogTracer.StartActive("testSpan");
            OpenTracingScope otScope = new OpenTracingScope(ddScope);

            var otSpan = (OpenTracingSpan)otScope.Span;
            var ddSpan = otSpan.Span;

            Assert.True(ddSpan == ddScope.Span);

            otSpan.SetTag("SetInOT", "123");
            Assert.Equal("123", ddSpan.GetTag("SetInOT"));

            Assert.False(ddSpan.IsFinished);
            otScope.Dispose();
            Assert.True(ddSpan.IsFinished);
        }