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)
                                                                                 ))
                                              );
        }
Exemplo n.º 2
0
        public void EndClientTrace(Span clientSpan, int statusCode)
        {
            if (!IsTraceOn)
            {
                return;
            }

            try
            {
                spanTracer.ReceiveClientSpan(clientSpan, statusCode);
            }
            catch (Exception ex)
            {
            }
        }
        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);
        }
Exemplo n.º 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)
                                                                                 ))
                                              );
        }
        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)
                    ))
                );
        }