本文整理了Java中com.codahale.metrics.Counter.inc()
方法的一些代码示例,展示了Counter.inc()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Counter.inc()
方法的具体详情如下:
包路径:com.codahale.metrics.Counter
类名称:Counter
方法名:inc
[英]Increment the counter by one.
[中]将计数器增加1。
代码示例来源:origin: Alluxio/alluxio
@Override
public void onBlockLost(long blockId) {
BLOCKS_LOST.inc();
}
}
代码示例来源:origin: Graylog2/graylog2-server
private void expireEntry(String messageId) {
final ChunkEntry cleanupEntry = getAndCleanupEntry(messageId);
expiredMessages.inc();
expiredChunks.inc(cleanupEntry.chunkSlotsWritten.get());
}
代码示例来源:origin: Alluxio/alluxio
/**
* @param bytesWritten bytes written
*/
private void incrementMetrics(long bytesWritten) {
Counter counter = mContext.getCounter();
Meter meter = mContext.getMeter();
Preconditions.checkState(counter != null, "counter");
Preconditions.checkState(meter != null, "meter");
counter.inc(bytesWritten);
meter.mark(bytesWritten);
}
}
代码示例来源:origin: Alluxio/alluxio
/**
* @param bytesRead bytes read
*/
private void incrementMetrics(long bytesRead) {
Counter counter = mContext.getCounter();
Meter meter = mContext.getMeter();
Preconditions.checkState(counter != null);
counter.inc(bytesRead);
meter.mark(bytesRead);
}
代码示例来源:origin: thinkaurelius/titan
@Override
public StoreTransaction beginTransaction(BaseTransactionConfig config) throws BackendException {
MetricManager.INSTANCE.getCounter(GLOBAL_PREFIX, managerMetricsName, M_START_TX, M_CALLS).inc();
return backend.beginTransaction(config);
}
代码示例来源:origin: thinkaurelius/titan
@Override
public void close() throws BackendException {
backend.close();
MetricManager.INSTANCE.getCounter(GLOBAL_PREFIX, managerMetricsName, M_CLOSE_MANAGER, M_CALLS).inc();
}
代码示例来源:origin: apache/storm
public void spoutFailedTuple(String stream, long latencyMs, Counter failedCounter) {
this.getFailed().incBy(stream, this.rate);
failedCounter.inc(this.rate);
}
代码示例来源:origin: Graylog2/graylog2-server
private void recordEsMetrics(JestResult jestResult, @Nullable TimeRange range) {
esTotalSearchesCounter.inc();
final long tookMs = tookMsFromSearchResult(jestResult);
esRequestTimer.update(tookMs, TimeUnit.MILLISECONDS);
if (range != null) {
esTimeRangeHistogram.update(TimeRanges.toSeconds(range));
}
}
代码示例来源:origin: apache/storm
public void transferredTuples(String stream, int amount, Counter transferredCounter) {
this.getTransferred().incBy(stream, this.rate * amount);
transferredCounter.inc(amount);
}
代码示例来源:origin: apache/storm
public void emittedTuple(String stream, Counter emittedCounter) {
this.getEmitted().incBy(stream, this.rate);
emittedCounter.inc(this.rate);
}
代码示例来源:origin: Alluxio/alluxio
@Override
public FileInfo getFileInfo(long fileId)
throws FileDoesNotExistException, AccessControlException, UnavailableException {
Metrics.GET_FILE_INFO_OPS.inc();
try (LockedInodePath inodePath = mInodeTree.lockFullInodePath(fileId, LockPattern.READ)) {
return getFileInfoInternal(inodePath);
}
}
代码示例来源:origin: apache/storm
public void boltFailedTuple(String component, String stream, long latencyMs, Counter failedCounter) {
List key = Lists.newArrayList(component, stream);
this.getFailed().incBy(key, this.rate);
failedCounter.inc(this.rate);
}
代码示例来源:origin: thinkaurelius/titan
private void recordSliceMetrics(StoreTransaction txh, List<Entry> row) {
if (!txh.getConfiguration().hasGroupName())
return;
String p = txh.getConfiguration().getGroupName();
final MetricManager mgr = MetricManager.INSTANCE;
mgr.getCounter(p, metricsStoreName, M_GET_SLICE, M_ENTRIES_COUNT).inc(row.size());
mgr.getHistogram(p, metricsStoreName, M_GET_SLICE, M_ENTRIES_HISTO).update(row.size());
}
代码示例来源:origin: Alluxio/alluxio
@Override
public DataBuffer readChunk() throws IOException {
if (mPos >= mEnd) {
return null;
}
ByteBuffer buffer = mReader.read(mPos, Math.min(mChunkSize, mEnd - mPos));
DataBuffer dataBuffer = new NioDataBuffer(buffer, buffer.remaining());
mPos += dataBuffer.getLength();
MetricsSystem.counter(ClientMetrics.BYTES_READ_LOCAL).inc(dataBuffer.getLength());
MetricsSystem.meter(ClientMetrics.BYTES_READ_LOCAL_THROUGHPUT).mark(dataBuffer.getLength());
return dataBuffer;
}
代码示例来源:origin: apache/storm
public void spoutAckedTuple(String stream, long latencyMs, Counter ackedCounter) {
this.getAcked().incBy(stream, this.rate);
ackedCounter.inc(this.rate);
this.getCompleteLatencies().record(stream, latencyMs);
}
代码示例来源:origin: thinkaurelius/titan
@Override
public KeyColumnValueStore openDatabase(String name, StoreMetaData.Container metaData) throws BackendException {
MetricManager.INSTANCE.getCounter(GLOBAL_PREFIX, managerMetricsName, M_OPEN_DATABASE, M_CALLS).inc();
return new MetricInstrumentedStore(backend.openDatabase(name, metaData),getMetricsStoreName(name));
}
代码示例来源:origin: Alluxio/alluxio
@Override
public void onMoveBlockByClient(long sessionId, long blockId, BlockStoreLocation oldLocation,
BlockStoreLocation newLocation) {
int oldTierOrdinal = mStorageTierAssoc.getOrdinal(oldLocation.tierAlias());
int newTierOrdinal = mStorageTierAssoc.getOrdinal(newLocation.tierAlias());
if (newTierOrdinal == 0 && oldTierOrdinal != newTierOrdinal) {
BLOCKS_PROMOTED.inc();
}
}
代码示例来源:origin: apache/storm
public void boltAckedTuple(String component, String stream, long latencyMs, Counter ackedCounter) {
List key = Lists.newArrayList(component, stream);
this.getAcked().incBy(key, this.rate);
ackedCounter.inc(this.rate);
this.getProcessLatencies().record(key, latencyMs);
}
代码示例来源:origin: thinkaurelius/titan
protected void incActionBy(int by, CacheMetricsAction action, StoreTransaction txh) {
assert by>=1;
if (metricsName!=null && txh.getConfiguration().hasGroupName()) {
MetricManager.INSTANCE.getCounter(txh.getConfiguration().getGroupName(), metricsName, action.getName()).inc(by);
}
}
代码示例来源:origin: thinkaurelius/titan
@Override
public TitanVertex getVertex(long vertexid) {
verifyOpen();
if (null != config.getGroupName()) {
MetricManager.INSTANCE.getCounter(config.getGroupName(), "db", "getVertexByID").inc();
}
if (!isValidVertexId(vertexid)) return null;
//Make canonical partitioned vertex id
if (idInspector.isPartitionedVertex(vertexid)) vertexid=idManager.getCanonicalVertexId(vertexid);
InternalVertex v = null;
v = vertexCache.get(vertexid, externalVertexRetriever);
return (null == v || v.isRemoved()) ? null : v;
}
内容来源于网络,如有侵权,请联系作者删除!