public void CheckForceFlushExport(int timeout)
        {
            var exportedItems = new List <Activity>();

            using var exporter  = new InMemoryExporter <Activity>(exportedItems);
            using var processor = new SimpleExportProcessor <Activity>(exporter);

            var activity1 = new Activity("start1");

            activity1.ActivityTraceFlags = ActivityTraceFlags.Recorded;

            var activity2 = new Activity("start2");

            activity2.ActivityTraceFlags = ActivityTraceFlags.Recorded;

            processor.OnEnd(activity1);
            processor.OnEnd(activity2);

            // checking before force flush
            Assert.Equal(2, exportedItems.Count);

            // forcing flush
            processor.ForceFlush(timeout);
            Assert.Equal(2, exportedItems.Count);
        }
示例#2
0
        public void CheckExportedOnEnd()
        {
            using var exporter  = new TestActivityExporter();
            using var processor = new SimpleExportProcessor <Activity>(exporter);

            processor.OnEnd(new Activity("start1"));
            Assert.Single(exporter.Exported);

            processor.OnEnd(new Activity("start2"));
            Assert.Equal(2, exporter.Exported.Count);
        }
示例#3
0
        public void CheckExportedOnEnd()
        {
            var exported = new List <object>();

            using var exporter  = new InMemoryExporter <Activity>(new InMemoryExporterOptions { ExportedItems = exported });
            using var processor = new SimpleExportProcessor <Activity>(exporter);

            processor.OnEnd(new Activity("start1"));
            Assert.Single(exported);

            processor.OnEnd(new Activity("start2"));
            Assert.Equal(2, exported.Count);
        }
示例#4
0
        public void CheckShutdownExport(int timeout)
        {
            using var exporter  = new TestActivityExporter();
            using var processor = new SimpleExportProcessor <Activity>(exporter);

            processor.OnEnd(new Activity("start"));

            // checking before shutdown
            Assert.Single(exporter.Exported);

            processor.Shutdown(timeout);
            Assert.Single(exporter.Exported);
        }
        public void CheckExportForRecordingButNotSampledActivity()
        {
            var exportedItems = new List <Activity>();

            using var exporter  = new InMemoryExporter <Activity>(exportedItems);
            using var processor = new SimpleExportProcessor <Activity>(exporter);

            var activity = new Activity("start");

            activity.ActivityTraceFlags = ActivityTraceFlags.None;

            processor.OnEnd(activity);
            Assert.Empty(exportedItems);
        }
示例#6
0
        public void CheckShutdownExport(int timeout)
        {
            var exported = new List <object>();

            using var exporter  = new InMemoryExporter <Activity>(new InMemoryExporterOptions { ExportedItems = exported });
            using var processor = new SimpleExportProcessor <Activity>(exporter);

            processor.OnEnd(new Activity("start"));

            // checking before shutdown
            Assert.Single(exported);

            processor.Shutdown(timeout);
            Assert.Single(exported);
        }
示例#7
0
        public void CheckForceFlushExport(int timeout)
        {
            using var exporter  = new TestActivityExporter();
            using var processor = new SimpleExportProcessor <Activity>(exporter);

            processor.OnEnd(new Activity("start1"));
            processor.OnEnd(new Activity("start2"));

            // checking before force flush
            Assert.Equal(2, exporter.Exported.Count);

            // forcing flush
            processor.ForceFlush(timeout);
            Assert.Equal(2, exporter.Exported.Count);
        }
示例#8
0
        public void CheckForceFlushExport(int timeout)
        {
            var exported = new List <object>();

            using var exporter  = new InMemoryExporter <Activity>(new InMemoryExporterOptions { ExportedItems = exported });
            using var processor = new SimpleExportProcessor <Activity>(exporter);

            processor.OnEnd(new Activity("start1"));
            processor.OnEnd(new Activity("start2"));

            // checking before force flush
            Assert.Equal(2, exported.Count);

            // forcing flush
            processor.ForceFlush(timeout);
            Assert.Equal(2, exported.Count);
        }
        public void CheckShutdownExport(int timeout)
        {
            var exportedItems = new List <Activity>();

            using var exporter  = new InMemoryExporter <Activity>(exportedItems);
            using var processor = new SimpleExportProcessor <Activity>(exporter);

            var activity = new Activity("start");

            activity.ActivityTraceFlags = ActivityTraceFlags.Recorded;

            processor.OnEnd(activity);

            // checking before shutdown
            Assert.Single(exportedItems);

            processor.Shutdown(timeout);
            Assert.Single(exportedItems);
        }
        public void CheckExportedOnEnd()
        {
            var exportedItems = new List <Activity>();

            using var exporter  = new InMemoryExporter <Activity>(exportedItems);
            using var processor = new SimpleExportProcessor <Activity>(exporter);

            var activity1 = new Activity("start1");

            activity1.ActivityTraceFlags = ActivityTraceFlags.Recorded;

            processor.OnEnd(activity1);
            Assert.Single(exportedItems);

            var activity2 = new Activity("start2");

            activity2.ActivityTraceFlags = ActivityTraceFlags.Recorded;

            processor.OnEnd(activity2);
            Assert.Equal(2, exportedItems.Count);
        }