public async void MinimalSpan()
        {
            var scope = _tracer.StartActive("Operation");

            scope.Dispose();

            // Check that the HTTP calls went as expected
            await _httpRecorder.WaitForCompletion(1);

            Assert.Single(_httpRecorder.Requests);
            Assert.Single(_httpRecorder.Responses);
            Assert.All(_httpRecorder.Responses, (x) => Assert.Equal(HttpStatusCode.OK, x.StatusCode));

            var trace = _httpRecorder.Traces.Single();

            MsgPackHelpers.AssertSpanEqual(scope.Span, trace.Single());
        }
Exemplo n.º 2
0
        public async void MinimalSpan()
        {
            var span = (OpenTracingSpan)_tracer.BuildSpan("Operation")
                       .Start();

            span.Finish();

            // Check that the HTTP calls went as expected
            await _httpRecorder.WaitForCompletion(1);

            Assert.Single(_httpRecorder.Requests);
            Assert.Single(_httpRecorder.Responses);
            Assert.All(_httpRecorder.Responses, (x) => Assert.Equal(HttpStatusCode.OK, x.StatusCode));

            var trace = _httpRecorder.Traces.Single();

            MsgPackHelpers.AssertSpanEqual(span.DDSpan, trace.Single());
        }
Exemplo n.º 3
0
        public async void MinimalSpan()
        {
            using (var agent = new MockZipkinCollector(collectorPort))
            {
                var scope = _tracer.StartActive("Operation");
                scope.Span.SetTag(Tags.SpanKind, SpanKinds.Client);
                scope.Dispose();

                await _httpRecorder.WaitForCompletion(1);

                Assert.Single(_httpRecorder.Requests);
                Assert.Single(_httpRecorder.Responses);
                Assert.All(_httpRecorder.Responses, (x) => Assert.Equal(HttpStatusCode.OK, x.StatusCode));

                var trace = _httpRecorder.ZipkinTraces.Single();
                ZipkinHelpers.AssertSpanEqual(scope.Span, trace);
            }
        }
Exemplo n.º 4
0
        public async void CustomServiceName()
        {
            const string ServiceName = "MyService";

            _httpRecorder = new RecordHttpHandler();
            _tracer       = Tracer.Create(new Uri("http://localhost:8126"), null, _httpRecorder);

            var scope = _tracer.StartActive("Operation", serviceName: ServiceName);

            scope.Span.ResourceName = "This is a resource";
            scope.Dispose();

            // Check that the HTTP calls went as expected
            await _httpRecorder.WaitForCompletion(1);

            Assert.Single(_httpRecorder.Requests);
            Assert.Single(_httpRecorder.Responses);
            Assert.All(_httpRecorder.Responses, (x) => Assert.Equal(HttpStatusCode.OK, x.StatusCode));

            var trace = _httpRecorder.Traces.Single();

            MsgPackHelpers.AssertSpanEqual(scope.Span, trace.Single());
        }