@Override
  public void reset() {

    final Map<MetricName, Metric> metricMap = registry.allMetrics();

    final Set<Entry<MetricName, Metric>> entrySet = metricMap.entrySet();

    for (final Entry<MetricName, Metric> entry : entrySet) {

      final MetricName name = entry.getKey();
      final Metric metric = entry.getValue();

      if (metric instanceof Counter) {
        ((Counter) metric).clear();
      }

      if (metric instanceof Timer) {
        ((Timer) metric).clear();
      }

      if (metric instanceof Histogram) {
        ((Histogram) metric).clear();
      }

      if (metric instanceof Clearable) {
        ((Clearable) metric).clear();
      }
    }
  }
Exemplo n.º 2
0
 @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());
   }
 }
Exemplo n.º 3
0
 public void handleClusterConnected(Set<Node> nodes) {
   //    _loadBalancer = _loadBalancerFactory.newLoadBalancer(nodes);
   _partitions = getPartitions(nodes);
   numberOfNodesInTheCluster.clear();
   numberOfNodesInTheCluster.inc(getNumberOfNodes());
   logger.info(
       "handleClusterConnected(): Received the list of nodes from norbert " + nodes.toString());
   logger.info(
       "handleClusterConnected(): Received the list of partitions from router "
           + _partitions.toString());
 }
  public void commitPengingEvents() {
    log.info("Flushing pending kafka events to the persistent cache");
    long time = System.currentTimeMillis();
    int numberOfBatches = 0;

    for (PersistentCache persistentCache : persistentCaches.values()) {
      persistentCache.commitPengingEvents();
      numberOfBatches += persistentCache.numberOfAvailableBatches();
    }
    numberOfBatchesCounter.clear();
    numberOfBatchesCounter.inc(numberOfBatches);
    timer.update(System.currentTimeMillis() - time, TimeUnit.MILLISECONDS);
  }