diff --git a/CHANGES.md b/CHANGES.md index 874566c14a25d11e220db71c0e40cc32d4c2bee6..d4f8efa8d4e295c63161bdc851cd3fe9d247ea6f 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 168dc0aecf5471f23b39fc7425f6fbe1c9129f7f..533c79b3c3ce62c3694525ef56abf876db219feb 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 48af721d35966a0a9cf13c7fd8faeac558f871ba..e02934de67d1e08ef04eaebcd7d373d78eaa6fa4 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 0000000000000000000000000000000000000000..fdaad52b0d80abddaf69f1607c5fc49df8821143 --- /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 18d5ec421f54985ba885165eed2d4cfa78be77a3..38929892f913f1928209697ef10dd9e84ab17c4f 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 0000000000000000000000000000000000000000..b5f64385fb3d7b586c2d6efe1e216664ee2d3dc0 --- /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" + ); + } +}