当前位置: 首页>>代码示例>>Java>>正文


Java Stats.OperatorStats方法代码示例

本文整理汇总了Java中com.datatorrent.api.Stats.OperatorStats方法的典型用法代码示例。如果您正苦于以下问题:Java Stats.OperatorStats方法的具体用法?Java Stats.OperatorStats怎么用?Java Stats.OperatorStats使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.datatorrent.api.Stats的用法示例。


在下文中一共展示了Stats.OperatorStats方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processStats

import com.datatorrent.api.Stats; //导入方法依赖的package包/类
@Override
public Response processStats(BatchedOperatorStats batchedOperatorStats)
{
  List<Stats.OperatorStats> lastWindowedStats = batchedOperatorStats.getLastWindowedStats();
  if (lastWindowedStats != null) {
    for (Stats.OperatorStats os : lastWindowedStats) {
      if (os.counters != null) {
        if (os.counters instanceof BasicCounters) {
          @SuppressWarnings("unchecked")
          BasicCounters<MutableLong> cs = (BasicCounters<MutableLong>)os.counters;
          logger.debug("operatorId:{} buckets:[in-memory:{} deleted:{} evicted:{}] events:[in-memory:{} "
              + "committed-last-window:{} duplicates:{}] low:{} high:{}",
              batchedOperatorStats.getOperatorId(),
              cs.getCounter(BucketManager.CounterKeys.BUCKETS_IN_MEMORY),
              cs.getCounter(BucketManager.CounterKeys.DELETED_BUCKETS),
              cs.getCounter(BucketManager.CounterKeys.EVICTED_BUCKETS),
              cs.getCounter(BucketManager.CounterKeys.EVENTS_IN_MEMORY),
              cs.getCounter(BucketManager.CounterKeys.EVENTS_COMMITTED_LAST_WINDOW),
              cs.getCounter(CounterKeys.DUPLICATE_EVENTS));
        }
      }
    }
  }
  return null;
}
 
开发者ID:DataTorrent,项目名称:Megh,代码行数:26,代码来源:AbstractDeduper.java

示例2: extractkinesisStats

