public TaskErrorCollector(Configuration conf) { errorCountsQueue = new LinkedList<Map<TaskError, Integer>>(); startTimeQueue = new LinkedList<Long>(); errorCountsMetrics = new HashMap<TaskError, MetricsTimeVaryingLong>(); MetricsContext context = MetricsUtil.getContext("mapred"); metricsRecord = MetricsUtil.createRecord(context, "taskerror"); registry = new MetricsRegistry(); windowLength = conf.getInt(WINDOW_LENGTH_KEY, WINDOW_LENGTH); numWindows = conf.getInt(NUM_WINDOWS_KEY, NUM_WINDOWS); context.registerUpdater(this); String configFilePath = conf.get(CONFIG_FILE_KEY); if (configFilePath == null) { // Search the class path if it is not configured URL u = TaskErrorCollector.class.getClassLoader().getResource(ERROR_XML); if (u != null) { configFilePath = u.getPath(); } } if (configFilePath == null) { LOG.warn("No " + CONFIG_FILE_KEY + " given in conf. " + TaskErrorCollector.class.getSimpleName() + " will see every error as UNKNOWN_ERROR."); knownErrors = Collections.emptyMap(); } else { knownErrors = parseConfigFile(configFilePath); } createMetrics(); sinceStartErrorCounts = createErrorCountsMap(); }
private static MetricsRegistry copyMinusHBaseMetrics(final MetricsRegistry mr) { MetricsRegistry copy = new MetricsRegistry(); for (MetricsBase metric : mr.getMetricsList()) { if (metric instanceof MetricsRate || metric instanceof MetricsString || metric instanceof MetricsHistogram || metric instanceof ExactCounterMetric) { continue; } copy.add(metric.getName(), metric); } return copy; }
public SepMetrics(String recordName) { this.recordName = recordName; metricsRegistry = new MetricsRegistry(); sepProcessingRate = new MetricsTimeVaryingRate("sepProcessed", metricsRegistry); lastTimestampInputProcessed = new MetricsLongValue("lastSepTimestamp", metricsRegistry); context = MetricsUtil.getContext("repository"); metricsRecord = MetricsUtil.createRecord(context, recordName); context.registerUpdater(this); mbean = new SepMetricsMXBean(this.metricsRegistry); }
public SepMetrics(String recordName) { this.recordName = recordName; metricsRegistry = new MetricsRegistry(); sepProcessingRate = new MetricsTimeVaryingRate("sepProcessed", metricsRegistry); lastTimestampInputProcessed = new MetricsLongValue("lastSepTimestamp", metricsRegistry); context = MetricsUtil.getContext("repository"); metricsRecord = MetricsUtil.createRecord(context, recordName); context.registerUpdater(this); mbean = new SepMetricsMXBean(this.metricsRegistry); }