public interface MetricSampler extends CruiseControlConfigurable, AutoCloseable
Kafka Cruise Control periodically collects the metrics of all the partitions in the cluster, including the leader and follower
replicas. The getSamples(Cluster, Set, long, long)
will be called for all the replicas of partitions in the cluster in one sampling period.
The MetricSampler may be used by multiple threads at the same time, so the implementation need to be thread safe.
Modifier and Type | Interface and Description |
---|---|
static class |
MetricSampler.Samples
A container class that wraps both the partition metric samples and broker metric samples.
|
Modifier and Type | Field and Description |
---|---|
static MetricSampler.Samples |
EMPTY_SAMPLES |
Modifier and Type | Method and Description |
---|---|
MetricSampler.Samples |
getSamples(org.apache.kafka.common.Cluster cluster,
Set<org.apache.kafka.common.PartitionInfo> assignedPartitions,
long startTimeMs,
long endTimeMs)
Get the metric sample of the given topic partition and replica from the Kafka cluster.
|
configure
close
static final MetricSampler.Samples EMPTY_SAMPLES
MetricSampler.Samples getSamples(org.apache.kafka.common.Cluster cluster, Set<org.apache.kafka.common.PartitionInfo> assignedPartitions, long startTimeMs, long endTimeMs) throws MetricSamplingException
cluster
- the metadata of the cluster.assignedPartitions
- the topic partitionstartTimeMs
- the start time of the sampling period.endTimeMs
- the end time of the sampling period.MetricSamplingException