You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2023/02/07 03:40:39 UTC

[skywalking] branch master updated: Update comments a little more for Scope in query. (#10355)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new b4341bb603 Update comments a little more for Scope in query. (#10355)
b4341bb603 is described below

commit b4341bb603c9818bc4d8820f6eaf0b5c21c80c15
Author: 吴晟 Wu Sheng <wu...@foxmail.com>
AuthorDate: Tue Feb 7 11:40:32 2023 +0800

    Update comments a little more for Scope in query. (#10355)
---
 .../skywalking/oap/server/core/query/enumeration/Scope.java    |  5 +++--
 .../skywalking/oap/server/core/source/DefaultScopeDefine.java  |  2 +-
 .../skywalking/oap/server/core/source/ScopeDeclaration.java    | 10 +++++++++-
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/enumeration/Scope.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/enumeration/Scope.java
index e05b60c1f1..e74dc83d8f 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/enumeration/Scope.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/enumeration/Scope.java
@@ -31,9 +31,10 @@ import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.in
 import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.inServiceRelationCatalog;
 
 /**
- * Scope n query stage represents the scope catalog. All scopes with their catalogs are defined in {@link DefaultScopeDefine}.
+ * Scope in query stage represents the scope catalog. All scopes with their catalogs are defined in
+ * {@link DefaultScopeDefine}.
  * Scope IDs could be various due to different OAL/MAL input.
- * Scope catalog provides high dimension classification for all scopes as a hierarchy structure.
+ * Scope catalog provides high dimension classifications for all scopes as a hierarchy structure.
  */
 public enum Scope {
     /**
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DefaultScopeDefine.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DefaultScopeDefine.java
index 9b47583caa..17364211f3 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DefaultScopeDefine.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DefaultScopeDefine.java
@@ -175,7 +175,7 @@ public class DefaultScopeDefine {
      * @param declaration   includes the definition.
      * @param originalClass represents the class having the {@link ScopeDeclaration} annotation
      */
-    private static final void addNewScope(ScopeDeclaration declaration, Class originalClass) {
+    private static void addNewScope(ScopeDeclaration declaration, Class originalClass) {
         int id = declaration.id();
         if (ID_2_NAME.containsKey(id)) {
             throw new UnexpectedException(
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ScopeDeclaration.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ScopeDeclaration.java
index a8d9f874a6..10a68baae2 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ScopeDeclaration.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ScopeDeclaration.java
@@ -23,6 +23,7 @@ import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 import org.apache.skywalking.oap.server.core.profiling.trace.ProfileTaskRecord;
+import org.apache.skywalking.oap.server.core.query.enumeration.Scope;
 
 /**
  * ScopeDeclaration includes
@@ -32,7 +33,7 @@ import org.apache.skywalking.oap.server.core.profiling.trace.ProfileTaskRecord;
  * service_resp_time = from(Service.latency).longAvg();
  *
  * 2. Manual source such as {@link Segment}
- * 
+ *
  * 3. None stream entity like {@link ProfileTaskRecord}.
  *
  * NOTICE, in OAL script, `disable` is for stream, rather than source, it doesn't require this annotation.
@@ -40,9 +41,16 @@ import org.apache.skywalking.oap.server.core.profiling.trace.ProfileTaskRecord;
 @Target({ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
 public @interface ScopeDeclaration {
+    /**
+     * @return the scope ID defined in {@link DefaultScopeDefine}
+     */
     int id();
 
     String name();
 
+    /**
+     * @return The scope name of the top scopes, which are defined in {@link Scope}. Keep in an empty string when the
+     * scope is not a metric, or its generated metrics don't suppose to support alerting.
+     */
     String catalog() default "";
 }