コード例 #1
0
        public void SendServerSpan()
        {
            var domain     = new Uri("https://server.com");
            var spanTracer = new SpanTracer(spanCollectorStub, zipkinEndpointStub, zipkinNotToBeDisplayedDomainList, domain);

            var endpoint = new Endpoint()
            {
                ServiceName = domain.Host
            };
            var expectedSpan = new Span();

            expectedSpan.Annotations.Add(new Annotation()
            {
                Host = endpoint, Value = ZipkinConstants.ServerReceive, Timestamp = DateTimeOffset.UtcNow
            });

            zipkinEndpointStub.Expect(x => x.GetLocalEndpoint(domain.Host)).Return(new Endpoint()
            {
                ServiceName = domain.Host
            });

            spanTracer.SendServerSpan(expectedSpan);

            spanCollectorStub.AssertWasCalled(x => x.Collect(Arg <Span> .Matches(y =>
                                                                                 ValidateSendServerSpan(y, domain.Host)
                                                                                 ))
                                              );
        }
コード例 #2
0
        public void Shutdown_StopCollector()
        {
            var zipkinClient = (ZipkinClient)SetupZipkinClient();

            zipkinClient.ShutDown();

            spanCollectorStub.AssertWasCalled(x => x.Stop());
        }
コード例 #3
0
        public void SendServerSpan()
        {
            var serviceName = fixture.Create <string>();
            var spanTracer  = new SpanTracer(spanCollectorStub, serviceName, zipkinEndpointStub);

            var expectedSpan = new Span()
            {
                Annotations = new System.Collections.Generic.List <Annotation>()
            };
            var expectedDuration = fixture.Create <int>();

            zipkinEndpointStub.Expect(x => x.GetEndpoint(serviceName)).Return(new Endpoint()
            {
                Service_name = serviceName
            });

            spanTracer.SendServerSpan(expectedSpan, expectedDuration);

            spanCollectorStub.AssertWasCalled(x => x.Collect(Arg <Span> .Matches(y =>
                                                                                 ValidateSendServerSpan(y, serviceName, expectedDuration)
                                                                                 ))
                                              );
        }
コード例 #4
0
        public void CTOR_StartCollector()
        {
            var zipkinClient = SetupZipkinClient();

            spanCollectorStub.AssertWasCalled(x => x.Start());
        }