Search in sources :

Example 1 with SampleExtrapolation

use of com.linkedin.kafka.cruisecontrol.monitor.sampling.aggregator.SampleExtrapolation in project cruise-control by linkedin.

the class LoadMonitor method partitionSampleExtrapolations.

private Map<TopicPartition, List<SampleExtrapolation>> partitionSampleExtrapolations(Map<PartitionEntity, ValuesAndExtrapolations> valuesAndExtrapolations) {
    Map<TopicPartition, List<SampleExtrapolation>> sampleExtrapolations = new HashMap<>();
    for (Map.Entry<PartitionEntity, ValuesAndExtrapolations> entry : valuesAndExtrapolations.entrySet()) {
        TopicPartition tp = entry.getKey().tp();
        Map<Integer, Extrapolation> extrapolations = entry.getValue().extrapolations();
        if (extrapolations.isEmpty()) {
            List<SampleExtrapolation> extrapolationForPartition = sampleExtrapolations.computeIfAbsent(tp, p -> new ArrayList<>());
            extrapolations.forEach((t, imputation) -> extrapolationForPartition.add(new SampleExtrapolation(t, imputation)));
        }
    }
    return sampleExtrapolations;
}
Also used : HashMap(java.util.HashMap) PartitionEntity(com.linkedin.kafka.cruisecontrol.monitor.sampling.PartitionEntity) SampleExtrapolation(com.linkedin.kafka.cruisecontrol.monitor.sampling.aggregator.SampleExtrapolation) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Extrapolation(com.linkedin.cruisecontrol.monitor.sampling.aggregator.Extrapolation) SampleExtrapolation(com.linkedin.kafka.cruisecontrol.monitor.sampling.aggregator.SampleExtrapolation) ValuesAndExtrapolations(com.linkedin.cruisecontrol.monitor.sampling.aggregator.ValuesAndExtrapolations) TopicPartition(org.apache.kafka.common.TopicPartition) List(java.util.List) ArrayList(java.util.ArrayList) Map(java.util.Map) SortedMap(java.util.SortedMap) HashMap(java.util.HashMap)

Aggregations

Extrapolation (com.linkedin.cruisecontrol.monitor.sampling.aggregator.Extrapolation)1 ValuesAndExtrapolations (com.linkedin.cruisecontrol.monitor.sampling.aggregator.ValuesAndExtrapolations)1 PartitionEntity (com.linkedin.kafka.cruisecontrol.monitor.sampling.PartitionEntity)1 SampleExtrapolation (com.linkedin.kafka.cruisecontrol.monitor.sampling.aggregator.SampleExtrapolation)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 SortedMap (java.util.SortedMap)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 TopicPartition (org.apache.kafka.common.TopicPartition)1