Fix `disable` statement not working (#6687)

This commit is contained in:
吴晟 Wu Sheng 2021-04-05 20:11:34 +08:00 committed by GitHub
parent d7beac5bfc
commit 2b85ba1041
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 74 additions and 17 deletions

View File

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

View File

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

View File

@ -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);

View File

@ -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);

View File

@ -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();

View File

@ -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"
);
}
}