import com.datatorrent.api.Stats; //导入方法依赖的package包/类
private List<KinesisConsumer.KinesisShardStats> extractkinesisStats(BatchedOperatorStats stats)
{
  //preprocess the stats
  List<KinesisConsumer.KinesisShardStats> kmsList = new LinkedList<KinesisConsumer.KinesisShardStats>();
  for (Stats.OperatorStats os : stats.getLastWindowedStats()) {
    if (os != null && os.counters instanceof KinesisConsumer.KinesisShardStats) {
      kmsList.add((KinesisConsumer.KinesisShardStats)os.counters);
    }
  }
  return kmsList;
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:12,代码来源:AbstractKinesisInputOperator.java

示例3: extractKafkaStats

import com.datatorrent.api.Stats; //导入方法依赖的package包/类
private List<KafkaConsumer.KafkaMeterStats> extractKafkaStats(StatsListener.BatchedOperatorStats stats)
{
  //preprocess the stats
  List<KafkaConsumer.KafkaMeterStats> kmsList = new LinkedList<KafkaConsumer.KafkaMeterStats>();
  for (Stats.OperatorStats os : stats.getLastWindowedStats()) {
    if (os != null && os.counters instanceof KafkaConsumer.KafkaMeterStats) {
      kmsList.add((KafkaConsumer.KafkaMeterStats)os.counters);
    }
  }
  return kmsList;
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:12,代码来源:AbstractKafkaInputOperator.java

示例4: getLoad

import com.datatorrent.api.Stats; //导入方法依赖的package包/类
@Override
protected int getLoad(BatchedOperatorStats stats)
{
  double totalBacklog = 0;
  double statsPartitionCount = 0;
  for (Map.Entry<Integer, BatchedOperatorStats> partitionStatus : partitionedInstanceStatus.entrySet()) {
    BatchedOperatorStats batchedOperatorStats = partitionStatus.getValue();
    if (batchedOperatorStats != null) {
      List<Stats.OperatorStats> lastWindowedStats = batchedOperatorStats.getLastWindowedStats();
      if (lastWindowedStats != null && lastWindowedStats.size() > 0) {
        Stats.OperatorStats lastStats = lastWindowedStats.get(lastWindowedStats.size() - 1);
        Long queueLength = (Long)lastStats.metrics.get("queueLength");
        totalBacklog += queueLength;
        statsPartitionCount += 1;
        logger.debug("queueLength : {}, totalBacklog {},statsPartitionCount{}", queueLength, totalBacklog,
            statsPartitionCount);
      }
    }
  }

  double backlogPerPartition = totalBacklog / statsPartitionCount;
  logger.debug("backlogPerPartition : {}", backlogPerPartition);
  logger.debug("maxQueueSizePerPartition : {}, partitionedInstanceStatus.size():{}" + ", maxPartitions:{}",
      maxQueueSizePerPartition, partitionedInstanceStatus.size(), maxPartitions);

  if (backlogPerPartition > maxQueueSizePerPartition && partitionedInstanceStatus.size() < maxPartitions) {
    return 1;
  }
  logger.debug("minPartitions:{}", minPartitions);

  if (backlogPerPartition < 1.1 && partitionedInstanceStatus.size() > minPartitions) {
    return -1;
  }

  return 0;
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:37,代码来源:S3ReconcilerQueuePartitioner.java

示例5: processStats

import com.datatorrent.api.Stats; //导入方法依赖的package包/类
@Override
public StatsListener.Response processStats(StatsListener.BatchedOperatorStats stats)
{
  Stats.OperatorStats operatorStats = stats.getLastWindowedStats().get(stats.getLastWindowedStats().size() - 1);
  tuplesProcessedCompletely = (Integer)operatorStats.metrics.get("tuplesProcessedCompletely");
  if (tuplesProcessedCompletely >= TOTAL_TUPLES_PROCESS) {
    latch.countDown();
  }
  return null;
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:11,代码来源:POJOPartitionJoinOperatorTest.java

示例6: processStats

import com.datatorrent.api.Stats; //导入方法依赖的package包/类
@Override
public Response processStats(BatchedOperatorStats stats)
{
  Stats.OperatorStats operatorStats = stats.getLastWindowedStats().get(stats.getLastWindowedStats().size() - 1);
  count = (Integer)operatorStats.metrics.get("count");
  if (count >= 1000) {
    latch.countDown();
  }
  return null;
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:11,代码来源:DeduperOrderingTest.java

示例7: processStats

import com.datatorrent.api.Stats; //导入方法依赖的package包/类
@Override
public Response processStats(BatchedOperatorStats stats)
{
  Stats.OperatorStats operatorStats = stats.getLastWindowedStats().get(stats.getLastWindowedStats().size() - 1);
  tuplesProcessedCompletely = (Integer)operatorStats.metrics.get("tuplesProcessedCompletely");
  if (tuplesProcessedCompletely >= 1000) {
    latch.countDown();
  }
  return null;
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:11,代码来源:DeduperPartitioningTest.java

示例8: processStats

import com.datatorrent.api.Stats; //导入方法依赖的package包/类
@Override
public Response processStats(BatchedOperatorStats stats)
{
  Stats.OperatorStats operatorStats = stats.getLastWindowedStats().get(stats.getLastWindowedStats().size() - 1);
  count = (Integer)operatorStats.metrics.get("count");
  if (count == 12) {
    latch.countDown();
  }
  return null;
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:11,代码来源:FileSplitterBaseTest.java

示例9: processStats

import com.datatorrent.api.Stats; //导入方法依赖的package包/类
@Override
public Response processStats(BatchedOperatorStats stats)
{
  response.repartitionRequired = false;
  if (!collectStats) {
    return response;
  }

  List<Stats.OperatorStats> lastWindowedStats = stats.getLastWindowedStats();
  if (lastWindowedStats != null && lastWindowedStats.size() > 0) {
    Stats.OperatorStats lastStats = lastWindowedStats.get(lastWindowedStats.size() - 1);
    if (lastStats.inputPorts.size() > 0) {
      backlogPerOperator.put(stats.getOperatorId(), lastStats.inputPorts.get(0).queueSize);
    }
  }

  if (System.currentTimeMillis() < nextMillis) {
    return response;
  }
  nextMillis = System.currentTimeMillis() + intervalMillis;
  LOG.debug("Proposed NextMillis = {}", nextMillis);

  long totalBacklog = 0;
  for (Map.Entry<Integer, Integer> backlog : backlogPerOperator.entrySet()) {
    totalBacklog += backlog.getValue();
  }
  LOG.debug("backlog {} partitionCount {}", totalBacklog, partitionCount);
  backlogPerOperator.clear();

  if (totalBacklog == partitionCount) {
    return response; //do not repartition
  }

  int newPartitionCount;
  if (totalBacklog > maxReaders) {
    LOG.debug("large backlog {}", totalBacklog);
    newPartitionCount = maxReaders;
  } else if (totalBacklog < minReaders) {
    LOG.debug("small backlog {}", totalBacklog);
    newPartitionCount = minReaders;
  } else {
    newPartitionCount = getAdjustedCount(totalBacklog);
    LOG.debug("moderate backlog {}", totalBacklog);
  }

  LOG.debug("backlog {} newPartitionCount {} partitionCount {}", totalBacklog, newPartitionCount, partitionCount);
  if (newPartitionCount == partitionCount) {
    return response; //do not repartition
  }

  partitionCount = newPartitionCount;
  response.repartitionRequired = true;
  LOG.debug("partition required", totalBacklog, partitionCount);

  return response;
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:57,代码来源:AbstractBlockReader.java

示例10: getLastWindowedStats

import com.datatorrent.api.Stats; //导入方法依赖的package包/类
@Override
public List<Stats.OperatorStats> getLastWindowedStats()
{
  return operatorStats;
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:6,代码来源:TestUtils.java


注:本文中的com.datatorrent.api.Stats.OperatorStats方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。