You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/10/26 03:16:35 UTC

[GitHub] [skywalking] kezhenxu94 opened a new pull request #8004: Add a GraphQL query to get OAP version, display OAP version in startup message and error logs

kezhenxu94 opened a new pull request #8004:
URL: https://github.com/apache/skywalking/pull/8004


   
   
   <!--
       ⚠️ Please make sure to read this template first, pull requests that don't accord with this template
       maybe closed without notice.
       Texts surrounded by `<` and `>` are meant to be replaced by you, e.g. <framework name>, <issue number>.
       Put an `x` in the `[ ]` to mark the item as CHECKED. `[x]`
   -->
   
   <!-- ==== 🐛 Remove this line WHEN AND ONLY WHEN you're fixing a bug, follow the checklist 👇 ====
   ### Fix <bug description or the bug issue number or bug issue link>
   - [ ] Add a unit test to verify that the fix works.
   - [ ] Explain briefly why the bug exists and how to fix it.
        ==== 🐛 Remove this line WHEN AND ONLY WHEN you're fixing a bug, follow the checklist 👆 ==== -->
   
   <!-- ==== 📈 Remove this line WHEN AND ONLY WHEN you're improving the performance, follow the checklist 👇 ====
   ### Improve the performance of <class or module or ...>
   - [ ] Add a benchmark for the improvement, refer to [the existing ones](https://github.com/apache/skywalking/blob/master/apm-commons/apm-datacarrier/src/test/java/org/apache/skywalking/apm/commons/datacarrier/LinkedArrayBenchmark.java)
   - [ ] The benchmark result.
   ```text
   <Paste the benchmark results here>
   ```
   - [ ] Links/URLs to the theory proof or discussion articles/blogs. <links/URLs here>
        ==== 📈 Remove this line WHEN AND ONLY WHEN you're improving the performance, follow the checklist 👆 ==== -->
   
   <!-- ==== 🆕 Remove this line WHEN AND ONLY WHEN you're adding a new feature, follow the checklist 👇 ====
   ### <Feature description>
   - [ ] If this is non-trivial feature, paste the links/URLs to the design doc.
   - [ ] Update the documentation to include this new feature.
   - [ ] Tests(including UT, IT, E2E) are added to verify the new feature.
   - [ ] If it's UI related, attach the screenshots below.
        ==== 🆕 Remove this line WHEN AND ONLY WHEN you're adding a new feature, follow the checklist 👆 ==== -->
   
   - [x] If this pull request closes/resolves/fixes an existing issue, replace the issue number. Related to #7931 (UI part is left to @Fine0830 ).
   - [x] Update the [`CHANGES` log](https://github.com/apache/skywalking/blob/master/CHANGES.md).
   


-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] kezhenxu94 commented on pull request #8004: Add a GraphQL query to get OAP version, display OAP version in startup message and error logs

Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on pull request #8004:
URL: https://github.com/apache/skywalking/pull/8004#issuecomment-951619488


   > > The version format is `projectVersion-gitSha (buildTime)` such as `8.9.0-abcdefg (202110261213)`
   > 
   > 
   > 
   > For dev version, it would be `8.9.0-SNAPSHOT-xxxx (yyyyy)`, right?
   
   Yes exactly. The version 8.9.0-SNAPSHOT is from pom.xml. 


-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] kezhenxu94 commented on a change in pull request #8004: Add a GraphQL query to get OAP version, display OAP version in startup message and error logs

Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #8004:
URL: https://github.com/apache/skywalking/pull/8004#discussion_r736208085



