public async void ProfilerSessionUsesTheSameDefault()
        {
            var spanProcessor = new Mock <SpanProcessor>(new NoopSpanExporter());
            var tracer        = new Tracer(spanProcessor.Object, new TracerConfiguration(), Resource.Empty);

            using (var collector = new StackExchangeRedisCallsCollector(tracer))
            {
                var profilerFactory = collector.GetProfilerSessionsFactory();
                var first           = profilerFactory();
                var second          = profilerFactory();

                ProfilingSession third = null;
                await Task.Delay(1).ContinueWith((t) => { third = profilerFactory(); });

                Assert.Equal(first, second);
                Assert.Equal(second, third);
            }
        }
        public async void ProfilerSessionUsesTheSameDefault()
        {
            var startEndHandler = new Mock <IStartEndHandler>();
            var tracer          = new Tracer(new RandomGenerator(), startEndHandler.Object, new TraceConfig(), null);

            using (var collector = new StackExchangeRedisCallsCollector(tracer, null, null))
            {
                var profilerFactory = collector.GetProfilerSessionsFactory();
                var first           = profilerFactory();
                var second          = profilerFactory();

                ProfilingSession third = null;
                await Task.Delay(1).ContinueWith((t) => { third = profilerFactory(); });

                Assert.Equal(first, second);
                Assert.Equal(second, third);
            }
        }
예제 #3
0
        public async void ProfilerSessionUsesTheSameDefault()
        {
            var spanProcessor = new Mock <SpanProcessor>();
            var tracer        = TracerFactory.Create(b => b
                                                     .AddProcessorPipeline(p => p.AddProcessor(_ => spanProcessor.Object)))
                                .GetTracer(null);

            using var collector = new StackExchangeRedisCallsCollector(tracer);
            var profilerFactory = collector.GetProfilerSessionsFactory();
            var first           = profilerFactory();
            var second          = profilerFactory();

            ProfilingSession third = null;
            await Task.Delay(1).ContinueWith((t) => { third = profilerFactory(); });

            Assert.Equal(first, second);
            Assert.Equal(second, third);
        }