コード例 #1
0
        public void SetSpanContext()
        {
            var automaticTracer = new AutomaticTracer();

            automaticTracer.Register(Mock.Of <ICommonTracer>());

            var distributedTracer   = (IDistributedTracer)automaticTracer;
            var expectedSpanContext = new SpanContext(1, 2);

            distributedTracer.SetSpanContext(expectedSpanContext);
            distributedTracer.GetSpanContext().Should().BeEquivalentTo(expectedSpanContext);
        }
コード例 #2
0
        public void SetSamplingPriority()
        {
            var manualTracer = new Mock <ICommonTracer>();

            var automaticTracer = new AutomaticTracer();

            automaticTracer.Register(manualTracer.Object);

            ((IDistributedTracer)automaticTracer).SetSamplingPriority(SamplingPriorityValues.UserKeep);

            manualTracer.Verify(t => t.SetSamplingPriority(SamplingPriorityValues.UserKeep), Times.Once);
        }
コード例 #3
0
        public void GetSpanContext()
        {
            var automaticTracer = new AutomaticTracer();

            automaticTracer.Register(Mock.Of <ICommonTracer>());

            automaticTracer.GetDistributedTrace().Should().BeNull();

            var expectedSpanContext = new SpanContext(1, 2, SamplingPriorityValues.UserKeep, "Service", "Origin");

            automaticTracer.SetDistributedTrace(expectedSpanContext);

            var actualSpanContext = ((IDistributedTracer)automaticTracer).GetSpanContext();

            actualSpanContext.Should().BeEquivalentTo(expectedSpanContext);
        }