コード例 #1
0
        public void NoopSpanBuilder_BadArguments()
        {
            Assert.Throws <ArgumentNullException>(() => new NoopSpanBuilder(null));

            var spanBuilder = new NoopSpanBuilder("foo");

            Assert.Throws <ArgumentNullException>(() => spanBuilder.SetParent((ISpan)null));
            Assert.Throws <ArgumentNullException>(() => spanBuilder.SetParent((SpanContext)null));
            Assert.Throws <ArgumentNullException>(() => spanBuilder.SetParent((Activity)null));

            // no Activity.Current
            Assert.Throws <ArgumentException>(() => spanBuilder.SetCreateChild(false));

            // Activity.Current wrong format
            var a = new Activity("foo")
                    .SetIdFormat(ActivityIdFormat.Hierarchical)
                    .Start();

            Assert.Throws <ArgumentException>(() => spanBuilder.SetCreateChild(false));
            a.Stop();

            Assert.Throws <ArgumentNullException>(() => spanBuilder.SetSampler(null));
            Assert.Throws <ArgumentNullException>(() => spanBuilder.AddLink((Link)null));
            Assert.Throws <ArgumentNullException>(() => spanBuilder.AddLink((SpanContext)null));
            Assert.Throws <ArgumentNullException>(() => spanBuilder.AddLink(null, null));
            Assert.Throws <ArgumentException>(() => spanBuilder.AddLink(SpanContext.Blank));
            Assert.Throws <ArgumentException>(() => spanBuilder.AddLink(SpanContext.Blank, null));
            Assert.Throws <ArgumentException>(() => spanBuilder.AddLink(SpanContext.Blank, null));
        }
コード例 #2
0
        public void NoopSpanBuilder_BadArguments()
        {
            Assert.Throws <ArgumentNullException>(() => new NoopSpanBuilder(null));

            var spanBuilder = new NoopSpanBuilder("foo");

            Assert.Throws <ArgumentNullException>(() => spanBuilder.SetParent((ISpan)null));
            Assert.Throws <ArgumentNullException>(() => spanBuilder.SetParent((SpanContext)null));
            Assert.Throws <ArgumentNullException>(() => spanBuilder.SetSampler(null));
            Assert.Throws <ArgumentNullException>(() => spanBuilder.AddLink((ILink)null));
            Assert.Throws <ArgumentNullException>(() => spanBuilder.AddLink((SpanContext)null));
            Assert.Throws <ArgumentNullException>(() => spanBuilder.AddLink(null, null));
            Assert.Throws <ArgumentNullException>(() => spanBuilder.AddLink(SpanContext.Blank, null));
        }
コード例 #3
0
 public override ISpanBuilder SpanBuilderWithRemoteParent(string spanName, ISpanContext remoteParentSpanContext)
 {
     return(NoopSpanBuilder.CreateWithRemoteParent(spanName, remoteParentSpanContext));
 }
コード例 #4
0
 public override ISpanBuilder SpanBuilderWithExplicitParent(string spanName, ISpan parent)
 {
     return(NoopSpanBuilder.CreateWithParent(spanName, parent));
 }
コード例 #5
0
 /// <inheritdoc/>
 public override ISpanBuilder SpanBuilderWithRemoteParent(string spanName, SpanKind spanKind = SpanKind.Internal, ISpanContext remoteParentSpanContext = null)
 {
     return(NoopSpanBuilder.CreateWithRemoteParent(spanName, spanKind, remoteParentSpanContext));
 }
コード例 #6
0
 /// <inheritdoc/>
 public override ISpanBuilder SpanBuilderWithExplicitParent(string spanName, SpanKind spanKind = SpanKind.Internal, ISpan parent = null)
 {
     return(NoopSpanBuilder.CreateWithParent(spanName, spanKind, parent));
 }