public class LoadMonitorTaskRunner extends Object
Modifier and Type | Class and Description |
---|---|
static class |
LoadMonitorTaskRunner.LoadMonitorTaskRunnerState
A simple state machine denoting the state of the task runner.
|
static class |
LoadMonitorTaskRunner.NextSamplingStep |
static class |
LoadMonitorTaskRunner.NextWindowStep |
class |
LoadMonitorTaskRunner.SamplingStep |
static class |
LoadMonitorTaskRunner.WindowSamplingInstruction |
Modifier and Type | Field and Description |
---|---|
static Duration |
SAMPLING_ERROR_BACKOFF_DURATION |
static String |
SAMPLING_LOOP_FAILURE_RATE_METRIC_NAME |
static String |
SAMPLING_LOOP_SKIPPED_RATE_METRIC_NAME |
static String |
SAMPLING_LOOP_SUCCESS_RATE_METRIC_NAME |
Constructor and Description |
---|
LoadMonitorTaskRunner(KafkaCruiseControlConfig config,
KafkaReplicaMetricSampleAggregator replicaMetricSampleAggregator,
KafkaPartitionMetricSampleAggregator partitionMetricSampleAggregator,
MetadataClient metadataClient,
org.apache.kafka.common.utils.Time time,
DataBalancerMetricsRegistry metricRegistry,
BrokerCapacityConfigResolver brokerCapacityConfigResolver)
Private constructor to avoid duplicate code.
|
Modifier and Type | Method and Description |
---|---|
boolean |
awaitingPauseSampling()
Allow tasks to know if another thread, e.g.
|
void |
pauseSampling(String reason)
Pause the scheduled sampling task.
|
String |
reasonOfLatestPauseOrResume() |
void |
resumeSampling(String reason)
Resume the scheduled sampling tasks.
|
void |
shutdown()
Shutdown the task runner.
|
void |
start()
Start the metric fetchers and sampling scheduler thread.
|
LoadMonitorTaskRunner.LoadMonitorTaskRunnerState |
state()
Get the state of the task runner.
|
public static final String SAMPLING_LOOP_FAILURE_RATE_METRIC_NAME
public static final String SAMPLING_LOOP_SUCCESS_RATE_METRIC_NAME
public static final String SAMPLING_LOOP_SKIPPED_RATE_METRIC_NAME
public static final Duration SAMPLING_ERROR_BACKOFF_DURATION
public LoadMonitorTaskRunner(KafkaCruiseControlConfig config, KafkaReplicaMetricSampleAggregator replicaMetricSampleAggregator, KafkaPartitionMetricSampleAggregator partitionMetricSampleAggregator, MetadataClient metadataClient, org.apache.kafka.common.utils.Time time, DataBalancerMetricsRegistry metricRegistry, BrokerCapacityConfigResolver brokerCapacityConfigResolver)
config
- The load monitor configurations.partitionMetricSampleAggregator
- The KafkaPartitionMetricSampleAggregator
to aggregate partition metrics.metadataClient
- The metadata of the cluster.time
- The time object.metricRegistry
- The metric registry that holds all the metrics for monitoring Cruise Control.brokerCapacityConfigResolver
- The resolver for retrieving broker capacities.public LoadMonitorTaskRunner.LoadMonitorTaskRunnerState state()
public void start()
public void shutdown()
public void pauseSampling(String reason)
awaitingPauseSampling()
flag is set to let other threads know of the intention to pause.reason
- The reason for pausing metric sampling.public void resumeSampling(String reason)
reason
- The reason for resuming metric sampling.public String reasonOfLatestPauseOrResume()
public boolean awaitingPauseSampling()