You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/04/07 15:11:29 UTC

[GitHub] [flink-kubernetes-operator] SteNicholas opened a new pull request, #160: [FLINK-27124] Flink Kubernetes operator prints starting logs with wrong version

SteNicholas opened a new pull request, #160:
URL: https://github.com/apache/flink-kubernetes-operator/pull/160

   ```
   2022-04-07 11:48:01,357 o.a.f.k.o.FlinkOperator       [INFO ]  Starting Flink Kubernetes Operator (Version: 1.14.4, Scala: 2.12, Rev:895c609, Date:2022-02-25T11:57:14+01:00) 
   ```
   The version information in `FlinkOperator` and `FlinkOperatorWebhook` come from Flink binary, not the flink-kubernetes-operator.
   
   **The brief change log**
   
   -` EnvUtils` adds the `logEnvironmentInfo` method to log information about the environment, like project version, code revision, current user, Java version, and JVM parameters.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-kubernetes-operator] wangyang0918 commented on a diff in pull request #160: [FLINK-27124] Flink Kubernetes operator prints starting logs with wrong version

Posted by GitBox <gi...@apache.org>.
wangyang0918 commented on code in PR #160:
URL: https://github.com/apache/flink-kubernetes-operator/pull/160#discussion_r848326257


##########
flink-kubernetes-operator/pom.xml:
##########
@@ -282,6 +293,35 @@ under the License.
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <!-- Description: https://github.com/git-commit-id/git-commit-id-maven-plugin
+                    Used to show the git ref when starting the jobManager. -->

Review Comment:
   ```suggestion
                       Used to show the git ref when starting the Flink Kubernetes operator. -->
   ```



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-kubernetes-operator] wangyang0918 commented on pull request #160: [FLINK-27124] Flink Kubernetes operator prints starting logs with wrong version

Posted by GitBox <gi...@apache.org>.
wangyang0918 commented on PR #160:
URL: https://github.com/apache/flink-kubernetes-operator/pull/160#issuecomment-1101099447

   Merging now.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-kubernetes-operator] wangyang0918 commented on a diff in pull request #160: [FLINK-27124] Flink Kubernetes operator prints starting logs with wrong version

Posted by GitBox <gi...@apache.org>.
wangyang0918 commented on code in PR #160:
URL: https://github.com/apache/flink-kubernetes-operator/pull/160#discussion_r846895737


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/EnvUtils.java:
##########
@@ -68,4 +97,113 @@ public static String getRequired(String key) {
         }
         return value;
     }
+
+    /**
+     * Logs information about the environment, like code revision, current user, Java version, and
+     * JVM parameters.
+     *
+     * @param log The logger to log the information to.
+     * @param componentName The component name to mention in the log.
+     * @param commandLineArgs The arguments accompanying the starting the component.
+     */
+    public static void logEnvironmentInfo(
+            Logger log, String componentName, String[] commandLineArgs) {
+        if (log.isInfoEnabled()) {
+            Properties properties = new Properties();
+            try (InputStream propFile =
+                    EnvUtils.class.getClassLoader().getResourceAsStream(PROP_FILE)) {
+                if (propFile != null) {
+                    properties.load(propFile);
+                }
+            } catch (IOException e) {
+                LOG.info(
+                        "Cannot determine code revision: Unable to read version property file.: {}",
+                        e.getMessage());
+            }
+            String javaHome = System.getenv("JAVA_HOME");
+            String arch = System.getProperty("os.arch");
+            long maxHeapMegabytes = getMaxJvmHeapMemory() >>> 20;
+            log.info(
+                    "--------------------------------------------------------------------------------");
+            log.info(
+                    " Starting "
+                            + componentName
+                            + " (Version: "
+                            + getProperty(properties, "project.version", UNKNOWN)
+                            + ", Flink Version: "
+                            + getVersion()
+                            + ", Scala: "

Review Comment:
   We do not need to print the scala version. The `flink-kubernetes-operator` does not depends any scala classes and we have already excluded the scala dependencies. Also Flink will be scala free in the later version.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-kubernetes-operator] wangyang0918 merged pull request #160: [FLINK-27124] Flink Kubernetes operator prints starting logs with wrong version

Posted by GitBox <gi...@apache.org>.
wangyang0918 merged PR #160:
URL: https://github.com/apache/flink-kubernetes-operator/pull/160


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-kubernetes-operator] SteNicholas commented on pull request #160: [FLINK-27124] Flink Kubernetes operator prints starting logs with wrong version

Posted by GitBox <gi...@apache.org>.
SteNicholas commented on PR #160:
URL: https://github.com/apache/flink-kubernetes-operator/pull/160#issuecomment-1100930998

   @wangyang0918, I have added the `.git` directory to Dockerfile and exclude directory of `apache-rat-plugin`. In addition, I have manual verified. PTAL. 


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-kubernetes-operator] wangyang0918 commented on a diff in pull request #160: [FLINK-27124] Flink Kubernetes operator prints starting logs with wrong version

