public void GetLatencySampledSpans_QueryBetweenMultipleBuckets()
        {
            Span span1 = CreateSampledSpan(REGISTERED_SPAN_NAME) as Span;

            testClock.AdvanceTime(Duration.Create(0, 20000)); // 20 microseconds
            span1.End();

            // Advance time to allow other spans to be sampled.
            testClock.AdvanceTime(Duration.Create(5, 0));
            Span span2 = CreateSampledSpan(REGISTERED_SPAN_NAME) as Span;

            testClock.AdvanceTime(Duration.Create(0, 200000)); // 200 microseconds
            span2.End();
            IList <ISpanData> samples =
                sampleStore.GetLatencySampledSpans(
                    SampledSpanStoreLatencyFilter.Create(
                        REGISTERED_SPAN_NAME,
                        15000,
                        250000,
                        0));

            Assert.Equal(2, samples.Count);
            Assert.Contains(span1.ToSpanData(), samples);
            Assert.Contains(span2.ToSpanData(), samples);
        }
예제 #2
0
        public void NoopSampledSpanStore_GetLatencySampledSpans()
        {
            ISampledSpanStore sampledSpanStore = ExportComponentBase.NewNoopExportComponent.SampledSpanStore;
            var latencySampledSpans            =
                sampledSpanStore.GetLatencySampledSpans(
                    SampledSpanStoreLatencyFilter.Create("TestLatencyFilter", 0, 0, 0));

            Assert.Empty(latencySampledSpans);
        }
        public void NoopSampledSpanStore_GetLatencySampledSpans()
        {
            ISampledSpanStore sampledSpanStore = ((NoopExportComponent)ExportComponent.NewNoopExportComponent).SampledSpanStore;
            var latencySampledSpans            =
                sampledSpanStore.GetLatencySampledSpans(
                    SampledSpanStoreLatencyFilter.Create("TestLatencyFilter", TimeSpan.Zero, TimeSpan.Zero, 0));

            Assert.Empty(latencySampledSpans);
        }
예제 #4
0
        public void IgnoreNegativeSpanLatency()
        {
            Span span = CreateSampledSpan(REGISTERED_SPAN_NAME) as Span;

            testClock.AdvanceTime(Duration.Create(0, -20000));
            span.End();
            var samples =
                sampleStore.GetLatencySampledSpans(
                    SampledSpanStoreLatencyFilter.Create(REGISTERED_SPAN_NAME, 0, Int64.MaxValue, 0));

            Assert.Empty(samples);
        }
예제 #5
0
        public void IgnoreNegativeSpanLatency()
        {
            var span = CreateSampledSpan(REGISTERED_SPAN_NAME) as Span;

            interval -= TimeSpan.FromTicks(200); // 20 microseconds
            span.End();
            var samples =
                sampleStore.GetLatencySampledSpans(
                    SampledSpanStoreLatencyFilter.Create(REGISTERED_SPAN_NAME, TimeSpan.Zero, TimeSpan.MaxValue, 0));

            Assert.Empty(samples);
        }
        public void IgnoreNegativeSpanLatency()
        {
            Span span = CreateSampledSpan(REGISTERED_SPAN_NAME) as Span;

            testClock.AdvanceTime(Duration.Create(0, -20000));
            span.End();
            IList <ISpanData> samples =
                sampleStore.GetLatencySampledSpans(
                    SampledSpanStoreLatencyFilter.Create(REGISTERED_SPAN_NAME, 0, long.MaxValue, 0));

            Assert.Equal(0, samples.Count);
        }
예제 #7
0
        public void GetLatencySampledSpans_ExclusiveUpperBound()
        {
            Span span = CreateSampledSpan(REGISTERED_SPAN_NAME) as Span;

            testClock.AdvanceTime(Duration.Create(0, 20000)); // 20 microseconds
            span.End();
            var samples =
                sampleStore.GetLatencySampledSpans(
                    SampledSpanStoreLatencyFilter.Create(
                        REGISTERED_SPAN_NAME,
                        15000,
                        20000,
                        0));

            Assert.Empty(samples);
        }
예제 #8
0
        public void GetLatencySampledSpans_ExclusiveUpperBound()
        {
            var span = CreateSampledSpan(REGISTERED_SPAN_NAME) as Span;

            interval += TimeSpan.FromTicks(200); // 20 microseconds
            span.End();
            var samples =
                sampleStore.GetLatencySampledSpans(
                    SampledSpanStoreLatencyFilter.Create(
                        REGISTERED_SPAN_NAME,
                        TimeSpan.FromTicks(150),
                        TimeSpan.FromTicks(200),
                        0));

            Assert.Empty(samples);
        }