##########
File path: oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/version/Version.java
##########
@@ -0,0 +1,57 @@
+/*
+ * 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.skywalking.oap.server.core.version;
+
+import java.io.IOException;
+import java.util.Properties;
+import lombok.Getter;
+import org.apache.logging.log4j.util.Strings;
+
+@Getter
+public enum Version {
+    CURRENT;
+
+    private final String buildVersion;
+    private final String buildTime;
+    private final String commitId;
+
+    private final Properties properties = new Properties();
+
+    Version() {
+        try {
+            properties.load(Version.class.getClassLoader()
+                                         .getResourceAsStream("version.properties"));
+            buildVersion = properties.getProperty("git.build.version");
+            buildTime = properties.getProperty("git.build.time");
+            commitId = properties.getProperty("git.commit.id");
+        } catch (IOException e) {
+            throw new ExceptionInInitializerError(e);
+        }
+    }
+
+    @Override
+    public String toString() {
+        return String.format(
+            "%s-%s (%s)",
+            buildVersion,
+            Strings.left(commitId, 7),
+            buildTime

Review comment:
       Yes. The `commit id` is retrieved from the version control system (`.git` in our case) with maven plugin but we only release the source codes without version control when releasing, we need a static file containing these version information when users build themselves from this source tar




-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] kezhenxu94 commented on pull request #8004: Add a GraphQL query to get OAP version, display OAP version in startup message and error logs

Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on pull request #8004:
URL: https://github.com/apache/skywalking/pull/8004#issuecomment-951616451


   The version format is `projectVersion-gitSha (buildTime)` such as `8.9.0-abcdefg (202110261213)`


-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] wu-sheng commented on a change in pull request #8004: Add a GraphQL query to get OAP version, display OAP version in startup message and error logs

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #8004:
URL: https://github.com/apache/skywalking/pull/8004#discussion_r736205734



##########
File path: oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/Query.java
##########
@@ -19,10 +19,12 @@
 package org.apache.skywalking.oap.query.graphql.resolver;
 
 import com.coxautodev.graphql.tools.GraphQLQueryResolver;
+import org.apache.skywalking.oap.server.core.version.Version;
 
 /**
  * Root Query Resolver.
  */
 public class Query implements GraphQLQueryResolver {
-    private String version = "8.0";
+    @SuppressWarnings("unused") // Used in GraphQL query
+    private final String version = Version.CURRENT.toString();

Review comment:
       Is this showing up in GraphQL 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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] kezhenxu94 commented on a change in pull request #8004: Add a GraphQL query to get OAP version, display OAP version in startup message and error logs

Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #8004:
URL: https://github.com/apache/skywalking/pull/8004#discussion_r736206507



##########
File path: oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/Query.java
##########
@@ -19,10 +19,12 @@
 package org.apache.skywalking.oap.query.graphql.resolver;
 
 import com.coxautodev.graphql.tools.GraphQLQueryResolver;
+import org.apache.skywalking.oap.server.core.version.Version;
 
 /**
  * Root Query Resolver.
  */
 public class Query implements GraphQLQueryResolver {
-    private String version = "8.0";
+    @SuppressWarnings("unused") // Used in GraphQL query
+    private final String version = Version.CURRENT.toString();

Review comment:
       Yes. Using graphql query `getVersion` will return this value 




-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] wu-sheng commented on pull request #8004: Add a GraphQL query to get OAP version, display OAP version in startup message and error logs

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on pull request #8004:
URL: https://github.com/apache/skywalking/pull/8004#issuecomment-951617155


   > The version format is `projectVersion-gitSha (buildTime)` such as `8.9.0-abcdefg (202110261213)`
   
   For dev version, it would be `8.9.0-SNAPSHOT-xxxx (yyyyy)`, right?


-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] wu-sheng merged pull request #8004: Add a GraphQL query to get OAP version, display OAP version in startup message and error logs

Posted by GitBox <gi...@apache.org>.
wu-sheng merged pull request #8004:
URL: https://github.com/apache/skywalking/pull/8004


   


-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] wu-sheng commented on a change in pull request #8004: Add a GraphQL query to get OAP version, display OAP version in startup message and error logs

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #8004:
URL: https://github.com/apache/skywalking/pull/8004#discussion_r736204670



##########
File path: oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/version/Version.java
##########
@@ -0,0 +1,57 @@
+/*
+ * 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.skywalking.oap.server.core.version;
+
+import java.io.IOException;
+import java.util.Properties;
+import lombok.Getter;
+import org.apache.logging.log4j.util.Strings;
+
+@Getter
+public enum Version {
+    CURRENT;
+
+    private final String buildVersion;
+    private final String buildTime;
+    private final String commitId;
+
+    private final Properties properties = new Properties();
+
+    Version() {
+        try {
+            properties.load(Version.class.getClassLoader()
+                                         .getResourceAsStream("version.properties"));
+            buildVersion = properties.getProperty("git.build.version");
+            buildTime = properties.getProperty("git.build.time");
+            commitId = properties.getProperty("git.commit.id");
+        } catch (IOException e) {
+            throw new ExceptionInInitializerError(e);
+        }
+    }
+
+    @Override
+    public String toString() {
+        return String.format(
+            "%s-%s (%s)",
+            buildVersion,
+            Strings.left(commitId, 7),
+            buildTime

Review comment:
       So, the version is always `version-commitid (timstamp)`, right?
   
   I have seen you changed `create_source_release.sh` to build a static file.




-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] wu-sheng commented on pull request #8004: Add a GraphQL query to get OAP version, display OAP version in startup message and error logs

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on pull request #8004:
URL: https://github.com/apache/skywalking/pull/8004#issuecomment-951623719


   @Fine0830 Let's show the version on the UI. It is dynamic updated from backend 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: notifications-unsubscribe@skywalking.apache.org

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