Posted by GitBox <gi...@apache.org>.
wangyang0918 commented on code in PR #160:
URL: https://github.com/apache/flink-kubernetes-operator/pull/160#discussion_r845685451


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/EnvUtils.java:
##########
@@ -68,4 +90,102 @@ public static String getRequired(String key) {
         }
         return value;
     }
+
+    /**
+     * Logs information about the environment, like code revision, current user, Java version, and
+     * JVM parameters.
+     *
+     * @param log The logger to log the information to.
+     * @param componentName The component name to mention in the log.
+     * @param commandLineArgs The arguments accompanying the starting the component.
+     */
+    public static void logEnvironmentInfo(
+            Logger log, String componentName, String[] commandLineArgs) {
+        if (log.isInfoEnabled()) {
+            EnvironmentInformation.RevisionInformation rev = getRevisionInformation();
+            String javaHome = System.getenv("JAVA_HOME");
+            String inheritedLogs = System.getenv("FLINK_INHERITED_LOGS");
+            String arch = System.getProperty("os.arch");
+            long maxHeapMegabytes = getMaxJvmHeapMemory() >>> 20;
+            if (inheritedLogs != null) {
+                log.info(
+                        "--------------------------------------------------------------------------------");
+                log.info(" Preconfiguration: ");
+                log.info(inheritedLogs);
+            }
+            log.info(
+                    "--------------------------------------------------------------------------------");
+            log.info(
+                    " Starting "
+                            + componentName
+                            + " (Version: "
+                            + getProjectVersion()
+                            + ", Flink Version: "
+                            + getVersion()
+                            + ", Scala: "
+                            + getScalaVersion()
+                            + ", "
+                            + "Rev:"
+                            + rev.commitId
+                            + ", "
+                            + "Date:"
+                            + rev.commitDate
+                            + ")");
+            log.info(" OS current user: " + System.getProperty("user.name"));
+            log.info(" Current Hadoop/Kerberos user: " + getHadoopUser());
+            log.info(" JVM: " + getJvmVersion());
+            log.info(" Arch: " + arch);
+            log.info(" Maximum heap size: " + maxHeapMegabytes + " MiBytes");
+            log.info(" JAVA_HOME: " + (javaHome == null ? "(not set)" : javaHome));
+            String hadoopVersionString = getHadoopVersionString();

Review Comment:
   We do not need the hadoop related information.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-kubernetes-operator] wangyang0918 commented on a diff in pull request #160: [FLINK-27124] Flink Kubernetes operator prints starting logs with wrong version

Posted by GitBox <gi...@apache.org>.
wangyang0918 commented on code in PR #160:
URL: https://github.com/apache/flink-kubernetes-operator/pull/160#discussion_r845685451


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/EnvUtils.java:
##########
@@ -68,4 +90,102 @@ public static String getRequired(String key) {
         }
         return value;
     }
