/** * Push the delta metrics to the mr. * The delta is since the last push/interval. * * Note this does NOT push to JMX * (JMX gets the info via {@link #previousIntervalValue} * * @param mr */ public synchronized void pushMetric(final MetricsRecord mr) { intervalHeartBeat(); try { mr.incrMetric(getName(), getPreviousIntervalValue()); } catch (Exception e) { LOG.info("pushMetric failed for " + getName() + "\n" , e); } }
return ((MetricsTimeVaryingInt) o).getPreviousIntervalValue(); else if (o instanceof MetricsTimeVaryingLong) return ((MetricsTimeVaryingLong) o).getPreviousIntervalValue(); else if (o instanceof MetricsTimeVaryingRate) { MetricsTimeVaryingRate or = (MetricsTimeVaryingRate) o;
private void updateCounters() throws IOException { // we can get access to counters only if hbase uses new mapreduce APIs if (this.getCounter == null) { return; } byte[] serializedMetrics = currentScan.getAttribute(Scan.SCAN_ATTRIBUTES_METRICS_DATA); if (serializedMetrics == null || serializedMetrics.length == 0) { return; } DataInputBuffer in = new DataInputBuffer(); in.reset(serializedMetrics, 0, serializedMetrics.length); ScanMetrics scanMetrics = new ScanMetrics(); scanMetrics.readFields(in); MetricsTimeVaryingLong[] mlvs = scanMetrics.getMetricsTimeVaryingLongArray(); try { for (MetricsTimeVaryingLong mlv : mlvs) { Counter ct = (Counter) this.getCounter.invoke(context, HBASE_COUNTER_GROUP_NAME, mlv.getName()); ct.increment(mlv.getCurrentIntervalValue()); } ((Counter) this.getCounter.invoke(context, HBASE_COUNTER_GROUP_NAME, "NUM_SCANNER_RESTARTS")) .increment(numRestarts); } catch (Exception e) { LOG.debug("can't update counter." + StringUtils.stringifyException(e)); } }
public void doUpdates(MetricsContext context) { getLockAndWriteLatency.pushMetric(metricsRecord); getDataLatency.pushMetric(metricsRecord); prewriteReadLockLatency.pushMetric(metricsRecord); prewriteReadWriteLatency.pushMetric(metricsRecord); prewriteCheckConflictRowLatency.pushMetric(metricsRecord); prewriteWriteLatency.pushMetric(metricsRecord); prewriteTotalLatency.pushMetric(metricsRecord); commitPrimaryReadLatency.pushMetric(metricsRecord); commitWriteLatency.pushMetric(metricsRecord); commitTotalLatency.pushMetric(metricsRecord); getLockAndEraseReadLatency.pushMetric(metricsRecord); getLockAndEraseDeleteLatency.pushMetric(metricsRecord); cleanLockLatency.pushMetric(metricsRecord); cleanLockSuccessCount.pushMetric(metricsRecord); cleanLockFailCount.pushMetric(metricsRecord); cleanLockByEraseCount.pushMetric(metricsRecord); cleanLockByCommitCount.pushMetric(metricsRecord); metricsRecord.update(); }
/** * serialize all the MetricsTimeVaryingLong */ public void write(DataOutput out) throws IOException { out.writeByte(SCANMETRICS_VERSION); Collection<MetricsBase> mbs = registry.getMetricsList(); // we only handle MetricsTimeVaryingLong for now. int metricsCount = 0; for (MetricsBase mb : mbs) { if ( mb instanceof MetricsTimeVaryingLong) { metricsCount++; } else { throw new IOException("unsupported metrics type. metrics name: " + mb.getName() + ", metrics description: " + mb.getDescription()); } } out.writeInt(metricsCount); for (MetricsBase mb : mbs) { out.writeUTF(mb.getName()); out.writeLong(((MetricsTimeVaryingLong) mb).getCurrentIntervalValue()); } }
return ((MetricsTimeVaryingInt) o).getPreviousIntervalValue(); else if (o instanceof MetricsTimeVaryingLong) return ((MetricsTimeVaryingLong) o).getPreviousIntervalValue(); else if (o instanceof MetricsTimeVaryingRate) { MetricsTimeVaryingRate or = (MetricsTimeVaryingRate) o;
for (MetricsTimeVaryingLong mlv : mlvs) { Counter ct = (Counter)this.getCounter.invoke(context, HBASE_COUNTER_GROUP_NAME, mlv.getName()); ct.increment(mlv.getCurrentIntervalValue());
public void doUpdates(MetricsContext context) { prewriteLatency.pushMetric(metricsRecord); commitPrimaryLatency.pushMetric(metricsRecord); commitSecondaryLatency.pushMetric(metricsRecord); readLatency.pushMetric(metricsRecord); nextLatency.pushMetric(metricsRecord); metricsRecord.update(); rollbackCount.pushMetric(metricsRecord); isLockExpiredLatency.pushMetric(metricsRecord); getScannerLatency.pushMetric(metricsRecord); batchSizeOfTimestampRequest.pushMetric(metricsRecord); remoteTimestampRequestLatency.pushMetric(metricsRecord); }
public void testDataNodeMetrics() throws Exception { Configuration conf = new HdfsConfiguration(); conf.setBoolean(SimulatedFSDataset.CONFIG_PROPERTY_SIMULATED, true); MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).build(); try { FileSystem fs = cluster.getFileSystem(); final long LONG_FILE_LEN = Integer.MAX_VALUE+1L; DFSTestUtil.createFile(fs, new Path("/tmp.txt"), LONG_FILE_LEN, (short)1, 1L); List<DataNode> datanodes = cluster.getDataNodes(); assertEquals(datanodes.size(), 1); DataNode datanode = datanodes.get(0); DataNodeMetrics metrics = datanode.getMetrics(); assertEquals(LONG_FILE_LEN, metrics.bytesWritten.getCurrentIntervalValue()); } finally { if (cluster != null) {cluster.shutdown();} } } }
/** * Push the delta metrics to the mr. * The delta is since the last push/interval. * * Note this does NOT push to JMX * (JMX gets the info via {@link #previousIntervalValue} * * @param mr */ public synchronized void pushMetric(final MetricsRecord mr) { intervalHeartBeat(); try { mr.incrMetric(getName(), getPreviousIntervalValue()); } catch (Exception e) { LOG.info("pushMetric failed for " + getName() + "\n" , e); } }
public synchronized void incReadSize(long value) { readSize.inc(value); }
return ((MetricsTimeVaryingInt) o).getPreviousIntervalValue(); else if (o instanceof MetricsTimeVaryingLong) return ((MetricsTimeVaryingLong) o).getPreviousIntervalValue(); else if (o instanceof MetricsTimeVaryingRate) { MetricsTimeVaryingRate or = (MetricsTimeVaryingRate) o;
this.flushSize.pushMetric(this.metricsRecord); this.slowHLogAppendCount.pushMetric(this.metricsRecord); this.regionSplitSuccessCount.pushMetric(this.metricsRecord); this.regionSplitFailureCount.pushMetric(this.metricsRecord); this.checksumFailuresCount.pushMetric(this.metricsRecord); this.updatesBlockedSeconds.pushMetric(this.metricsRecord);
/** * Push the delta metrics to the mr. * The delta is since the last push/interval. * * Note this does NOT push to JMX * (JMX gets the info via {@link #previousIntervalValue} * * @param mr */ public synchronized void pushMetric(final MetricsRecord mr) { intervalHeartBeat(); try { mr.incrMetric(getName(), getPreviousIntervalValue()); } catch (Exception e) { LOG.info("pushMetric failed for " + getName() + "\n" , e); } }
public synchronized void incPreadOps(){ preadOps.inc(); }
return ((MetricsTimeVaryingInt) o).getPreviousIntervalValue(); else if (o instanceof MetricsTimeVaryingLong) return ((MetricsTimeVaryingLong) o).getPreviousIntervalValue(); else if (o instanceof MetricsTimeVaryingRate) { MetricsTimeVaryingRate or = (MetricsTimeVaryingRate) o;
/** * Push the delta metrics to the mr. * The delta is since the last push/interval. * * Note this does NOT push to JMX * (JMX gets the info via {@link #previousIntervalValue} * * @param mr */ public synchronized void pushMetric(final MetricsRecord mr) { intervalHeartBeat(); try { mr.incrMetric(getName(), getPreviousIntervalValue()); } catch (Exception e) { LOG.info("pushMetric failed for " + getName() + "\n" , e); } }
public synchronized void incWriteOps(){ writeOps.inc(); }
return ((MetricsTimeVaryingInt)o).getPreviousIntervalValue(); } else if (o instanceof MetricsTimeVaryingLong) { return ((MetricsTimeVaryingLong)o).getPreviousIntervalValue(); } else if (o instanceof MetricsTimeVaryingRate) { MetricsTimeVaryingRate or = (MetricsTimeVaryingRate) o;