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) )) ); }
public void SendServerSpan_InvalidAnnotation() { var spanTracer = new SpanTracer(spanCollectorStub, zipkinEndpointStub, zipkinNotToBeDisplayedDomainList, new Uri("http://server.com")); var expectedSpan = new Span(); spanTracer.SendServerSpan(expectedSpan); }
public void EndServerTrace(Span serverSpan) { if (!IsTraceOn) { return; } try { spanTracer.SendServerSpan(serverSpan); } catch (Exception ex) { } }
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) )) ); }
public void SendServerSpan_NullSpan() { var spanTracer = new SpanTracer(spanCollectorStub, zipkinEndpointStub, zipkinNotToBeDisplayedDomainList, new Uri("http://server.com")); spanTracer.SendServerSpan(null); }
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) )) ); }