public abstract class ConfluentMetricsSamplerBase extends Object implements MetricSampler
MetricSampler.Samples
Modifier and Type | Field and Description |
---|---|
static String |
METRIC_SAMPLER_BOOTSTRAP_SERVERS |
static String |
METRIC_SAMPLER_GROUP_ID |
static String |
TELEMETRY_REPORTER_TOPIC_PATTERN |
EMPTY_SAMPLES
Constructor and Description |
---|
ConfluentMetricsSamplerBase() |
Modifier and Type | Method and Description |
---|---|
static void |
checkStartupCondition(KafkaCruiseControlConfig config,
Semaphore abortStartupCheck)
Make sure any condition needed to start this
CruiseControlComponent is satisfied. |
void |
close() |
void |
configure(Map<String,?> configs)
Configure this class with the given key-value pairs
|
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.
|
public static final String METRIC_SAMPLER_BOOTSTRAP_SERVERS
public static final String TELEMETRY_REPORTER_TOPIC_PATTERN
public static final String METRIC_SAMPLER_GROUP_ID
public MetricSampler.Samples getSamples(org.apache.kafka.common.Cluster cluster, Set<org.apache.kafka.common.PartitionInfo> assignedPartitions, long startTimeMs, long endTimeMs)
The samples include PartitionMetricSample
and ReplicaMetricSample
Due to the lack of direct metrics at partition level, Kafka Cruise Control needs to estimate the CPU utilization for each partition by using the following formula:
BROKER_CPU_UTIL = a * ALL_TOPIC_BYTES_IN_RATE + b * ALL_TOPIC_BYTES_OUT_RATE + c * ALL_FOLLOWER_BYTES_IN_RATE
LEADER_PARTITION_CPU_UTIL = a * LEADER_PARTITION_BYTES_IN + b * LEADER_PARTITION_BYTES_OUT
FOLLOWER_PARTITION_CPU_UTIL = c * LEADER_PARTITION_BYTES_IN
Kafka Cruise Control needs to know the parameters of a, b and c for cost evaluation of leader and partition movement.
getSamples
in interface MetricSampler
cluster
- the metadata of the cluster.assignedPartitions
- the topic partitionstartTimeMs
- the start time of the sampling period - any meetric should have a timestamp at or after this (inclusive).endTimeMs
- the end time of the sampling period - any metric should have a timestamp at or before this (inclusive).public void configure(Map<String,?> configs)
CruiseControlConfigurable
configure
in interface CruiseControlConfigurable
public static void checkStartupCondition(KafkaCruiseControlConfig config, Semaphore abortStartupCheck)
CruiseControlComponent
is satisfied.public void close()
close
in interface AutoCloseable