internal MetricsSinkAdapter(string name, string description, MetricsSink sink, string context, MetricsFilter sourceFilter, MetricsFilter recordFilter, MetricsFilter metricFilter, int period, int queueCapacity, int retryDelay, float retryBackoff, int retryCount) { this.name = Preconditions.CheckNotNull(name, "name"); this.description = description; this.sink = Preconditions.CheckNotNull(sink, "sink object"); this.context = context; this.sourceFilter = sourceFilter; this.recordFilter = recordFilter; this.metricFilter = metricFilter; this.period = Contracts.CheckArg(period, period > 0, "period"); firstRetryDelay = Contracts.CheckArg(retryDelay, retryDelay > 0, "retry delay"); this.retryBackoff = Contracts.CheckArg(retryBackoff, retryBackoff > 1, "retry backoff" ); oobPutTimeout = (long)(firstRetryDelay * Math.Pow(retryBackoff, retryCount) * 1000 ); this.retryCount = retryCount; this.queue = new SinkQueue <MetricsBuffer>(Contracts.CheckArg(queueCapacity, queueCapacity > 0, "queue capacity")); latency = registry.NewRate("Sink_" + name, "Sink end to end latency", false); dropped = registry.NewCounter("Sink_" + name + "Dropped", "Dropped updates per sink" , 0); qsize = registry.NewGauge("Sink_" + name + "Qsize", "Queue size", 0); sinkThread = new _Thread_86(this); sinkThread.SetName(name); sinkThread.SetDaemon(true); }
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); }
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); }