Esempio n. 1
0
        public async Task SendTracesAsync_500_ErrorIsCaught()
        {
            var response = new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.InternalServerError
            };
            var handler = new SetResponseHandler(response);
            var api     = new Api(new Uri("http://localhost:1234"), handler);

            var sw = new Stopwatch();

            sw.Start();
            var span   = _tracer.StartSpan("Operation");
            var traces = new List <List <Span> > {
                new List <Span> {
                    span
                }
            };
            await api.SendTracesAsync(traces);

            sw.Stop();

            Assert.Equal(5, handler.RequestsCount);
            Assert.InRange(sw.ElapsedMilliseconds, 1500, 10000); // should be ~ 1600ms

            // TODO:bertrand check that it's properly logged
        }
Esempio n. 2
0
        public async Task SendTraceAsync_200OK_AllGood()
        {
            var response = new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK
            };
            var handler = new SetResponseHandler(response);
            var api     = new Api(new Uri("http://localhost:1234"), handler, statsd: null);

            var span   = _tracer.StartSpan("Operation");
            var traces = new[] { new[] { span } };
            await api.SendTracesAsync(traces);

            Assert.Equal(1, handler.RequestsCount);
        }
Esempio n. 3
0
        public async Task SendTraceAsync_200OK_AllGood()
        {
            var response = new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK
            };
            var handler = new SetResponseHandler(response);
            var api     = new Api(new Uri("http://localhost:1234"), handler);

            await api.SendTracesAsync(new List <List <Span> > {
                new List <Span> {
                    _tracer.StartSpan("Operation")
                }
            });

            Assert.Equal(1, handler.RequestsCount);
        }
Esempio n. 4
0
        public async Task SendTracesAsync_500_ErrorIsCaught()
        {
            var response = new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.InternalServerError
            };
            var handler = new SetResponseHandler(response);
            var api     = new Api(new Uri("http://localhost:1234"), handler);

            await api.SendTracesAsync(new List <List <Span> > {
                new List <Span> {
                    _tracer.StartSpan("Operation")
                }
            });

            Assert.Equal(1, handler.RequestsCount);

            // TODO:bertrand check that it's properly logged
        }