[ https://issues.apache.org/jira/browse/HIVE-21911?focusedWorklogId=270059&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-270059 ]
ASF GitHub Bot logged work on HIVE-21911: ----------------------------------------- Author: ASF GitHub Bot Created on: 01/Jul/19 09:45 Start Date: 01/Jul/19 09:45 Worklog Time Spent: 10m Work Description: pvary commented on 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: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 270059) Time Spent: 1h 20m (was: 1h 10m) > Pluggable LlapMetricsListener on Tez side to disable / resize Daemons > --------------------------------------------------------------------- > > Key: HIVE-21911 > URL: https://issues.apache.org/jira/browse/HIVE-21911 > Project: Hive > Issue Type: Sub-task > Components: llap, Tez > Reporter: Peter Vary > Assignee: Peter Vary > Priority: Major > Labels: pull-request-available > Attachments: HIVE-21911.patch > > Time Spent: 1h 20m > Remaining Estimate: 0h > > We need to have a way to plug in different listeners which act upon the > LlapDaemon statistics. > This listener should be able to disable / resize the LlapDaemons based on > health data. -- This message was sent by Atlassian JIRA (v7.6.3#76005)