Sanil15 commented on a change in pull request #1402:
URL: https://github.com/apache/samza/pull/1402#discussion_r458299154
##########
File path: samza-core/src/main/java/org/apache/samza/util/Util.java
##########
@@ -123,4 +131,85 @@ private static InetAddress doGetLocalHost() throws
UnknownHostException, SocketE
}
return localHost;
}
+
+ public static String getDeploymentType(Config config) {
+ JobConfig jobConfig = new JobConfig(config);
+ Optional<String> streamJobFactoryClass =
jobConfig.getStreamJobFactoryClass();
+ if (streamJobFactoryClass.isPresent()) {
+ if (streamJobFactoryClass.get().equals(YARN_JOB_FACTORY_CLASS)) {
+ return DeploymentType.YARN.name();
+ } else {
+ return DeploymentType.STANDALONE.name();
+ }
+ }
+ return "NOT_DEFINED";
+ }
+
+ public static String getApiType(Config config) {
+ ApplicationConfig appConfig = new ApplicationConfig(config);
+ String appClass = appConfig.getAppClass();
+ if (appClass == null || appClass.isEmpty()) {
Review comment:
Is this ever true? for legacy task class applications?
##########
File path: samza-core/src/main/java/org/apache/samza/metrics/ApiType.java
##########
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.samza.metrics;
+
+public enum ApiType {
Review comment:
nit: SamzaAPI not a better name?
##########
File path:
samza-core/src/test/java/org/apache/samza/diagnostics/TestDiagnosticsManager.java
##########
@@ -252,7 +264,17 @@ private void validateMetricsHeader(OutgoingMessageEnvelope
outgoingMessageEnvelo
Assert.assertEquals(metricsSnapshot.getHeader().getSamzaVersion(),
samzaVersion);
Assert.assertEquals(metricsSnapshot.getHeader().getHost(), hostname);
Assert.assertEquals(metricsSnapshot.getHeader().getSource(),
DiagnosticsManager.class.getName());
-
Review comment:
nit: revert whitespace change
##########
File path: samza-core/src/main/java/org/apache/samza/util/Util.java
##########
@@ -29,15 +29,23 @@
import java.util.stream.Collectors;
import com.google.common.collect.Lists;
import org.apache.samza.SamzaException;
+import org.apache.samza.application.StreamApplication;
import org.apache.samza.config.ApplicationConfig;
+import org.apache.samza.config.ClusterManagerConfig;
import org.apache.samza.config.Config;
+import org.apache.samza.config.JobConfig;
import org.apache.samza.config.TaskConfig;
+import org.apache.samza.metrics.ApiType;
+import org.apache.samza.metrics.DeploymentType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Util {
Review comment:
Not related to your change but JobInfoUtil is a better name for this
Util class rather than just Util
##########
File path:
samza-core/src/test/java/org/apache/samza/diagnostics/TestDiagnosticsManager.java
##########
@@ -59,6 +59,14 @@
private int numPersistentStores = 2;
private int containerNumCores = 2;
private boolean autosizingEnabled = false;
+ private String deploymentType = "test deployment type";
Review comment:
consider adding valid values for deployType and API type, to unit test
the util functions you just added
----------------------------------------------------------------
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]