Пример #1
0
        public async Task SerializeSpans()
        {
            var handler = new CustomHandler();

            var factory = new HttpClientRequestFactory(handler);
            var request = factory.Create(new Uri("http://localhost/"));

            await request.PostAsync(ArraySegment <byte> .Empty);

            var message = handler.Message;

            Assert.IsAssignableFrom <ByteArrayContent>(message.Content);
        }
        public async Task SerializeSpans()
        {
            var handler = new CustomHandler();

            var factory = new HttpClientRequestFactory(handler);
            var request = factory.Create(new Uri("http://localhost/"));

            await request.PostAsync(new Span[0][], new FormatterResolverWrapper(SpanFormatterResolver.Instance));

            var message = handler.Message;

            Assert.IsAssignableFrom <TracesMessagePackContent>(message.Content);
        }
Пример #3
0
        public async Task SetHeaders()
        {
            var handler = new CustomHandler();

            var factory = new HttpClientRequestFactory(handler);
            var request = factory.Create(new Uri("http://localhost/"));

            request.AddHeader("Hello", "World");

            await request.PostAsync(ArraySegment <byte> .Empty);

            var message = handler.Message;

            Assert.NotNull(message);
            Assert.Equal(".NET", message.Headers.GetValues(AgentHttpHeaderNames.Language).First());
            Assert.Equal(TracerConstants.AssemblyVersion, message.Headers.GetValues(AgentHttpHeaderNames.TracerVersion).First());
            Assert.Equal("false", message.Headers.GetValues(CommonHttpHeaderNames.TracingEnabled).First());
            Assert.Equal("World", message.Headers.GetValues("Hello").First());
        }
        public async Task SetHeaders()
        {
            var handler = new CustomHandler();

            var factory = new HttpClientRequestFactory(handler);
            var request = factory.Create(new Uri("http://localhost/"));

            request.AddHeader("Hello", "World");

            await request.PostAsync(new Span[0][], new FormatterResolverWrapper(SpanFormatterResolver.Instance));

            var message = handler.Message;

            Assert.NotNull(message);
            Assert.Equal(".NET", message.Headers.GetValues(AgentHttpHeaderNames.Language).First());
            Assert.Equal(TracerConstants.AssemblyVersion, message.Headers.GetValues(AgentHttpHeaderNames.TracerVersion).First());
            Assert.Equal("false", message.Headers.GetValues(HttpHeaderNames.TracingEnabled).First());
            Assert.Equal("World", message.Headers.GetValues("Hello").First());
        }