예제 #9
0
        public void GetLatencySampledSpans_InclusiveLowerBound()
        {
            Span span = CreateSampledSpan(REGISTERED_SPAN_NAME) as Span;

            testClock.AdvanceTime(Duration.Create(0, 20000)); // 20 microseconds
            span.End();
            var samples =
                sampleStore.GetLatencySampledSpans(
                    SampledSpanStoreLatencyFilter.Create(
                        REGISTERED_SPAN_NAME,
                        15000,
                        25000,
                        0));

            Assert.Single(samples);
            Assert.Contains(span.ToSpanData(), samples);
        }
예제 #10
0
        public void GetLatencySampledSpans_InclusiveLowerBound()
        {
            var span = CreateSampledSpan(REGISTERED_SPAN_NAME) as Span;

            interval += TimeSpan.FromTicks(200); // 20 microseconds
            span.End();
            var samples =
                sampleStore.GetLatencySampledSpans(
                    SampledSpanStoreLatencyFilter.Create(
                        REGISTERED_SPAN_NAME,
                        TimeSpan.FromTicks(150),
                        TimeSpan.FromTicks(250),
                        0));

            Assert.Single(samples);
            Assert.Contains(span.ToSpanData(), samples);
        }
        public void GetLatencySampledSpans()
        {
            Span span = CreateSampledSpan(REGISTERED_SPAN_NAME) as Span;

            testClock.AdvanceTime(Duration.Create(0, 20000)); // 20 microseconds
            span.End();
            IList <ISpanData> samples =
                sampleStore.GetLatencySampledSpans(
                    SampledSpanStoreLatencyFilter.Create(
                        REGISTERED_SPAN_NAME,
                        15000,
                        25000,
                        0));

            Assert.Equal(1, samples.Count);
            Assert.True(samples.Contains(span.ToSpanData()));
        }
예제 #12
0
        public void GetLatencySampledSpans_MaxSpansToReturn()
        {
            Span span1 = CreateSampledSpan(REGISTERED_SPAN_NAME) as Span;

            testClock.AdvanceTime(Duration.Create(0, 20000)); // 20 microseconds
            span1.End();
            // Advance time to allow other spans to be sampled.
            testClock.AdvanceTime(Duration.Create(5, 0));
            Span span2 = CreateSampledSpan(REGISTERED_SPAN_NAME) as Span;

            testClock.AdvanceTime(Duration.Create(0, 200000)); // 200 microseconds
            span2.End();
            var samples =
                sampleStore.GetLatencySampledSpans(
                    SampledSpanStoreLatencyFilter.Create(
                        REGISTERED_SPAN_NAME,
                        15000,
                        250000,
                        1));

            Assert.Single(samples);
            Assert.Contains(span1.ToSpanData(), samples);
        }
예제 #13
0
        public void GetLatencySampledSpans_MaxSpansToReturn()
        {
            var span1 = CreateSampledSpan(REGISTERED_SPAN_NAME) as Span;

            interval += TimeSpan.FromTicks(200); // 20 microseconds
            span1.End();
            // Advance time to allow other spans to be sampled.
            interval += TimeSpan.FromSeconds(5);
            var span2 = CreateSampledSpan(REGISTERED_SPAN_NAME) as Span;

            interval += TimeSpan.FromTicks(2000); // 200 microseconds
            span2.End();
            var samples =
                sampleStore.GetLatencySampledSpans(
                    SampledSpanStoreLatencyFilter.Create(
                        REGISTERED_SPAN_NAME,
                        TimeSpan.FromTicks(150),
                        TimeSpan.FromTicks(2500),
                        1));

            Assert.Single(samples);
            Assert.Contains(span1.ToSpanData(), samples);
        }
예제 #14
0
        public void GetLatencySampledSpans_QueryBetweenMultipleBuckets()
        {
            var span1 = CreateSampledSpan(REGISTERED_SPAN_NAME) as Span;

            interval += TimeSpan.FromTicks(200); // 20 microseconds
            span1.End();
            // Advance time to allow other spans to be sampled.
            interval += TimeSpan.FromSeconds(5);
            var span2 = CreateSampledSpan(REGISTERED_SPAN_NAME) as Span;

            interval += TimeSpan.FromTicks(2000); // 200 microseconds
            span2.End();
            var samples =
                sampleStore.GetLatencySampledSpans(
                    SampledSpanStoreLatencyFilter.Create(
                        REGISTERED_SPAN_NAME,
                        TimeSpan.FromTicks(150),
                        TimeSpan.FromTicks(2500),
                        0));

            Assert.Equal(2, samples.Count());
            Assert.Contains(span1.ToSpanData(), samples);
            Assert.Contains(span2.ToSpanData(), samples);
        }