public MetricsTimeVaryingLong[] getMetricsTimeVaryingLongArray() { Collection<MetricsBase> mbs = registry.getMetricsList(); ArrayList<MetricsTimeVaryingLong> mlv = new ArrayList<MetricsTimeVaryingLong>(); for (MetricsBase mb : mbs) { if ( mb instanceof MetricsTimeVaryingLong) { mlv.add((MetricsTimeVaryingLong) mb); } } return mlv.toArray(new MetricsTimeVaryingLong[mlv.size()]); }
private MetricsTimeVaryingRate get(String key) { return (MetricsTimeVaryingRate) registry.get(key); } private MetricsTimeVaryingRate create(String key) {
/** * Constructor - create a new metric * @param nam the name of the metrics to be used to publish the metric * @param registry - where the metrics object will be registered */ public MetricsLongValue(final String nam, final MetricsRegistry registry, final String description) { super(nam, description); value = 0; changed = false; registry.add(nam, this); }
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; }
List<MBeanAttributeInfo> attributesInfo = new ArrayList<MBeanAttributeInfo>(); MBeanOperationInfo[] operationsInfo = null; numEntriesInRegistry = metricsRegistry.size(); for (MetricsBase o : metricsRegistry.getMetricsList()) {
private void updateMbeanInfoIfMetricsListChanged() { if (numEntriesInRegistry != metricsRegistry.size()) { createMBeanInfo(); } }
for (String metricName : registry.getKeyList() ) { MetricsBase value = registry.get(metricName); value.pushMetric(metricsRecord);
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(); }
List<MBeanAttributeInfo> attributesInfo = new ArrayList<MBeanAttributeInfo>(); MBeanOperationInfo[] operationsInfo = null; numEntriesInRegistry = metricsRegistry.size(); for (MetricsBase o : metricsRegistry.getMetricsList()) {
private void updateMbeanInfoIfMetricsListChanged() { if (numEntriesInRegistry != metricsRegistry.size()) createMBeanInfo(); }
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); }
private void checkAndUpdateAttributes() { if (this.registryLength != this.registry.getMetricsList().size()) this.init(); }
List<MBeanAttributeInfo> attributesInfo = new ArrayList<MBeanAttributeInfo>(); MBeanOperationInfo[] operationsInfo = null; numEntriesInRegistry = metricsRegistry.size(); for (MetricsBase o : metricsRegistry.getMetricsList()) {
/** * Constructor - create a new metric * @param nam the name of the metrics to be used to publish the metric * @param registry - where the metrics object will be registered */ public MetricsTimeVaryingLong(final String nam, MetricsRegistry registry, final String description) { super(nam, description); currentValue = 0; previousIntervalValue = 0; registry.add(nam, this); }
private MetricsTimeVaryingRate getMethodTimeMetrics(String key) { return (MetricsTimeVaryingRate) registry.get(key); }
private void updateMbeanInfoIfMetricsListChanged() { if (numEntriesInRegistry != metricsRegistry.size()) createMBeanInfo(); }
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); }
@Override public Object invoke(String actionName, Object[] parms, String[] signature) throws MBeanException, ReflectionException { if (actionName == null || actionName.equals("")) throw new IllegalArgumentException(); // Right now we support only one fixed operation (if it applies) if (!(actionName.equals(RESET_ALL_MIN_MAX_OP)) || mbeanInfo.getOperations().length != 1) { throw new ReflectionException(new NoSuchMethodException(actionName)); } for (MetricsBase m : metricsRegistry.getMetricsList()) { if ( MetricsTimeVaryingRate.class.isInstance(m) ) { MetricsTimeVaryingRate.class.cast(m).resetMinMax(); } } return null; }
List<MBeanAttributeInfo> attributesInfo = new ArrayList<MBeanAttributeInfo>(); MBeanOperationInfo[] operationsInfo = null; numEntriesInRegistry = metricsRegistry.size(); for (MetricsBase o : metricsRegistry.getMetricsList()) {
/** * Constructor - create a new metric * @param nam the name of the metrics to be used to publish the metric * @param registry - where the metrics object will be registered */ public MetricsIntValue(final String nam, final MetricsRegistry registry, final String description) { super(nam, description); value = 0; changed = false; registry.add(nam, this); }