public class KafkaReplicaMetricSampleAggregator extends MetricSampleAggregator<ReplicaEntity>
MetricSampleAggregator
MetricSampleAggregator.SampleType
identityEntityMap, latestInvalidWindowIndex, metricDef, minSamplesPerWindow, monitoringPeriodMs, numWindows, numWindowsToKeep, sampleType, windowMs
generation
Constructor and Description |
---|
KafkaReplicaMetricSampleAggregator(KafkaCruiseControlConfig config)
Construct the metric sample aggregator.
|
Modifier and Type | Method and Description |
---|---|
MetricSampleAggregationResult<ReplicaEntity> |
aggregate(org.apache.kafka.common.Cluster cluster,
long now,
ModelCompletenessRequirements requirements)
Overload of
aggregate(Cluster, long, ModelCompletenessRequirements, Set)
passes empty set of failed brokers. |
MetricSampleAggregationResult<ReplicaEntity> |
aggregate(org.apache.kafka.common.Cluster cluster,
long now,
ModelCompletenessRequirements requirements,
Set<Integer> failedBrokers)
Method to aggregate the metrics of replicas in the cluster.
|
double |
monitoredPercentage(Set<ReplicaEntity> allReplicas)
Get the valid replica percentage across all the windows.
|
Map<Long,Float> |
validReplicaRatioByWindows(Set<ReplicaEntity> allReplicas)
Get the monitored replica percentage in each window.
|
Set<Long> |
validWindows(MetadataClient.ClusterAndGeneration clusterAndGeneration,
double minMonitoredPartitionsPercentage)
Overload of
validWindows(Set, double, Set)
passes empty set of failed broker ids. |
Set<Long> |
validWindows(MetadataClient.ClusterAndGeneration clusterAndGeneration,
double minMonitoredPartitionsPercentage,
Set<Integer> failedBrokerIds)
Get all replicas in the cluster and check for valid windows for them by calling
overloaded
validWindows(Set, double, Set) method. |
Set<Long> |
validWindows(Set<ReplicaEntity> allReplicas,
double minMonitoredPartitionsPercentage)
Overload of
validWindows(Set, double, Set)
passes empty set of failedBrokers to original method. |
Set<Long> |
validWindows(Set<ReplicaEntity> allReplicas,
double minMonitoredPartitionsPercentage,
Set<Integer> failedBrokerIds)
Get a sorted set of valid windows in the aggregator.
|
addSample, aggregate, aggregate, allWindows, availableWindows, clear, completeness, completeness, maybeInvalidateWindowsBeforeTime, numAvailableWindows, numAvailableWindows, numSamples, peekCurrentWindow, removeEntities, removeEntityGroup, retainEntities, retainEntityGroup, windowIndicesToWindows, windowIndicesToWindows
generation
public KafkaReplicaMetricSampleAggregator(KafkaCruiseControlConfig config)
config
- The kafka cruise control configurations.public MetricSampleAggregationResult<ReplicaEntity> aggregate(org.apache.kafka.common.Cluster cluster, long now, ModelCompletenessRequirements requirements, Set<Integer> failedBrokers) throws NotEnoughValidWindowsException
MetricSampleAggregator.aggregate(long, long, AggregationOptions)
to perform the aggregation.NotEnoughValidWindowsException
public MetricSampleAggregationResult<ReplicaEntity> aggregate(org.apache.kafka.common.Cluster cluster, long now, ModelCompletenessRequirements requirements) throws NotEnoughValidWindowsException
aggregate(Cluster, long, ModelCompletenessRequirements, Set)
passes empty set of failed brokers.NotEnoughValidWindowsException
public Set<Long> validWindows(MetadataClient.ClusterAndGeneration clusterAndGeneration, double minMonitoredPartitionsPercentage, Set<Integer> failedBrokerIds)
validWindows(Set, double, Set)
method.validWindows(Set, double, Set)
public Set<Long> validWindows(MetadataClient.ClusterAndGeneration clusterAndGeneration, double minMonitoredPartitionsPercentage)
validWindows(Set, double, Set)
passes empty set of failed broker ids.validWindows(Set, double, Set)
public Set<Long> validWindows(Set<ReplicaEntity> allReplicas, double minMonitoredPartitionsPercentage, Set<Integer> failedBrokerIds)
enough valid partitions
being monitored. A valid replica must be valid in all the windows in the returned set.allReplicas
- The set of replica entities for which to get valid windows.minMonitoredPartitionsPercentage
- the minimum required monitored partitions percentage. We
are using partition config for replica too.failedBrokerIds
- Set of failed brokers(Dead brokers)public Set<Long> validWindows(Set<ReplicaEntity> allReplicas, double minMonitoredPartitionsPercentage)
validWindows(Set, double, Set)
passes empty set of failedBrokers to original method.public double monitoredPercentage(Set<ReplicaEntity> allReplicas)
public Map<Long,Float> validReplicaRatioByWindows(Set<ReplicaEntity> allReplicas)