public void FinishSpan()
        {
            var tracer = TracerProvider.GetTracer(TracerName);
            var shim   = new SpanShim(tracer.StartSpan(SpanName));

            shim.Finish();

            Assert.NotEqual(default, shim.Span.Activity.Duration);
        public void FinishSpan()
        {
            var spanMock = Defaults.GetOpenTelemetryMockSpan();
            var shim     = new SpanShim(spanMock.Object);

            shim.Finish();

            spanMock.Verify(o => o.End(), Times.Once());
        }
Пример #3
0
        public void FinishSpanUsingSpecificTimestamp()
        {
            var spanMock = Defaults.GetOpenTelemetryMockSpan();
            var shim     = new SpanShim(spanMock.Object);

            var endTime = DateTimeOffset.UtcNow;

            shim.Finish(endTime);

            spanMock.Verify(o => o.End(endTime), Times.Once());
        }
        public void Active_IsNotNull()
        {
            var tracer          = TracerProvider.Default.GetTracer(TracerName);
            var shim            = new ScopeManagerShim(tracer);
            var openTracingSpan = new SpanShim(tracer.StartSpan(SpanName));

            var scope = shim.Activate(openTracingSpan, true);

            Assert.NotNull(scope);

            var activeScope = shim.Active;

            Assert.Equal(scope.Span.Context.SpanId, activeScope.Span.Context.SpanId);
            openTracingSpan.Finish();
        }
        public void Activate()
        {
            var tracer   = TracerProvider.Default.GetTracer(TracerName);
            var shim     = new ScopeManagerShim(tracer);
            var spanShim = new SpanShim(tracer.StartSpan(SpanName));

            using (shim.Activate(spanShim, true))
            {
#if DEBUG
                Assert.Equal(1, shim.SpanScopeTableCount);
#endif
            }

#if DEBUG
            Assert.Equal(0, shim.SpanScopeTableCount);
#endif

            spanShim.Finish();
            Assert.NotEqual(default, spanShim.Span.Activity.Duration);
        public void FinishSpanUsingSpecificTimestamp()
        {
            var shim = new SpanShim(Defaults.GetOpenTelemetryMockSpan().Object);

            Assert.Throws <NotImplementedException>(() => shim.Finish(DateTimeOffset.UtcNow));
        }