Beispiel #1
0
 /// <summary>
 ///     Given a new <seealso cref="Gauge{T}" />, registers it under the given class and
 ///     name.
 /// </summary>
 /// <param name="klass">the class which owns the metric</param>
 /// <param name="name">the name of the metric</param>
 /// <param name="metric">the metric</param>
 /// <typeparam name="T">the type of the value returned by the metric</typeparam>
 /// <returns>{@code metric}</returns>
 public static Gauge<T> NewGauge<T>(
     Type klass,
     string name,
     Gauge<T> metric)
 {
     return DEFAULT_REGISTRY.NewGauge(klass, name, metric);
 }
Beispiel #2
0
        private MutableGaugeInt[] BuildBuckets(Configuration conf)
        {
            AList <int> buckets = ParseInts(conf.Get(YarnConfiguration.RmMetricsRuntimeBuckets
                                                     , YarnConfiguration.DefaultRmMetricsRuntimeBuckets));

            MutableGaugeInt[] result = new MutableGaugeInt[buckets.Count + 1];
            result[0] = registry.NewGauge("running_0", string.Empty, 0);
            long[] cuts = new long[buckets.Count];
            for (int i = 0; i < buckets.Count; ++i)
            {
                result[i + 1] = registry.NewGauge("running_" + buckets[i], string.Empty, 0);
                cuts[i]       = buckets[i] * 1000L * 60;
            }
            // covert from min to ms
            this.runBuckets = new TimeBucketMetrics <ApplicationId>(cuts);
            return(result);
        }
Beispiel #3
0
 internal ContainerMetrics(MetricsSystem ms, ContainerId containerId, long flushPeriodMs
                           , long delayMs)
 {
     // Use a multiplier of 1000 to avoid losing too much precision when
     // converting to integers
     // This tracks overall CPU percentage of the machine in terms of percentage
     // of 1 core similar to top
     // Thus if you use 2 cores completely out of 4 available cores this value
     // will be 200
     // Metrics publishing status
     // true if period elapsed
     // true if container finished
     // unregister
     // lazily initialized
     // Create a timer to unregister container metrics,
     // whose associated thread run as a daemon.
     this.recordInfo        = Interns.Info(SourceName(containerId), RecordInfo.Description());
     this.registry          = new MetricsRegistry(recordInfo);
     this.metricsSystem     = ms;
     this.containerId       = containerId;
     this.flushPeriodMs     = flushPeriodMs;
     this.unregisterDelayMs = delayMs < 0 ? 0 : delayMs;
     ScheduleTimerTaskIfRequired();
     this.pMemMBsStat = registry.NewStat(PmemUsageMetricName, "Physical memory stats",
                                         "Usage", "MBs", true);
     this.cpuCoreUsagePercent = registry.NewStat(PhyCpuUsageMetricName, "Physical Cpu core percent usage stats"
                                                 , "Usage", "Percents", true);
     this.milliVcoresUsed = registry.NewStat(VcoreUsageMetricName, "1000 times Vcore usage"
                                             , "Usage", "MilliVcores", true);
     this.pMemLimitMbs = registry.NewGauge(PmemLimitMetricName, "Physical memory limit in MBs"
                                           , 0);
     this.vMemLimitMbs = registry.NewGauge(VmemLimitMetricName, "Virtual memory limit in MBs"
                                           , 0);
     this.cpuVcoreLimit = registry.NewGauge(VcoreLimitMetricName, "CPU limit in number of vcores"
                                            , 0);
 }