com.yammer.metrics.core.Counter类的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(196)

本文整理了Java中com.yammer.metrics.core.Counter类的一些代码示例,展示了Counter类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Counter类的具体详情如下:
包路径:com.yammer.metrics.core.Counter
类名称:Counter

Counter介绍

[英]An incrementing and decrementing counter metric.
[中]递增和递减的计数器度量。

代码示例

代码示例来源:origin: lealone/Lealone

@Override
protected void onInitialRejection(Runnable task) {
  metrics.totalBlocked.inc();
  metrics.currentBlocked.inc();
}

代码示例来源:origin: apache/incubator-pinot

@Override
public long getTotalBytesSent() {
 return _bytesSent.count();
}

代码示例来源:origin: lealone/Lealone

@Override
  protected void onFinalRejection(Runnable task) {
    metrics.currentBlocked.dec();
  }
}

代码示例来源:origin: addthis/hydra

public QueryEngineDirectory(DataTree tree, String dir) {
  super(tree);
  this.dir = dir;
  currentlyOpenEngines.inc();
  engineCreations.mark(); //Metric for total trees/engines initialized
}

代码示例来源:origin: com.wavefront/proxy

@Override
public void processCounter(MetricName name, Counter counter, FlushProcessorContext context) throws Exception {
 long count;
 // handle delta counter
 if (counter instanceof DeltaCounter) {
  count = DeltaCounter.processDeltaCounter((DeltaCounter) counter);
 } else {
  count = counter.count();
 }
 context.report(count);
 sentCounter.inc();
}

代码示例来源:origin: com.senseidb/sensei-core

@Override
public void clusterChanged(Map<Integer, List<InetSocketAddress>> clusterView) {
 logger.info("clusterChanged(): Received new clusterView from zu " + clusterView);
 Set<InetSocketAddress> nodeAddresses = getNodesAddresses(clusterView);
 synchronized (SenseiBroker.class) {
  numberOfNodesInTheCluster.clear();
  numberOfNodesInTheCluster.inc(nodeAddresses.size());
 }
}

代码示例来源:origin: addthis/hydra

@Override
public void onPassedCheck() {
  if (resetOnSuccess) {
    failedCheckCounter.clear();
  }
}

代码示例来源:origin: addthis/hydra

private void jobTaskUpdateHeartbeatCheck() {
  try {
    String now = Long.toString(System.currentTimeMillis());
    spawnDataStore.put(SpawnDataStoreKeys.SPAWN_JOB_CONFIG_HEARTBEAT_PATH, now);
    String received = spawnDataStore.get(SpawnDataStoreKeys.SPAWN_JOB_CONFIG_HEARTBEAT_PATH);
    if (Objects.equals(received, now)) {
      SpawnMetrics.jobTaskUpdateHeartbeatSuccessMeter.mark();
    } else {
      SpawnMetrics.jobTaskUpdateHeartbeatFailureCounter.inc();
    }
  } catch (Exception e) {
    SpawnMetrics.jobTaskUpdateHeartbeatFailureCounter.inc();
    log.warn("Failed to perform jobtaskupdate heartbeat check", e);
  }
}

代码示例来源:origin: wavefrontHQ/java

@Override
public void processCounter(MetricName name, Counter counter, FlushProcessorContext context) throws Exception {
 long count;
 // handle delta counter
 if (counter instanceof DeltaCounter) {
  count = DeltaCounter.processDeltaCounter((DeltaCounter) counter);
 } else {
  count = counter.count();
 }
 context.report(count);
 sentCounter.inc();
}

代码示例来源:origin: io.netty/netty-metrics-yammer

@Override
public void reset() {
  delegate.clear();
}

代码示例来源:origin: apache/incubator-pinot

public void addRequestResponseStats(long bytesSent, long numRequests, long bytesReceived, boolean isError,
  long sendRequestMs, long responseLatencyMs) {
 _requestsSent.inc(numRequests);
 _bytesSent.inc(bytesSent);
 _bytesReceived.inc(bytesReceived);
 if (isError) {
  _errors.inc();
 }
 _sendRequestMsHistogram.update(sendRequestMs);
 _responseLatencyMsHistogram.update(responseLatencyMs);
}

代码示例来源:origin: apache/incubator-pinot

@Override
public long getTotalBytesReceived() {
 return _bytesReceived.count();
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server

public void finishCompaction(CompactionInfo.Holder ci)
{
  // notify
  ci.finished();
  compactions.remove(ci);
  bytesCompacted.inc(ci.getCompactionInfo().getTotal());
  totalCompactionsCompleted.mark();
}

代码示例来源:origin: lealone/Lealone

@Override
protected void onFinalAccept(Runnable task) {
  metrics.currentBlocked.dec();
}

代码示例来源:origin: stackoverflow.com

public class Counter {
   static Counter counter1 = new Counter();
   ...
   public void resetCounters() {
    counter1.clear();
    counter2.clear();
    ...
   }
  }

代码示例来源:origin: apache/incubator-pinot

public void addServingStats(long requestSize, long responseSize, long numRequests, boolean error,
  long processingLatencyMs, long sendResponseLatencyMs) {
 _requestsReceived.inc(numRequests);
 _bytesReceived.inc(requestSize);
 _bytesSent.inc(responseSize);
 if (error) {
  _errors.inc();
 }
 _sendResponseMsHistogram.update(sendResponseLatencyMs);
 _processingLatencyMsHistogram.update(processingLatencyMs);
}

代码示例来源:origin: apache/incubator-pinot

@Override
public long getTotalErrors() {
 return _errors.count();
}

代码示例来源:origin: addthis/metrics-reporter-config

private void runLoop(ReporterConfig config) throws Exception
{
  Counter counter = Metrics.newCounter(getClass(), "counter");
  Meter meter = Metrics.newMeter(getClass(), "meter", "foo", TimeUnit.SECONDS);
  config.enableConsole();
  for (int i=0; i< loops; i++)
  {
    counter.inc();
    meter.mark();
    Thread.sleep(1000);
    log.debug("runLoop tick");
  }
  log.info("Done with sample data loop");
}

代码示例来源:origin: com.yammer.metrics/metrics-core

/**
 * Decrement the counter by one.
 */
public void dec() {
  dec(1);
}

代码示例来源:origin: apache/usergrid

/** Add a count object to this batcher */
public void add( Count count ) throws CounterProcessingUnavailableException {
  invocationCounter.inc();
  final TimerContext context = addTimer.time();
  if ( batchSize == 1 ) {
    getBatch().addSerial( count );
  }
  else {
    getBatch().add( count );
  }
  context.stop();
}

相关文章