コード例 #1
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #11
0
        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);
        }