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/03/09 03:57:42 UTC

[GitHub] [skywalking] kezhenxu94 commented on a change in pull request #6499: [Incompatible Enhancement]New index policy of ElasticSearch storage option

kezhenxu94 commented on a change in pull request #6499:
URL: https://github.com/apache/skywalking/pull/6499#discussion_r589305849



##########
File path: oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/StorageModuleElasticsearchProvider.java
##########
@@ -87,10 +88,12 @@
 /**
  * The storage provider for ElasticSearch 6.
  */
+@Slf4j
 public class StorageModuleElasticsearchProvider extends ModuleProvider {
 
     protected final StorageModuleElasticsearchConfig config;
     protected ElasticSearchClient elasticSearchClient;
+    private StorageEsInstaller storageEsInstaller;

Review comment:
       Unused

##########
File path: oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/FunctionCategory.java
##########
@@ -0,0 +1,63 @@
+/*
+ * 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.analysis;
+
+import java.lang.annotation.Annotation;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.apache.skywalking.oap.server.core.Const;
+import org.apache.skywalking.oap.server.core.analysis.meter.function.MeterFunction;
+import org.apache.skywalking.oap.server.core.analysis.metrics.annotation.MetricsFunction;
+
+@AllArgsConstructor
+@Getter
+public enum FunctionCategory {
+    METER("meter", MeterFunction.class),
+    METRICS("metrics", MetricsFunction.class);
+    private final String name;
+    private final Class<? extends Annotation> annotationClass;
+
+    /**
+     * The unique function name pattern is {function category}-{function name}.
+     */
+    public static String uniqueFunctionName(final Class<?> aClass) {
+        Annotation annotation = doGetAnnotation(aClass, MeterFunction.class);
+        if (annotation != null) {
+            return (METER.getName() + Const.LINE + ((MeterFunction) annotation).functionName()).toLowerCase();
+        }
+        annotation = doGetAnnotation(aClass, MetricsFunction.class);
+        if (annotation != null) {
+            return (METRICS.getName() + Const.LINE + ((MetricsFunction) annotation).functionName()).toLowerCase();
+        }
+        return "";
+    }
+
+    public static Annotation doGetAnnotation(Class<?> clazz, Class<? extends Annotation> annotationClass) {

Review comment:
       Consider annotating `MeterFunction` and `MetricsFunction` with `java.lang.annotation.Inherited`, and use `java.lang.Class#getAnnotation(Class<A> annotationClass)` to get the exact annotation without listing all and doing recursive lookup




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