+
+    /**
+     * Logs information about the environment, like code revision, current user, Java version, and
+     * JVM parameters.
+     *
+     * @param log The logger to log the information to.
+     * @param componentName The component name to mention in the log.
+     * @param commandLineArgs The arguments accompanying the starting the component.
+     */
+    public static void logEnvironmentInfo(
+            Logger log, String componentName, String[] commandLineArgs) {
+        if (log.isInfoEnabled()) {
+            EnvironmentInformation.RevisionInformation rev = getRevisionInformation();
+            String javaHome = System.getenv("JAVA_HOME");
+            String inheritedLogs = System.getenv("FLINK_INHERITED_LOGS");
+            String arch = System.getProperty("os.arch");
+            long maxHeapMegabytes = getMaxJvmHeapMemory() >>> 20;
+            if (inheritedLogs != null) {
+                log.info(
+                        "--------------------------------------------------------------------------------");
+                log.info(" Preconfiguration: ");
+                log.info(inheritedLogs);
+            }
+            log.info(
+                    "--------------------------------------------------------------------------------");
+            log.info(
+                    " Starting "
+                            + componentName
+                            + " (Version: "
+                            + getProjectVersion()
+                            + ", Flink Version: "
+                            + getVersion()
+                            + ", Scala: "
+                            + getScalaVersion()
+                            + ", "
+                            + "Rev:"
+                            + rev.commitId
+                            + ", "
+                            + "Date:"
+                            + rev.commitDate
+                            + ")");
+            log.info(" OS current user: " + System.getProperty("user.name"));
+            log.info(" Current Hadoop/Kerberos user: " + getHadoopUser());
+            log.info(" JVM: " + getJvmVersion());
+            log.info(" Arch: " + arch);
+            log.info(" Maximum heap size: " + maxHeapMegabytes + " MiBytes");
+            log.info(" JAVA_HOME: " + (javaHome == null ? "(not set)" : javaHome));
+            String hadoopVersionString = getHadoopVersionString();

Review Comment:
   We do need the hadoop related information.



##########
flink-kubernetes-operator/src/main/resources-filtered/.flink-kubernetes-operator.version.properties:
##########
@@ -0,0 +1,16 @@
+# 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.
+
+project.version=${project.version}

Review Comment:
   Could we also add some git commit information here and print them in the logs?



##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/EnvUtils.java:
##########
@@ -68,4 +90,102 @@ public static String getRequired(String key) {
         }
         return value;
     }
+
+    /**
+     * Logs information about the environment, like code revision, current user, Java version, and
+     * JVM parameters.
+     *
+     * @param log The logger to log the information to.
+     * @param componentName The component name to mention in the log.
+     * @param commandLineArgs The arguments accompanying the starting the component.
+     */
+    public static void logEnvironmentInfo(
+            Logger log, String componentName, String[] commandLineArgs) {
+        if (log.isInfoEnabled()) {
+            EnvironmentInformation.RevisionInformation rev = getRevisionInformation();

Review Comment:
   I am afraid we still could not get the git revision information correctly.



##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/EnvUtils.java:
##########
@@ -68,4 +90,102 @@ public static String getRequired(String key) {
         }
         return value;
     }
+
+    /**
+     * Logs information about the environment, like code revision, current user, Java version, and
+     * JVM parameters.
+     *
+     * @param log The logger to log the information to.
+     * @param componentName The component name to mention in the log.
+     * @param commandLineArgs The arguments accompanying the starting the component.
+     */
+    public static void logEnvironmentInfo(
+            Logger log, String componentName, String[] commandLineArgs) {
+        if (log.isInfoEnabled()) {
+            EnvironmentInformation.RevisionInformation rev = getRevisionInformation();
+            String javaHome = System.getenv("JAVA_HOME");
+            String inheritedLogs = System.getenv("FLINK_INHERITED_LOGS");

Review Comment:
   We also do not need the `FLINK_INHERITED_LOGS` since we will never configure it.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-kubernetes-operator] SteNicholas commented on pull request #160: [FLINK-27124] Flink Kubernetes operator prints starting logs with wrong version

Posted by GitBox <gi...@apache.org>.
SteNicholas commented on PR #160:
URL: https://github.com/apache/flink-kubernetes-operator/pull/160#issuecomment-1092563040

   @wangyang0918, thanks for your detailed review. I have addressed above comments. PTAL.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org