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 2021/04/05 09:32:45 UTC

[skywalking] branch fix-disable created (now 2e2083b)

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

wusheng pushed a change to branch fix-disable
in repository https://gitbox.apache.org/repos/asf/skywalking.git.


      at 2e2083b  Fix `disable` statement not working

This branch includes the following new commits:

     new 2e2083b  Fix `disable` statement not working

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[skywalking] 01/01: Fix `disable` statement not working

Posted by wu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 2e2083be30d4481cf003045bc524ae1c02a9b297
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Mon Apr 5 17:31:37 2021 +0800

    Fix `disable` statement not working
---
 CHANGES.md                                         |  5 ++--
 docs/en/concepts-and-designs/oal.md                |  2 ++
 .../src/main/resources/oal/core.oal                | 11 --------
 .../src/main/resources/oal/disable.oal             | 31 ++++++++++++++++++++++
 .../oap/server/core/CoreModuleProvider.java        | 12 ++++++---
 .../oap/server/core/oal/rt/DisableOALDefine.java   | 30 +++++++++++++++++++++
 6 files changed, 74 insertions(+), 17 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 874566c..d4f8efa 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -69,8 +69,9 @@ Release Notes.
 * Add function `retagByK8sMeta` and opt type `K8sRetagType.Pod2Service` in MAL for k8s to relate pods and services.
 * Make the flushing metrics operation concurrent.
 * Fix ALS K8SServiceRegistry didn't remove the correct entry.
-* Using "service.istio.io/canonical-name" to replace "app" label to resolve Envoy ALS service name
-* Append the root slash(/) to getIndex and getTemplate requests in ES client
+* Using "service.istio.io/canonical-name" to replace "app" label to resolve Envoy ALS service name.
+* Append the root slash(/) to getIndex and getTemplate requests in ES client.
+* Fix `disable` statement not working. This bug exists since 8.0.0.
 
 #### UI
 * Update selector scroller to show in all pages.
diff --git a/docs/en/concepts-and-designs/oal.md b/docs/en/concepts-and-designs/oal.md
index 168dc0a..533c79b 100644
--- a/docs/en/concepts-and-designs/oal.md
+++ b/docs/en/concepts-and-designs/oal.md
@@ -101,6 +101,8 @@ Some of the aggregation and metrics are defined through core hard codes. Example
 This `disable` statement is designed to render them inactive.
 By default, none of them are disabled.
 
