예제 #1
0
        public void ExpandDefinitions()
        {
            var supplier = new UpdateableSupplier();
            using (var collector = new Collector(supplier, new[] { Sink }))
            {
                supplier.AddCounter(new CounterDefinition()
                {
                    CategoryName = "Processor",
                    CounterName = "/.*/",
                    InstanceName = "/.*/",
                    CollectInterval = 50
                });

                collector.Start();
                Thread.Sleep(1000);
                collector.Stop();
                Assert.True(Counters.Count > 10,string.Format("expected more than {0} but was {1}",10,Counters.Count));
            }
        }
예제 #2
0
 public void IfTheSupplierChangesTheCollectorReconfigure()
 {
     var supplier = new UpdateableSupplier();
     using (var collector = new Collector(supplier, new[] { Sink }))
     {
         collector.Start();
         Thread.Sleep(400);
         Assert.Equal(0,SentValues.Count);
         supplier.AddCounter(new CounterDefinition()
         {
             CategoryName = "Processor",
             CounterName = "% Processor Time",
             InstanceName = "_Total",
             CollectInterval = 50
         });
         Thread.Sleep(400);
         collector.Stop();
         Assert.True(SentValues.Count > 5);
     }
 }