/** * @inheritDoc */ public int getSafemodeTime() { return myMetrics.safeModeTime.get(); }
/** * Push the metric to the mr. * The metric is pushed only if it was updated since last push * * Note this does NOT push to JMX * (JMX gets the info via {@link #get()} * * @param mr */ public synchronized void pushMetric(final MetricsRecord mr) { if (changed) { try { mr.setMetric(getName(), value); } catch (Exception e) { LOG.info("pushMetric failed for " + getName() + "\n", e); } } changed = false; } }
public void setCallQueueLen(int len) { callQueueLen.set(len); }
synchronized (this) { FSNamesystem fsNameSystem = FSNamesystem.getFSNamesystem(); filesTotal.set((int)fsNameSystem.getFilesTotal()); filesTotal.pushMetric(metricsRecord); blocksTotal.set((int)fsNameSystem.getBlocksTotal()); blocksTotal.pushMetric(metricsRecord); capacityTotalGB.set(roundBytesToGBytes(fsNameSystem.getCapacityTotal())); capacityTotalGB.pushMetric(metricsRecord); capacityUsedGB.set(roundBytesToGBytes(fsNameSystem.getCapacityUsed())); capacityUsedGB.pushMetric(metricsRecord); capacityRemainingGB.set(roundBytesToGBytes(fsNameSystem. getCapacityRemaining())); capacityRemainingGB.pushMetric(metricsRecord); totalLoad.set(fsNameSystem.getTotalLoad()); totalLoad.pushMetric(metricsRecord); pendingReplicationBlocks.set((int)fsNameSystem. getPendingReplicationBlocks()); pendingReplicationBlocks.pushMetric(metricsRecord); underReplicatedBlocks.set((int)fsNameSystem.getUnderReplicatedBlocks()); underReplicatedBlocks.pushMetric(metricsRecord); scheduledReplicationBlocks.set((int)fsNameSystem.
.valueOf((int) this.requests.getPreviousIntervalValue())); sb = Strings.appendKeyValue(sb, "numberOfOnlineRegions", Integer.valueOf(this.regions.get())); sb = Strings.appendKeyValue(sb, "numberOfStores", Integer.valueOf(this.stores.get())); sb = Strings.appendKeyValue(sb, "numberOfStorefiles", Integer.valueOf(this.storefiles.get())); sb = Strings.appendKeyValue(sb, this.storefileIndexSizeMB.getName(), Integer.valueOf(this.storefileIndexSizeMB.get())); sb = Strings.appendKeyValue(sb, "rootIndexSizeKB", Integer.valueOf(this.rootIndexSizeKB.get())); sb = Strings.appendKeyValue(sb, "totalStaticIndexSizeKB", Integer.valueOf(this.totalStaticIndexSizeKB.get())); sb = Strings.appendKeyValue(sb, "totalStaticBloomSizeKB", Integer.valueOf(this.totalStaticBloomSizeKB.get())); sb = Strings.appendKeyValue(sb, this.memstoreSizeMB.getName(), Integer.valueOf(this.memstoreSizeMB.get())); sb = Strings.appendKeyValue(sb, "mbInMemoryWithoutWAL", Integer.valueOf(this.mbInMemoryWithoutWAL.get())); Long.valueOf(this.readRequestsCount.get())); sb = Strings.appendKeyValue(sb, "writeRequestsCount", Long.valueOf(this.writeRequestsCount.get())); sb = Strings.appendKeyValue(sb, "compactionQueueSize", Integer.valueOf(this.compactionQueueSize.get())); sb = Strings.appendKeyValue(sb, "flushQueueSize", Integer.valueOf(this.flushQueueSize.get())); Long.valueOf(this.blockCacheMissCount.get()));
/** * Since this object is a registered updater, this method will be called * periodically, e.g. every 5 seconds. */ public void doUpdates(MetricsContext unused) { synchronized (this) { numFilesCreated.pushMetric(metricsRecord); numFilesAppended.pushMetric(metricsRecord); numGetBlockLocations.pushMetric(metricsRecord); numFilesRenamed.pushMetric(metricsRecord); numGetListingOps.pushMetric(metricsRecord); numCreateFileOps.pushMetric(metricsRecord); numDeleteFileOps.pushMetric(metricsRecord); numAddBlockOps.pushMetric(metricsRecord); transactions.pushMetric(metricsRecord); syncs.pushMetric(metricsRecord); blockReport.pushMetric(metricsRecord); safeModeTime.pushMetric(metricsRecord); fsImageLoadTime.pushMetric(metricsRecord); numBlocksCorrupted.pushMetric(metricsRecord); } metricsRecord.update(); }
@Override public void doUpdates(MetricsContext metricsContext) { synchronized (this) { this.shippedOpsRate.pushMetric(this.metricsRecord); this.shippedBatchesRate.pushMetric(this.metricsRecord); this.logEditsReadRate.pushMetric(this.metricsRecord); this.logEditsFilteredRate.pushMetric(this.metricsRecord); this.ageOfLastShippedOp.pushMetric(this.metricsRecord); this.sizeOfLogQueue.pushMetric(this.metricsRecord); } this.metricsRecord.update(); } }
/** * @inheritDoc */ public int getFSImageLoadTime() { return myMetrics.fsImageLoadTime.get(); }
/** * Reports length of the call queue to HBaseRpcMetrics. * @param queue Which queue to report */ protected void updateCallQueueLenMetrics(BlockingQueue<Call> queue) { if (queue == callQueue) { rpcMetrics.callQueueLen.set(callQueue.size()); } else if (queue == priorityCallQueue) { rpcMetrics.priorityCallQueueLen.set(priorityCallQueue.size()); } else if (queue == replicationQueue) { rpcMetrics.replicationCallQueueLen.set(replicationQueue.size()); } else { LOG.warn("Unknown call queue"); } }
/** * Push the metric to the mr. * The metric is pushed only if it was updated since last push * * Note this does NOT push to JMX * (JMX gets the info via {@link #get()} * * @param mr */ public synchronized void pushMetric(final MetricsRecord mr) { if (changed) { try { mr.setMetric(getName(), value); } catch (Exception e) { LOG.info("pushMetric failed for " + getName() + "\n", e); } } changed = false; } }
this.stores.pushMetric(this.metricsRecord); this.storefiles.pushMetric(this.metricsRecord); this.storefileIndexSizeMB.pushMetric(this.metricsRecord); this.rootIndexSizeKB.pushMetric(this.metricsRecord); this.totalStaticIndexSizeKB.pushMetric(this.metricsRecord); this.totalStaticBloomSizeKB.pushMetric(this.metricsRecord); this.memstoreSizeMB.pushMetric(this.metricsRecord); this.mbInMemoryWithoutWAL.pushMetric(this.metricsRecord); this.numPutsWithoutWAL.pushMetric(this.metricsRecord); this.readRequestsCount.pushMetric(this.metricsRecord); this.writeRequestsCount.pushMetric(this.metricsRecord); this.regions.pushMetric(this.metricsRecord); this.requests.pushMetric(this.metricsRecord); this.compactionQueueSize.pushMetric(this.metricsRecord); this.flushQueueSize.pushMetric(this.metricsRecord); this.blockCacheSize.pushMetric(this.metricsRecord); this.blockCacheFree.pushMetric(this.metricsRecord); this.blockCacheMissCount.pushMetric(this.metricsRecord); this.blockCacheEvictedCount.pushMetric(this.metricsRecord); this.blockCacheHitRatio.pushMetric(this.metricsRecord); this.blockCacheHitCachingRatio.pushMetric(this.metricsRecord); this.hdfsBlocksLocalityIndex.pushMetric(this.metricsRecord); this.blockCacheHitRatioPastNPeriods.pushMetric(this.metricsRecord); this.blockCacheHitCachingRatioPastNPeriods.pushMetric(this.metricsRecord);
return ((MetricsIntValue) o).get(); else if (o instanceof MetricsLongValue) return ((MetricsLongValue) o).get();
/** * Remove Block from CorruptBlocksMap * * @param blk Block to be removed */ void removeFromCorruptReplicasMap(Block blk) { if (corruptReplicasMap != null) { corruptReplicasMap.remove(blk); if (NameNode.getNameNodeMetrics() != null) { NameNode.getNameNodeMetrics().numBlocksCorrupted.set( corruptReplicasMap.size()); } } }
/** * Push the metric to the mr. * The metric is pushed only if it was updated since last push * * Note this does NOT push to JMX * (JMX gets the info via {@link #get()} * * @param mr */ public synchronized void pushMetric(final MetricsRecord mr) { if (changed) { try { mr.setMetric(getName(), value); } catch (Exception e) { LOG.info("pushMetric failed for " + getName() + "\n", e); } } changed = false; } }
/** Corrupt a block and ensure metrics reflects it */ public void testCorruptBlock() throws Exception { // Create a file with single block with two replicas final Path file = getTestPath("testCorruptBlock"); createFile(file, 100, (short)2); // Corrupt first replica of the block LocatedBlock block = NameNodeAdapter.getBlockLocations( cluster.getNameNode(), file.toString(), 0, 1).get(0); namesystem.markBlockAsCorrupt(block.getBlock(), block.getLocations()[0]); updateMetrics(); assertEquals(1, metrics.corruptBlocks.get()); assertEquals(1, metrics.pendingReplicationBlocks.get()); assertEquals(1, metrics.scheduledReplicationBlocks.get()); fs.delete(file, true); updateMetrics(); assertEquals(0, metrics.corruptBlocks.get()); assertEquals(0, metrics.pendingReplicationBlocks.get()); assertEquals(0, metrics.scheduledReplicationBlocks.get()); }
protected void closeConnection(Connection connection) { synchronized (connectionList) { if (connectionList.remove(connection)) { numConnections--; } } connection.close(); long bytes = 0; synchronized (connection.responseQueue) { for (Call c : connection.responseQueue) { bytes += c.response.limit(); } connection.responseQueue.clear(); } responseQueuesSizeThrottler.decrease(bytes); rpcMetrics.numOpenConnections.set(numConnections); }
/** * Push the metric to the mr. * The metric is pushed only if it was updated since last push * * Note this does NOT push to JMX * (JMX gets the info via {@link #get()} * * @param mr */ public synchronized void pushMetric(final MetricsRecord mr) { if (changed) { try { mr.setMetric(getName(), value); } catch (Exception e) { LOG.info("pushMetric failed for " + getName() + "\n", e); } } changed = false; } }
return ((MetricsIntValue) o).get(); else if (o instanceof MetricsLongValue) return ((MetricsLongValue) o).get();
/** * Poll for the next path * @return true if a path was obtained, false if not */ protected boolean getNextPath() { try { if (this.currentPath == null) { this.currentPath = queue.poll(this.sleepForRetries, TimeUnit.MILLISECONDS); this.metrics.sizeOfLogQueue.set(queue.size()); } } catch (InterruptedException e) { LOG.warn("Interrupted while reading edits", e); } return this.currentPath != null; }
/** * Push the metric to the mr. * The metric is pushed only if it was updated since last push * * Note this does NOT push to JMX * (JMX gets the info via {@link #get()} * * @param mr */ public synchronized void pushMetric(final MetricsRecord mr) { if (changed) { try { mr.setMetric(getName(), value); } catch (Exception e) { LOG.info("pushMetric failed for " + getName() + "\n" + StringUtils.stringifyException(e)); } } changed = false; } }