Beispiel #1
0
 public void DurationAndSpanStartedSetWhenSetAsComplete()
 {
     VerifySpanDurationComputedWhenSetAsComplete(Annotations.ClientSend(), Annotations.ClientRecv(), isRootSpan: false, isSpanStartedAndDurationSet: true);
     VerifySpanDurationComputedWhenSetAsComplete(Annotations.ServerRecv(), Annotations.ServerSend(), isRootSpan: true, isSpanStartedAndDurationSet: true);
     VerifySpanDurationComputedWhenSetAsComplete(Annotations.ServerRecv(), Annotations.ServerSend(), isRootSpan: false, isSpanStartedAndDurationSet: false);
     VerifySpanDurationComputedWhenSetAsComplete(Annotations.LocalOperationStart("Operation"), Annotations.LocalOperationStop(), isRootSpan: false, isSpanStartedAndDurationSet: true);
     VerifySpanDurationComputedWhenSetAsComplete(Annotations.ProducerStart(), Annotations.ProducerStop(), isRootSpan: false, isSpanStartedAndDurationSet: false);
     VerifySpanDurationComputedWhenSetAsComplete(Annotations.ConsumerStart(), Annotations.ConsumerStop(), isRootSpan: false, isSpanStartedAndDurationSet: false);
 }
Beispiel #2
0
        public void SpanDoesntHaveDurationIfIncomplete()
        {
            const int offset = 10;

            Assert.False(GetSpanDuration(offset, Annotations.ServerRecv()).HasValue);
            Assert.False(GetSpanDuration(offset, Annotations.ServerSend()).HasValue);
            Assert.False(GetSpanDuration(offset, Annotations.ClientRecv()).HasValue);
            Assert.False(GetSpanDuration(offset, Annotations.ClientSend()).HasValue);
            Assert.False(GetSpanDuration(offset, Annotations.LocalOperationStart("Operation")).HasValue);
            Assert.False(GetSpanDuration(offset, Annotations.LocalOperationStop()).HasValue);
            Assert.False(GetSpanDuration(offset, Annotations.ConsumerStart()).HasValue);
            Assert.False(GetSpanDuration(offset, Annotations.ConsumerStop()).HasValue);
            Assert.False(GetSpanDuration(offset, Annotations.ProducerStart()).HasValue);
            Assert.False(GetSpanDuration(offset, Annotations.ProducerStop()).HasValue);
        }
Beispiel #3
0
 public void FactoryReturnsCorrectTypes()
 {
     Assert.IsInstanceOf <TagAnnotation>(Annotations.Tag("", ""));
     Assert.IsInstanceOf <ClientRecv>(Annotations.ClientRecv());
     Assert.IsInstanceOf <ClientSend>(Annotations.ClientSend());
     Assert.IsInstanceOf <LocalAddr>(Annotations.LocalAddr(null));
     Assert.IsInstanceOf <Rpc>(Annotations.Rpc(""));
     Assert.IsInstanceOf <ServerRecv>(Annotations.ServerRecv());
     Assert.IsInstanceOf <ServerSend>(Annotations.ServerSend());
     Assert.IsInstanceOf <ServiceName>(Annotations.ServiceName(""));
     Assert.IsInstanceOf <Event>(Annotations.Event(""));
     Assert.IsInstanceOf <ClientAddr>(Annotations.ClientAddr(null));
     Assert.IsInstanceOf <ServerAddr>(Annotations.ServerAddr(null, null));
     Assert.IsInstanceOf <MessageAddr>(Annotations.MessageAddr(null, null));
     Assert.IsInstanceOf <ConsumerStart>(Annotations.ConsumerStart());
     Assert.IsInstanceOf <ConsumerStop>(Annotations.ConsumerStop());
     Assert.IsInstanceOf <ProducerStart>(Annotations.ProducerStart());
     Assert.IsInstanceOf <ProducerStop>(Annotations.ProducerStop());
 }
        private static IAnnotation GetClosingAnnotation(OtSpanKind spanKind)
        {
            switch (spanKind)
            {
            case OtSpanKind.Producer:
                return(Annotations.ProducerStop());

            case OtSpanKind.Consumer:
                return(Annotations.ConsumerStop());

            case OtSpanKind.Client:
                return(Annotations.ClientRecv());

            case OtSpanKind.Server:
                return(Annotations.ServerSend());

            case OtSpanKind.Local:
                return(Annotations.LocalOperationStop());

            default:
                throw new NotSupportedException("SpanKind: " + spanKind + " unknown.");
            }
        }
Beispiel #5
0
 public void Dispose()
 {
     Trace.Record(Annotations.ConsumerStop());
 }