예제 #1
0
        // List containing nc1 and nc2.
        /// <summary>
        /// Initializes, for testing, two NoEmitMetricsContext's, and adds one value
        /// to the first of them.
        /// </summary>
        /// <exception cref="System.IO.IOException"/>
        protected override void SetUp()
        {
            nc1 = new NoEmitMetricsContext();
            nc1.Init("test1", ContextFactory.GetFactory());
            nc2 = new NoEmitMetricsContext();
            nc2.Init("test2", ContextFactory.GetFactory());
            contexts = new AList <MetricsContext>();
            contexts.AddItem(nc1);
            contexts.AddItem(nc2);
            MetricsRecord r = nc1.CreateRecord("testRecord");

            r.SetTag("testTag1", "testTagValue1");
            r.SetTag("testTag2", "testTagValue2");
            r.SetMetric("testMetric1", 1);
            r.SetMetric("testMetric2", 33);
            r.Update();
            IDictionary <string, ICollection <OutputRecord> > m = nc1.GetAllRecords();

            Assert.Equal(1, m.Count);
            Assert.Equal(1, m.Values.Count);
            ICollection <OutputRecord> outputRecords = m.Values.GetEnumerator().Next();

            Assert.Equal(1, outputRecords.Count);
            outputRecord = outputRecords.GetEnumerator().Next();
        }
예제 #2
0
 /// <summary>
 /// This will be called periodically (with the period being configuration
 /// dependent).
 /// </summary>
 public virtual void DoUpdates(MetricsContext context)
 {
     DoMemoryUpdates();
     DoGarbageCollectionUpdates();
     DoThreadUpdates();
     DoEventCountUpdates();
     metrics.Update();
 }
예제 #3
0
 /// <summary>
 /// Since this object is a registered updater, this method will be called
 /// periodically, e.g.
 /// </summary>
 /// <remarks>
 /// Since this object is a registered updater, this method will be called
 /// periodically, e.g. every 5 seconds.
 /// </remarks>
 public virtual void DoUpdates(MetricsContext unused)
 {
     lock (this)
     {
         metricsRecord.IncrMetric("maps_launched", numMapTasksLaunched);
         metricsRecord.IncrMetric("maps_completed", numMapTasksCompleted);
         metricsRecord.IncrMetric("reduces_launched", numReduceTasksLaunched);
         metricsRecord.IncrMetric("reduces_completed", numReduceTasksCompleted);
         metricsRecord.IncrMetric("waiting_maps", numWaitingMaps);
         metricsRecord.IncrMetric("waiting_reduces", numWaitingReduces);
         numMapTasksLaunched     = 0;
         numMapTasksCompleted    = 0;
         numReduceTasksLaunched  = 0;
         numReduceTasksCompleted = 0;
         numWaitingMaps          = 0;
         numWaitingReduces       = 0;
     }
     metricsRecord.Update();
 }
예제 #4
0
 public virtual void DoUpdates(MetricsContext unused)
 {
     lock (this)
     {
         shuffleMetrics.IncrMetric("shuffle_input_bytes", numBytes);
         shuffleMetrics.IncrMetric("shuffle_failed_fetches", numFailedFetches);
         shuffleMetrics.IncrMetric("shuffle_success_fetches", numSuccessFetches);
         if (numCopiers != 0)
         {
             shuffleMetrics.SetMetric("shuffle_fetchers_busy_percent", 100 * ((float)numThreadsBusy
                                                                              / numCopiers));
         }
         else
         {
             shuffleMetrics.SetMetric("shuffle_fetchers_busy_percent", 0);
         }
         numBytes          = 0;
         numSuccessFetches = 0;
         numFailedFetches  = 0;
     }
     shuffleMetrics.Update();
 }