pvary commented on a change in pull request #698: HIVE-21912: Implement
DisablingDaemonStatisticsHandler
URL: https://github.com/apache/hive/pull/698#discussion_r300300551
##########
File path:
llap-tez/src/java/org/apache/hadoop/hive/llap/tezplugins/metrics/LlapMetricsCollector.java
##########
@@ -210,53 +206,30 @@ public LlapMetrics getMetrics(String workerIdentity) {
return Collections.unmodifiableMap(instanceStatisticsMap);
}
- /**
- * Creates a LlapManagementProtocolClientImpl from a given
LlapServiceInstance.
- */
- public static class LlapManagementProtocolClientImplFactory {
- private final Configuration conf;
- private final RetryPolicy retryPolicy;
- private final SocketFactory socketFactory;
-
- public LlapManagementProtocolClientImplFactory(Configuration conf,
RetryPolicy retryPolicy,
- SocketFactory
socketFactory) {
- this.conf = conf;
- this.retryPolicy = retryPolicy;
- this.socketFactory = socketFactory;
- }
-
- private static LlapManagementProtocolClientImplFactory
basicInstance(Configuration conf) {
- return new LlapManagementProtocolClientImplFactory(
- conf,
- RetryPolicies.retryUpToMaximumCountWithFixedSleep(5, 3000L,
TimeUnit.MILLISECONDS),
- NetUtils.getDefaultSocketFactory(conf));
- }
-
- public LlapManagementProtocolClientImpl create(LlapServiceInstance
serviceInstance) {
- LlapManagementProtocolClientImpl client = new
LlapManagementProtocolClientImpl(conf, serviceInstance.getHost(),
- serviceInstance.getManagementPort(), retryPolicy,
- socketFactory);
- return client;
- }
- }
-
/**
* Stores the metrics retrieved from the llap daemons, along with the
retrieval timestamp.
*/
public static class LlapMetrics {
private final long timestamp;
- private final LlapDaemonProtocolProtos.GetDaemonMetricsResponseProto
metrics;
+ private final Map<String, Long> metrics;
+
+ @VisibleForTesting
+ LlapMetrics(long timestamp, Map<String, Long> metrics) {
+ this.timestamp = timestamp;
+ this.metrics = metrics;
+ }
public LlapMetrics(LlapDaemonProtocolProtos.GetDaemonMetricsResponseProto
metrics) {
this.timestamp = System.currentTimeMillis();
- this.metrics = metrics;
+ this.metrics = new HashMap<String, Long>(metrics.getMetricsCount());
+ metrics.getMetricsList().forEach(entry ->
this.metrics.put(entry.getKey(), entry.getValue()));
}
public long getTimestamp() {
return timestamp;
}
- public LlapDaemonProtocolProtos.GetDaemonMetricsResponseProto getMetrics()
{
+ public Map<String, Long> getMetrics() {
Review comment:
Done
----------------------------------------------------------------
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]