diff --git a/CHANGES.md b/CHANGES.md index 38a1fc722c..6097fc6698 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,7 @@ Release Notes. * Polish test framework to support `arm64/v8` platforms * Fix wrong config name `plugin.toolkit.use_qualified_name_as_operation_name`, and system variable name `SW_PLUGIN_TOOLKIT_USE_QUALIFIED_NAME_AS_OPERATION_NAME:false`. They were **toolit**. * Rename `JDBI` to `JDBC` +* Support collecting dubbo thread pool metrics #### Documentation diff --git a/apm-sniffer/apm-sdk-plugin/dubbo-2.7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/asf/dubbo/AbstractServerConstructorInterceptor.java b/apm-sniffer/apm-sdk-plugin/dubbo-2.7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/asf/dubbo/AbstractServerConstructorInterceptor.java new file mode 100644 index 0000000000..75b331e770 --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/dubbo-2.7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/asf/dubbo/AbstractServerConstructorInterceptor.java @@ -0,0 +1,85 @@ +/* + * 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.apm.plugin.asf.dubbo; + +import org.apache.dubbo.common.URL; +import org.apache.dubbo.remoting.transport.AbstractServer; +import org.apache.skywalking.apm.agent.core.meter.MeterFactory; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor; + +import java.lang.reflect.Field; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.ThreadPoolExecutor; + +public class AbstractServerConstructorInterceptor implements InstanceConstructorInterceptor { + private static final String METER_NAME = "thread_pool"; + private static final String METRIC_POOL_NAME_TAG_NAME = "pool_name"; + private static final String METRIC_TYPE_TAG_NAME = "metric_type"; + + @Override + public void onConstruct(EnhancedInstance objInst, Object[] allArguments) throws Throwable { + Field executorField = AbstractServer.class.getDeclaredField("executor"); + executorField.setAccessible(true); + ExecutorService executor = (ExecutorService) executorField.get(objInst); + + URL url = (URL) allArguments[0]; + int port = url.getPort(); + + if (!(executor instanceof ThreadPoolExecutor)) { + return; + } + ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) executor; + // TODO String.format("DubboServerHandler-%s:%s", host, port) will be better + String threadPoolName = String.format("DubboServerHandler-%s", port); + + MeterFactory.gauge(METER_NAME, () -> (double) (threadPoolExecutor.getCorePoolSize())) + .tag(METRIC_POOL_NAME_TAG_NAME, threadPoolName) + .tag(METRIC_TYPE_TAG_NAME, "core_pool_size") + .build(); + MeterFactory.gauge(METER_NAME, () -> (double) (threadPoolExecutor.getMaximumPoolSize())) + .tag(METRIC_POOL_NAME_TAG_NAME, threadPoolName) + .tag(METRIC_TYPE_TAG_NAME, "max_pool_size") + .build(); + MeterFactory.gauge(METER_NAME, () -> (double) (threadPoolExecutor.getLargestPoolSize())) + .tag(METRIC_POOL_NAME_TAG_NAME, threadPoolName) + .tag(METRIC_TYPE_TAG_NAME, "largest_pool_size") + .build(); + MeterFactory.gauge(METER_NAME, () -> (double) (threadPoolExecutor.getPoolSize())) + .tag(METRIC_POOL_NAME_TAG_NAME, threadPoolName) + .tag(METRIC_TYPE_TAG_NAME, "pool_size") + .build(); + MeterFactory.gauge(METER_NAME, () -> (double) (threadPoolExecutor.getQueue().size())) + .tag(METRIC_POOL_NAME_TAG_NAME, threadPoolName) + .tag(METRIC_TYPE_TAG_NAME, "queue_size") + .build(); + MeterFactory.gauge(METER_NAME, () -> (double) (threadPoolExecutor.getActiveCount())) + .tag(METRIC_POOL_NAME_TAG_NAME, threadPoolName) + .tag(METRIC_TYPE_TAG_NAME, "active_size") + .build(); + MeterFactory.gauge(METER_NAME, () -> (double) (threadPoolExecutor.getTaskCount())) + .tag(METRIC_POOL_NAME_TAG_NAME, threadPoolName) + .tag(METRIC_TYPE_TAG_NAME, "task_count") + .build(); + MeterFactory.gauge(METER_NAME, () -> (double) (threadPoolExecutor.getCompletedTaskCount())) + .tag(METRIC_POOL_NAME_TAG_NAME, threadPoolName) + .tag(METRIC_TYPE_TAG_NAME, "completed_task_count") + .build(); + } +} diff --git a/apm-sniffer/apm-sdk-plugin/dubbo-2.7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/asf/dubbo/AbstractServerInstrumentation.java b/apm-sniffer/apm-sdk-plugin/dubbo-2.7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/asf/dubbo/AbstractServerInstrumentation.java new file mode 100644 index 0000000000..5db5962e89 --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/dubbo-2.7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/asf/dubbo/AbstractServerInstrumentation.java @@ -0,0 +1,61 @@ +/* + * 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.apm.plugin.asf.dubbo; + +import net.bytebuddy.description.method.MethodDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; +import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; + +import static net.bytebuddy.matcher.ElementMatchers.any; +import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName; + +public class AbstractServerInstrumentation extends ClassInstanceMethodsEnhancePluginDefine { + private static final String ENHANCE_CLASS = "org.apache.dubbo.remoting.transport.AbstractServer"; + private static final String CONSTRUCTOR_INTERCEPTOR = "org.apache.skywalking.apm.plugin.asf.dubbo.AbstractServerConstructorInterceptor"; + + @Override + protected ClassMatch enhanceClass() { + return byName(ENHANCE_CLASS); + } + + @Override + public ConstructorInterceptPoint[] getConstructorsInterceptPoints() { + return new ConstructorInterceptPoint[]{ + new ConstructorInterceptPoint() { + @Override + public ElementMatcher getConstructorMatcher() { + return any(); + } + + @Override + public String getConstructorInterceptor() { + return CONSTRUCTOR_INTERCEPTOR; + } + } + }; + } + + @Override + public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { + return new InstanceMethodsInterceptPoint[0]; + } +} diff --git a/apm-sniffer/apm-sdk-plugin/dubbo-2.7.x-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/dubbo-2.7.x-plugin/src/main/resources/skywalking-plugin.def index f6b64e0ba3..725d2739a4 100644 --- a/apm-sniffer/apm-sdk-plugin/dubbo-2.7.x-plugin/src/main/resources/skywalking-plugin.def +++ b/apm-sniffer/apm-sdk-plugin/dubbo-2.7.x-plugin/src/main/resources/skywalking-plugin.def @@ -15,3 +15,4 @@ # limitations under the License. dubbo-2.7.x=org.apache.skywalking.apm.plugin.asf.dubbo.DubboInstrumentation +dubbo-threadpool-2.7.x=org.apache.skywalking.apm.plugin.asf.dubbo.AbstractServerInstrumentation diff --git a/apm-sniffer/apm-sdk-plugin/dubbo-plugin/src/main/java/org/apache/skywalking/apm/plugin/dubbo/AbstractServerConstructorInterceptor.java b/apm-sniffer/apm-sdk-plugin/dubbo-plugin/src/main/java/org/apache/skywalking/apm/plugin/dubbo/AbstractServerConstructorInterceptor.java new file mode 100644 index 0000000000..99e53c66de --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/dubbo-plugin/src/main/java/org/apache/skywalking/apm/plugin/dubbo/AbstractServerConstructorInterceptor.java @@ -0,0 +1,85 @@ +/* + * 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.apm.plugin.dubbo; + +import com.alibaba.dubbo.common.URL; +import com.alibaba.dubbo.remoting.transport.AbstractServer; +import org.apache.skywalking.apm.agent.core.meter.MeterFactory; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor; + +import java.lang.reflect.Field; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.ThreadPoolExecutor; + +public class AbstractServerConstructorInterceptor implements InstanceConstructorInterceptor { + private static final String METER_NAME = "thread_pool"; + private static final String METRIC_POOL_NAME_TAG_NAME = "pool_name"; + private static final String METRIC_TYPE_TAG_NAME = "metric_type"; + + @Override + public void onConstruct(EnhancedInstance objInst, Object[] allArguments) throws Throwable { + Field executorField = AbstractServer.class.getDeclaredField("executor"); + executorField.setAccessible(true); + ExecutorService executor = (ExecutorService) executorField.get(objInst); + + URL url = (URL) allArguments[0]; + int port = url.getPort(); + + if (!(executor instanceof ThreadPoolExecutor)) { + return; + } + ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) executor; + // TODO String.format("DubboServerHandler-%s:%s", host, port) will be better + String threadPoolName = String.format("DubboServerHandler-%s", port); + + MeterFactory.gauge(METER_NAME, () -> (double) (threadPoolExecutor.getCorePoolSize())) + .tag(METRIC_POOL_NAME_TAG_NAME, threadPoolName) + .tag(METRIC_TYPE_TAG_NAME, "core_pool_size") + .build(); + MeterFactory.gauge(METER_NAME, () -> (double) (threadPoolExecutor.getMaximumPoolSize())) + .tag(METRIC_POOL_NAME_TAG_NAME, threadPoolName) + .tag(METRIC_TYPE_TAG_NAME, "max_pool_size") + .build(); + MeterFactory.gauge(METER_NAME, () -> (double) (threadPoolExecutor.getLargestPoolSize())) + .tag(METRIC_POOL_NAME_TAG_NAME, threadPoolName) + .tag(METRIC_TYPE_TAG_NAME, "largest_pool_size") + .build(); + MeterFactory.gauge(METER_NAME, () -> (double) (threadPoolExecutor.getPoolSize())) + .tag(METRIC_POOL_NAME_TAG_NAME, threadPoolName) + .tag(METRIC_TYPE_TAG_NAME, "pool_size") + .build(); + MeterFactory.gauge(METER_NAME, () -> (double) (threadPoolExecutor.getQueue().size())) + .tag(METRIC_POOL_NAME_TAG_NAME, threadPoolName) + .tag(METRIC_TYPE_TAG_NAME, "queue_size") + .build(); + MeterFactory.gauge(METER_NAME, () -> (double) (threadPoolExecutor.getActiveCount())) + .tag(METRIC_POOL_NAME_TAG_NAME, threadPoolName) + .tag(METRIC_TYPE_TAG_NAME, "active_size") + .build(); + MeterFactory.gauge(METER_NAME, () -> (double) (threadPoolExecutor.getTaskCount())) + .tag(METRIC_POOL_NAME_TAG_NAME, threadPoolName) + .tag(METRIC_TYPE_TAG_NAME, "task_count") + .build(); + MeterFactory.gauge(METER_NAME, () -> (double) (threadPoolExecutor.getCompletedTaskCount())) + .tag(METRIC_POOL_NAME_TAG_NAME, threadPoolName) + .tag(METRIC_TYPE_TAG_NAME, "completed_task_count") + .build(); + } +} diff --git a/apm-sniffer/apm-sdk-plugin/dubbo-plugin/src/main/java/org/apache/skywalking/apm/plugin/dubbo/AbstractServerInstrumentation.java b/apm-sniffer/apm-sdk-plugin/dubbo-plugin/src/main/java/org/apache/skywalking/apm/plugin/dubbo/AbstractServerInstrumentation.java new file mode 100644 index 0000000000..54bd8ee8ac --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/dubbo-plugin/src/main/java/org/apache/skywalking/apm/plugin/dubbo/AbstractServerInstrumentation.java @@ -0,0 +1,61 @@ +/* + * 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.apm.plugin.dubbo; + +import net.bytebuddy.description.method.MethodDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; +import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; + +import static net.bytebuddy.matcher.ElementMatchers.any; +import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName; + +public class AbstractServerInstrumentation extends ClassInstanceMethodsEnhancePluginDefine { + private static final String ENHANCE_CLASS = "com.alibaba.dubbo.remoting.transport.AbstractServer"; + private static final String CONSTRUCTOR_INTERCEPTOR = "org.apache.skywalking.apm.plugin.dubbo.AbstractServerConstructorInterceptor"; + + @Override + protected ClassMatch enhanceClass() { + return byName(ENHANCE_CLASS); + } + + @Override + public ConstructorInterceptPoint[] getConstructorsInterceptPoints() { + return new ConstructorInterceptPoint[]{ + new ConstructorInterceptPoint() { + @Override + public ElementMatcher getConstructorMatcher() { + return any(); + } + + @Override + public String getConstructorInterceptor() { + return CONSTRUCTOR_INTERCEPTOR; + } + } + }; + } + + @Override + public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { + return new InstanceMethodsInterceptPoint[0]; + } +} diff --git a/apm-sniffer/apm-sdk-plugin/dubbo-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/dubbo-plugin/src/main/resources/skywalking-plugin.def index aabf09193d..229c95c570 100644 --- a/apm-sniffer/apm-sdk-plugin/dubbo-plugin/src/main/resources/skywalking-plugin.def +++ b/apm-sniffer/apm-sdk-plugin/dubbo-plugin/src/main/resources/skywalking-plugin.def @@ -15,3 +15,4 @@ # limitations under the License. dubbo=org.apache.skywalking.apm.plugin.dubbo.DubboInstrumentation +dubbo-threadpool=org.apache.skywalking.apm.plugin.dubbo.AbstractServerInstrumentation diff --git a/docs/en/setup/service-agent/java-agent/Plugin-list.md b/docs/en/setup/service-agent/java-agent/Plugin-list.md index 1390befff3..706f040ce8 100644 --- a/docs/en/setup/service-agent/java-agent/Plugin-list.md +++ b/docs/en/setup/service-agent/java-agent/Plugin-list.md @@ -15,6 +15,8 @@ - dubbo - dubbo-2.7.x - dubbo-3.x +- dubbo-threadpool +- dubbo-threadpool-2.7.x - ehcache-2.x - elastic-job-2.x - elasticjob-3.x diff --git a/docs/en/setup/service-agent/java-agent/Supported-list.md b/docs/en/setup/service-agent/java-agent/Supported-list.md index 95bf1af210..0d43e9424e 100644 --- a/docs/en/setup/service-agent/java-agent/Supported-list.md +++ b/docs/en/setup/service-agent/java-agent/Supported-list.md @@ -151,6 +151,7 @@ The meter plugin provides the advanced metrics collections, which are not a part * Thread Pool * [Undertow](https://github.com/undertow-io/undertow) 2.1.x -> 2.6.x * [Tomcat](https://github.com/apache/tomcat) 7.0.x -> 10.0.x + * [Dubbo](https://github.com/apache/dubbo) 2.5.x -> 2.7.x ___ ¹Due to license incompatibilities/restrictions these plugins are hosted and released in 3rd part repository, go to [SkyAPM java plugin extension repository](https://github.com/SkyAPM/java-plugin-extensions) to get these. diff --git a/test/plugin/scenarios/dubbo-2.5.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/dubbo-2.5.x-scenario/config/expectedData.yaml index 8eaa181c6d..15d9575dd7 100644 --- a/test/plugin/scenarios/dubbo-2.5.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/dubbo-2.5.x-scenario/config/expectedData.yaml @@ -32,7 +32,7 @@ segmentItems: tags: - {key: url, value: not null} refs: - - {parentEndpoint: GET:/dubbo-2.5.x-scenario/case/dubbo, networkAddress: 'localhost:20080', + - {parentEndpoint: GET:/dubbo-2.5.x-scenario/case/dubbo, networkAddress: 'localhost:20880', refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstance: not null, parentService: dubbo-2.5.x-scenario, traceId: not null} skipAnalysis: 'false' @@ -47,9 +47,9 @@ segmentItems: componentId: 3 isError: false spanType: Exit - peer: localhost:20080 + peer: localhost:20880 tags: - - {key: url, value: 'dubbo://localhost:20080/org.apache.skywalking.apm.testcase.dubbo.services.GreetService.doBusiness()'} + - {key: url, value: 'dubbo://localhost:20880/org.apache.skywalking.apm.testcase.dubbo.services.GreetService.doBusiness()'} skipAnalysis: 'false' - operationName: GET:/dubbo-2.5.x-scenario/case/dubbo parentSpanId: -1 @@ -66,3 +66,55 @@ segmentItems: - {key: http.method, value: GET} - {key: http.status_code, value: '200'} skipAnalysis: 'false' +meterItems: + - serviceName: dubbo-2.5.x-scenario + meterSize: ge 8 + meters: + - meterId: + name: thread_pool + tags: + - {name: metric_type, value: core_pool_size} + - {name: pool_name, value: DubboServerHandler-20880} + singleValue: ge 1 + - meterId: + name: thread_pool + tags: + - {name: metric_type, value: max_pool_size} + - {name: pool_name, value: DubboServerHandler-20880} + singleValue: ge 1 + - meterId: + name: thread_pool + tags: + - {name: metric_type, value: largest_pool_size} + - {name: pool_name, value: DubboServerHandler-20880} + singleValue: ge 1 + - meterId: + name: thread_pool + tags: + - {name: metric_type, value: pool_size} + - {name: pool_name, value: DubboServerHandler-20880} + singleValue: ge 0 + - meterId: + name: thread_pool + tags: + - {name: metric_type, value: queue_size} + - {name: pool_name, value: DubboServerHandler-20880} + singleValue: ge 0 + - meterId: + name: thread_pool + tags: + - {name: metric_type, value: active_size} + - {name: pool_name, value: DubboServerHandler-20880} + singleValue: ge 0 + - meterId: + name: thread_pool + tags: + - {name: metric_type, value: task_count} + - {name: pool_name, value: DubboServerHandler-20880} + singleValue: ge 0 + - meterId: + name: thread_pool + tags: + - {name: metric_type, value: completed_task_count} + - {name: pool_name, value: DubboServerHandler-20880} + singleValue: ge 0 diff --git a/test/plugin/scenarios/dubbo-2.5.x-scenario/configuration.yml b/test/plugin/scenarios/dubbo-2.5.x-scenario/configuration.yml index cf975f31d0..91fcc8161d 100644 --- a/test/plugin/scenarios/dubbo-2.5.x-scenario/configuration.yml +++ b/test/plugin/scenarios/dubbo-2.5.x-scenario/configuration.yml @@ -18,3 +18,5 @@ type: jvm entryService: http://localhost:8080/dubbo-2.5.x-scenario/case/dubbo healthCheck: http://localhost:8080/dubbo-2.5.x-scenario/case/healthCheck startScript: ./bin/startup.sh +environment: + - SW_METER_REPORT_INTERVAL=1 \ No newline at end of file diff --git a/test/plugin/scenarios/dubbo-2.5.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/dubbo/Application.java b/test/plugin/scenarios/dubbo-2.5.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/dubbo/Application.java index 1918964ce9..d3b74fdecb 100644 --- a/test/plugin/scenarios/dubbo-2.5.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/dubbo/Application.java +++ b/test/plugin/scenarios/dubbo-2.5.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/dubbo/Application.java @@ -44,7 +44,7 @@ public static class DubboConfiguration { private RegistryConfig registryConfig = new RegistryConfig("N/A"); - private ProtocolConfig protocolConfig = new ProtocolConfig("dubbo", 20080); + private ProtocolConfig protocolConfig = new ProtocolConfig("dubbo", 20880); @Bean(destroyMethod = "unexport") public ServiceConfig service() { @@ -65,7 +65,7 @@ public ReferenceConfig reference() { referenceConfig.setApplication(applicationConfig); referenceConfig.setInterface(GreetService.class); - referenceConfig.setUrl("dubbo://localhost:20080"); + referenceConfig.setUrl("dubbo://localhost:20880"); return referenceConfig; } diff --git a/test/plugin/scenarios/dubbo-2.7.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/dubbo-2.7.x-scenario/config/expectedData.yaml index 10fb8aabe9..545e28c4b3 100644 --- a/test/plugin/scenarios/dubbo-2.7.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/dubbo-2.7.x-scenario/config/expectedData.yaml @@ -34,7 +34,7 @@ segmentItems: - {key: url, value: not null} - {key: arguments, value: helloWorld} refs: - - {parentEndpoint: GET:/dubbo-2.7.x-scenario/case/dubbo, networkAddress: 'localhost:20080', + - {parentEndpoint: GET:/dubbo-2.7.x-scenario/case/dubbo, networkAddress: 'localhost:20880', refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstance: not null, parentService: dubbo-2.7.x-scenario, traceId: not null} skipAnalysis: 'false' @@ -49,9 +49,9 @@ segmentItems: componentId: 3 isError: false spanType: Exit - peer: localhost:20080 + peer: localhost:20880 tags: - - {key: url, value: 'dubbo://localhost:20080/org.apache.skywalking.apm.testcase.dubbo.services.GreetService.doBusiness(String)'} + - {key: url, value: 'dubbo://localhost:20880/org.apache.skywalking.apm.testcase.dubbo.services.GreetService.doBusiness(String)'} - {key: arguments, value: helloWorld} skipAnalysis: 'false' - operationName: GET:/dubbo-2.7.x-scenario/case/dubbo @@ -69,3 +69,55 @@ segmentItems: - {key: http.method, value: GET} - {key: http.status_code, value: '200'} skipAnalysis: 'false' +meterItems: + - serviceName: dubbo-2.7.x-scenario + meterSize: ge 8 + meters: + - meterId: + name: thread_pool + tags: + - {name: metric_type, value: core_pool_size} + - {name: pool_name, value: DubboServerHandler-20880} + singleValue: ge 1 + - meterId: + name: thread_pool + tags: + - {name: metric_type, value: max_pool_size} + - {name: pool_name, value: DubboServerHandler-20880} + singleValue: ge 1 + - meterId: + name: thread_pool + tags: + - {name: metric_type, value: largest_pool_size} + - {name: pool_name, value: DubboServerHandler-20880} + singleValue: ge 1 + - meterId: + name: thread_pool + tags: + - {name: metric_type, value: pool_size} + - {name: pool_name, value: DubboServerHandler-20880} + singleValue: ge 0 + - meterId: + name: thread_pool + tags: + - {name: metric_type, value: queue_size} + - {name: pool_name, value: DubboServerHandler-20880} + singleValue: ge 0 + - meterId: + name: thread_pool + tags: + - {name: metric_type, value: active_size} + - {name: pool_name, value: DubboServerHandler-20880} + singleValue: ge 0 + - meterId: + name: thread_pool + tags: + - {name: metric_type, value: task_count} + - {name: pool_name, value: DubboServerHandler-20880} + singleValue: ge 0 + - meterId: + name: thread_pool + tags: + - {name: metric_type, value: completed_task_count} + - {name: pool_name, value: DubboServerHandler-20880} + singleValue: ge 0 diff --git a/test/plugin/scenarios/dubbo-2.7.x-scenario/configuration.yml b/test/plugin/scenarios/dubbo-2.7.x-scenario/configuration.yml index 98f24d2b53..572a573676 100644 --- a/test/plugin/scenarios/dubbo-2.7.x-scenario/configuration.yml +++ b/test/plugin/scenarios/dubbo-2.7.x-scenario/configuration.yml @@ -18,3 +18,5 @@ type: jvm entryService: http://localhost:8080/dubbo-2.7.x-scenario/case/dubbo healthCheck: http://localhost:8080/dubbo-2.7.x-scenario/case/healthCheck startScript: ./bin/startup.sh +environment: + - SW_METER_REPORT_INTERVAL=1 diff --git a/test/plugin/scenarios/dubbo-2.7.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/dubbo/Application.java b/test/plugin/scenarios/dubbo-2.7.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/dubbo/Application.java index 933fee49e7..c12a9894e2 100644 --- a/test/plugin/scenarios/dubbo-2.7.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/dubbo/Application.java +++ b/test/plugin/scenarios/dubbo-2.7.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/dubbo/Application.java @@ -44,7 +44,7 @@ public static class DubboConfiguration { private RegistryConfig registryConfig = new RegistryConfig("N/A"); - private ProtocolConfig protocolConfig = new ProtocolConfig("dubbo", 20080); + private ProtocolConfig protocolConfig = new ProtocolConfig("dubbo", 20880); @Bean(destroyMethod = "unexport") public ServiceConfig service() { @@ -65,7 +65,7 @@ public ReferenceConfig reference() { referenceConfig.setApplication(applicationConfig); referenceConfig.setInterface(GreetService.class); - referenceConfig.setUrl("dubbo://localhost:20080"); + referenceConfig.setUrl("dubbo://localhost:20880"); return referenceConfig; }