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 2020/08/09 09:10:41 UTC

[GitHub] [skywalking] wu-sheng commented on a change in pull request #5269: Support !=, like filter expressions in OAL

wu-sheng commented on a change in pull request #5269:
URL: https://github.com/apache/skywalking/pull/5269#discussion_r467558196



##########
File path: oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/rt/parser/MetricsHolder.java
##########
@@ -26,10 +26,19 @@
 import org.apache.skywalking.oap.server.core.analysis.metrics.Metrics;
 import org.apache.skywalking.oap.server.core.analysis.metrics.annotation.MetricsFunction;
 
+@SuppressWarnings("UnstableApiUsage")
 public class MetricsHolder {
-    private static Map<String, Class<? extends Metrics>> REGISTER = new HashMap<>();
+    private static final Map<String, Class<? extends Metrics>> REGISTER = new HashMap<>();
 
-    public static void init() throws IOException {
+    static {
+        try {
+            init();
+        } catch (IOException e) {
+            throw new RuntimeException("load metrics functions error.", e);
+        }
+    }

Review comment:
       Please make this as lazy initialization in the `#find` method. The static block is not recommended.




----------------------------------------------------------------
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:
users@infra.apache.org