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());
        }
Esempio 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());
        }
        public async void SubmitsOutOfOrderSpans()
        {
            var scope1 = _tracer.StartActive("op1");
            var scope2 = _tracer.StartActive("op2");

            scope1.Close();
            scope2.Close();

            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(scope1.Span, trace[0].AsList()[0]);
            MsgPackHelpers.AssertSpanEqual(scope2.Span, trace[0].AsList()[1]);
        }
        public async void Utf8Everywhere()
        {
            var scope = _tracer.StartActive("Aᛗᚪᚾᚾᚪ", serviceName: "На берегу пустынных волн");

            scope.Span.ResourceName = "η γλώσσα μου έδωσαν ελληνική";
            scope.Span.SetTag("யாமறிந்த", "ნუთუ კვლა");
            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());
        }
        public async void CustomServiceName()
        {
            const string ServiceName = "MyService";

            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());
        }
Esempio n. 6
0
        public async void Utf8Everywhere()
        {
            var span = (OpenTracingSpan)_tracer.BuildSpan("Aᛗᚪᚾᚾᚪ")
                       .WithTag(DatadogTags.ResourceName, "η γλώσσα μου έδωσαν ελληνική")
                       .WithTag(DatadogTags.ServiceName, "На берегу пустынных волн")
                       .WithTag("யாமறிந்த", "ნუთუ კვლა")
                       .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());
        }
Esempio n. 7
0
        public async void CustomServiceName()
        {
            const string ServiceName = "MyService";

            var span = (OpenTracingSpan)_tracer.BuildSpan("Operation")
                       .WithTag(DatadogTags.ResourceName, "This is a resource")
                       .WithTag(DatadogTags.ServiceName, ServiceName)
                       .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());
        }