pvary commented on a change in pull request #691: HIVE-21911: Pluggable
LlapMetricsListener on Tez side to disable / resize Daemons
URL: https://github.com/apache/hive/pull/691#discussion_r298962751
##########
File path:
llap-tez/src/java/org/apache/hadoop/hive/llap/tezplugins/metrics/LlapMetricsCollector.java
##########
@@ -58,26 +61,44 @@
private final Map<String, LlapManagementProtocolClientImpl> llapClients;
private final Map<String, LlapMetrics> instanceStatisticsMap;
private final long metricsCollectionMs;
+ @VisibleForTesting
+ final LlapMetricsListener listener;
- public LlapMetricsCollector(Configuration conf) {
+ public LlapMetricsCollector(Configuration conf, LlapRegistryService
registry) {
this(
conf,
Executors.newSingleThreadScheduledExecutor(
new
ThreadFactoryBuilder().setDaemon(true).setNameFormat(THREAD_NAME)
.build()),
- LlapManagementProtocolClientImplFactory.basicInstance(conf));
+ LlapManagementProtocolClientImplFactory.basicInstance(conf),
+ registry);
}
@VisibleForTesting
LlapMetricsCollector(Configuration conf, ScheduledExecutorService
scheduledMetricsExecutor,
- LlapManagementProtocolClientImplFactory clientFactory) {
+ LlapManagementProtocolClientImplFactory clientFactory,
+ LlapRegistryService registry) {
this.scheduledMetricsExecutor = scheduledMetricsExecutor;
this.clientFactory = clientFactory;
this.llapClients = new HashMap<>();
this.instanceStatisticsMap = new ConcurrentHashMap<>();
this.metricsCollectionMs = HiveConf.getTimeVar(conf,
HiveConf.ConfVars.LLAP_TASK_SCHEDULER_AM_COLLECT_DAEMON_METRICS_MS,
TimeUnit.MILLISECONDS);
+ String listenerClass = HiveConf.getVar(conf,
+
HiveConf.ConfVars.LLAP_TASK_SCHEDULER_AM_COLLECT_DAEMON_METRICS_LISTENER);
+ if (Strings.isBlank(listenerClass)) {
+ listener = null;
+ } else {
+ try {
+ listener =
(LlapMetricsListener)Class.forName(listenerClass.trim()).newInstance();
Review comment:
After some thought I decided against it.
ReflectionUtil is specifically designed to create instances where a
Configuration object is the only one needed when instantiating the object. Here
we need an LlapRegistryService too. Adding 2 methods setConf, setRegistry and
defining the order and so on would result in a code more complicated/harder to
understand than the current one.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]