+**NOTICE**, all disable statements should be in `oal/disable.oal` script file. 
+
 ## Examples
 ```
 // Calculate p99 of both Endpoint1 and Endpoint2
diff --git a/oap-server/server-bootstrap/src/main/resources/oal/core.oal b/oap-server/server-bootstrap/src/main/resources/oal/core.oal
index 48af721..e02934d 100755
--- a/oap-server/server-bootstrap/src/main/resources/oal/core.oal
+++ b/oap-server/server-bootstrap/src/main/resources/oal/core.oal
@@ -68,14 +68,3 @@ database_access_resp_time = from(DatabaseAccess.latency).longAvg();
 database_access_sla = from(DatabaseAccess.*).percent(status == true);
 database_access_cpm = from(DatabaseAccess.*).cpm();
 database_access_percentile = from(DatabaseAccess.latency).percentile(10);
-
-// Disable unnecessary hard core stream, targeting @Stream#name
-/////////
-// disable(segment);
-// disable(endpoint_relation_server_side);
-// disable(top_n_database_statement);
-// disable(zipkin_span);
-// disable(jaeger_span);
-// disable(profile_task);
-// disable(profile_task_log);
-// disable(profile_task_segment_snapshot);
diff --git a/oap-server/server-bootstrap/src/main/resources/oal/disable.oal b/oap-server/server-bootstrap/src/main/resources/oal/disable.oal
new file mode 100644
index 0000000..fdaad52
--- /dev/null
+++ b/oap-server/server-bootstrap/src/main/resources/oal/disable.oal
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ *
+ */
+
+///////////////////////////////////////////////////////////////
+//
+// Disable unnecessary hard core stream, targeting @Stream#name
+//
+///////////////////////////////////////////////////////////////
+// disable(segment);
+// disable(endpoint_relation_server_side);
+// disable(top_n_database_statement);
+// disable(zipkin_span);
+// disable(jaeger_span);
+// disable(profile_task);
+// disable(profile_task_log);
+// disable(profile_task_segment_snapshot);
\ No newline at end of file
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java
index 18d5ec4..3892989 100755
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java
@@ -50,6 +50,7 @@ import org.apache.skywalking.oap.server.core.config.group.EndpointNameGrouping;
 import org.apache.skywalking.oap.server.core.config.group.EndpointNameGroupingRuleWatcher;
 import org.apache.skywalking.oap.server.core.management.ui.template.UITemplateInitializer;
 import org.apache.skywalking.oap.server.core.management.ui.template.UITemplateManagementService;
+import org.apache.skywalking.oap.server.core.oal.rt.DisableOALDefine;
 import org.apache.skywalking.oap.server.core.oal.rt.OALEngineLoaderService;
 import org.apache.skywalking.oap.server.core.profile.ProfileTaskMutationService;
 import org.apache.skywalking.oap.server.core.query.AggregationQueryService;
@@ -118,6 +119,7 @@ public class CoreModuleProvider extends ModuleProvider {
     private final SourceReceiverImpl receiver;
     private ApdexThresholdConfig apdexThresholdConfig;
     private EndpointNameGroupingRuleWatcher endpointNameGroupingRuleWatcher;
+    private OALEngineLoaderService oalEngineLoaderService;
 
     public CoreModuleProvider() {
         super();
@@ -161,8 +163,6 @@ public class CoreModuleProvider extends ModuleProvider {
             throw new ModuleStartException(e.getMessage(), e);
         }
 
-        StreamAnnotationListener streamAnnotationListener = new StreamAnnotationListener(getManager());
-
         AnnotationScan scopeScan = new AnnotationScan();
         scopeScan.registerListener(new DefaultScopeDefine.Listener());
         try {
@@ -264,9 +264,10 @@ public class CoreModuleProvider extends ModuleProvider {
         this.registerServiceImplementation(CommandService.class, new CommandService(getManager()));
 
         // add oal engine loader service implementations
-        this.registerServiceImplementation(OALEngineLoaderService.class, new OALEngineLoaderService(getManager()));
+        oalEngineLoaderService = new OALEngineLoaderService(getManager());
+        this.registerServiceImplementation(OALEngineLoaderService.class, oalEngineLoaderService);
 
-        annotationScan.registerListener(streamAnnotationListener);
+        annotationScan.registerListener(new StreamAnnotationListener(getManager()));
 
         if (moduleConfig.isGRPCSslEnabled()) {
             this.remoteClientManager = new RemoteClientManager(getManager(), moduleConfig.getRemoteTimeout(),
@@ -293,6 +294,9 @@ public class CoreModuleProvider extends ModuleProvider {
         grpcServer.addHandler(new HealthCheckServiceHandler());
         remoteClientManager.start();
 
+        // Disable OAL script has higher priority
+        oalEngineLoaderService.load(DisableOALDefine.INSTANCE);
+
         try {
             receiver.scan();
             annotationScan.scan();
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/oal/rt/DisableOALDefine.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/oal/rt/DisableOALDefine.java
new file mode 100644
index 0000000..b5f6438
--- /dev/null
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/oal/rt/DisableOALDefine.java
@@ -0,0 +1,30 @@
+/*
+ * 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.oal.rt;
+
+public class DisableOALDefine extends OALDefine {
+    public static final DisableOALDefine INSTANCE = new DisableOALDefine();
+
+    private DisableOALDefine() {
+        super(
+            "oal/disable.oal",
+            "org.apache.skywalking.oap.server.core.source"
+        );
+    }
+}