コード例 #1
0
        public void ReceiveClientSpan()
        {
            var domain     = new Uri("http://server.com");
            var spanTracer = new SpanTracer(spanCollectorStub, zipkinEndpointStub, zipkinNotToBeDisplayedDomainList, domain);
            var endpoint   = new Endpoint()
            {
                ServiceName = clientServiceName
            };
            var serverUri    = new Uri("https://" + clientServiceName + ":" + port + api);
            var returnCode   = fixture.Create <short>();
            var expectedSpan = new Span();

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

            zipkinEndpointStub.Expect(x => x.GetRemoteEndpoint(serverUri, domain.Host)).Return(endpoint);

            spanTracer.ReceiveClientSpan(expectedSpan, returnCode);

            spanCollectorStub.AssertWasCalled(x => x.Collect(Arg <Span> .Matches(y =>
                                                                                 ValidateReceiveClientSpan(y, clientServiceName)
                                                                                 ))
                                              );
        }
コード例 #2
0
ファイル: ZipkinClient.cs プロジェクト: barissonmez/test
        public void EndClientTrace(Span clientSpan, int statusCode)
        {
            if (!IsTraceOn)
            {
                return;
            }

            try
            {
                spanTracer.ReceiveClientSpan(clientSpan, statusCode);
            }
            catch (Exception ex)
            {
            }
        }
コード例 #3
0
        public void ReceiveClientSpan_EmptyAnnotationsList()
        {
            var domain     = new Uri("http://server.com");
            var spanTracer = new SpanTracer(spanCollectorStub, zipkinEndpointStub, zipkinNotToBeDisplayedDomainList, domain);
            var endpoint   = new Endpoint()
            {
                ServiceName = clientServiceName
            };
            var serverUri    = new Uri("https://" + clientServiceName + ":" + port + api);
            var returnCode   = fixture.Create <short>();
            var expectedSpan = new Span();

            zipkinEndpointStub.Expect(x => x.GetRemoteEndpoint(serverUri, domain.Host)).Return(endpoint);

            spanTracer.ReceiveClientSpan(expectedSpan, returnCode);
        }
コード例 #4
0
        public void ReceiveClientSpan()
        {
            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.ReceiveClientSpan(expectedSpan, expectedDuration);

            spanCollectorStub.AssertWasCalled(x => x.Collect(Arg <Span> .Matches(y =>
                                                                                 ValidateReceiveClientSpan(y, serviceName, expectedDuration)
                                                                                 ))
                                              );
        }
コード例 #5
0
        public void ReceiveClientSpan()
        {
            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.ReceiveClientSpan(expectedSpan, expectedDuration);

            spanCollectorStub.AssertWasCalled(x => x.Collect(Arg<Span>.Matches(y =>
                    ValidateReceiveClientSpan(y, serviceName, expectedDuration)
                    ))
                );
        }