From d4cec534cb88696fbf9749e13d1542fc18aedf59 Mon Sep 17 00:00:00 2001 From: wu-sheng Date: Fri, 15 Dec 2017 12:19:04 +0800 Subject: [PATCH 1/8] Submit related projects in NOTICE. --- NOTICE.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 NOTICE.txt diff --git a/NOTICE.txt b/NOTICE.txt new file mode 100644 index 000000000..294456b21 --- /dev/null +++ b/NOTICE.txt @@ -0,0 +1,21 @@ +Apache SkyWalking +Copyright 2015-2017 The Apache Software Foundation + +This product includes software developed by The Apache Software +Foundation (http://www.apache.org/). + +The binary distribution contains software developed by: + +raphw (byte-buddy): http://bytebuddy.net/ +INRIA, France Telecom (asm): http://asm.ow2.org/ +Google: +- grpc: https://grpc.io/ +- guava: https://github.com/google/guava +- gson: https://github.com/google/gson +Elasticsearch BV (Elasticsearch): https://www.elastic.co/products/elasticsearch +H2 Database: http://www.h2database.com/html/main.html +LMAX Ltd.(disruptor): https://github.com/LMAX-Exchange/disruptor +mockito: http://site.mockito.org/ +QOS.ch (slf4j): https://www.slf4j.org/ +powermock: https://github.com/powermock/powermock +Eclipse (Jetty): https://www.eclipse.org/jetty/ \ No newline at end of file From 5c95e40ccde38b8e5bc4e5ae28d7c1c9d378195e Mon Sep 17 00:00:00 2001 From: peng-yongsheng <8082209@qq.com> Date: Sat, 16 Dec 2017 11:48:58 +0800 Subject: [PATCH 2/8] Do not use the propertie for checkstyle header file path that lead to the checkstyle plugin of IntelliJ idea not work. --- checkStyle.xml | 2 +- pom.xml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/checkStyle.xml b/checkStyle.xml index ef0f397bd..b90ee7c02 100644 --- a/checkStyle.xml +++ b/checkStyle.xml @@ -30,7 +30,7 @@ - + diff --git a/pom.xml b/pom.xml index 5a3e2a525..8f8d3a094 100644 --- a/pom.xml +++ b/pom.xml @@ -79,7 +79,6 @@ 2.11.7 1.6.4 0.4.13 - CHECKSTYLE_HEAD From 435adc684f545e1e7760bd4cf4f3054b2b8843f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=99=9F=20Wu=20Sheng?= Date: Sun, 17 Dec 2017 09:37:31 +0800 Subject: [PATCH 3/8] Update NOTICE.txt Add licenses for each dependency. --- NOTICE.txt | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/NOTICE.txt b/NOTICE.txt index 294456b21..241f32e67 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -6,16 +6,16 @@ Foundation (http://www.apache.org/). The binary distribution contains software developed by: -raphw (byte-buddy): http://bytebuddy.net/ -INRIA, France Telecom (asm): http://asm.ow2.org/ +raphw (byte-buddy): http://bytebuddy.net/ , Apache 2.0 +INRIA, France Telecom (asm): http://asm.ow2.org/ , [asmdex-license](http://asm.ow2.org/asmdex-license.html) Google: -- grpc: https://grpc.io/ -- guava: https://github.com/google/guava -- gson: https://github.com/google/gson -Elasticsearch BV (Elasticsearch): https://www.elastic.co/products/elasticsearch -H2 Database: http://www.h2database.com/html/main.html -LMAX Ltd.(disruptor): https://github.com/LMAX-Exchange/disruptor -mockito: http://site.mockito.org/ -QOS.ch (slf4j): https://www.slf4j.org/ -powermock: https://github.com/powermock/powermock -Eclipse (Jetty): https://www.eclipse.org/jetty/ \ No newline at end of file +- grpc: https://grpc.io/ , Apache 2.0 +- guava: https://github.com/google/guava , Apache 2.0 +- gson: https://github.com/google/gson , Apache 2.0 +Elasticsearch BV (Elasticsearch): https://www.elastic.co/products/elasticsearch , Apache 2.0 +H2 Database: http://www.h2database.com/html/main.html , MPL 2.0 or EPL 1.0 +LMAX Ltd.(disruptor): https://github.com/LMAX-Exchange/disruptor , Apache 2.0 +mockito: http://site.mockito.org/ , MIT +QOS.ch (slf4j): https://www.slf4j.org/ , MIT +powermock: https://github.com/powermock/powermock , Apache 2.0 +Eclipse (Jetty): https://www.eclipse.org/jetty/ , Apache 2.0 and Eclipse Public License 1.0 From e1a7fd5937b63f61e3987b2b7b6c45ad26a3213c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=99=9F=20Wu=20Sheng?= Date: Mon, 18 Dec 2017 14:43:12 +0800 Subject: [PATCH 4/8] Update README_ZH.md --- docs/README_ZH.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README_ZH.md b/docs/README_ZH.md index 205ae0ddb..d09167189 100644 --- a/docs/README_ZH.md +++ b/docs/README_ZH.md @@ -10,7 +10,7 @@ * [中间件,框架与类库支持列表](Supported-list.md) * [如何关闭特定插件](cn/How-to-disable-plugin-CN.md) * APM相关介绍资料 - * [OpenTracing中文版](https://github.com/opentracing-contrib/opentracing-specification-zh.md) + * [OpenTracing中文版](https://github.com/opentracing-contrib/opentracing-specification-zh) * Application Toolkit,应用程序工具包 * [概述](cn/Application-toolkit-CN.md) * [OpenTracing Tracer](cn/skywalking-opentracing-CN.md) From 6f1f4cf14f343a10dc3abd72fcd1e4defb9d8c94 Mon Sep 17 00:00:00 2001 From: wusheng Date: Mon, 18 Dec 2017 21:27:24 +0800 Subject: [PATCH 5/8] Change network protocol for 5.0 --- .../handler/ApplicationRegisterServiceHandler.java | 12 ++++++------ .../ApplicationRegisterServiceHandlerTestCase.java | 10 +++++----- .../src/main/proto/ApplicationRegisterService.proto | 10 +++++----- apm-network/src/main/proto/TraceSegmentService.proto | 1 + .../apm/agent/core/context/trace/SpanLayer.java | 8 ++++++-- .../agent/core/dictionary/ApplicationDictionary.java | 12 ++++++------ .../core/remote/AppAndServiceRegisterClient.java | 12 ++++++------ .../apm/plugin/jedis/v2/JedisMethodInterceptor.java | 2 +- .../plugin/jedis/v2/JedisMethodInterceptorTest.java | 2 +- .../v4/AbstractMessageConsumeInterceptor.java | 2 +- .../plugin/rocketMQ/v4/MessageSendInterceptor.java | 2 +- .../spymemcached/v2/MemcachedMethodInterceptor.java | 2 +- .../v2/MemcachedMethodInterceptorTest.java | 2 +- .../xmemcached/v2/XMemcachedMethodInterceptor.java | 2 +- .../v2/XMemcachedMethodInterceptorTest.java | 2 +- 15 files changed, 43 insertions(+), 38 deletions(-) diff --git a/apm-collector/apm-collector-agent-grpc/collector-agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/handler/ApplicationRegisterServiceHandler.java b/apm-collector/apm-collector-agent-grpc/collector-agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/handler/ApplicationRegisterServiceHandler.java index b4aab258f..bd1217ea3 100644 --- a/apm-collector/apm-collector-agent-grpc/collector-agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/handler/ApplicationRegisterServiceHandler.java +++ b/apm-collector/apm-collector-agent-grpc/collector-agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/handler/ApplicationRegisterServiceHandler.java @@ -25,9 +25,9 @@ import org.apache.skywalking.apm.collector.agent.stream.AgentStreamModule; import org.apache.skywalking.apm.collector.agent.stream.service.register.IApplicationIDService; import org.apache.skywalking.apm.collector.core.module.ModuleManager; import org.apache.skywalking.apm.collector.server.grpc.GRPCHandler; -import org.apache.skywalking.apm.network.proto.Application; -import org.apache.skywalking.apm.network.proto.ApplicationMapping; +import org.apache.skywalking.apm.network.proto.ApplicationMappings; import org.apache.skywalking.apm.network.proto.ApplicationRegisterServiceGrpc; +import org.apache.skywalking.apm.network.proto.Applications; import org.apache.skywalking.apm.network.proto.KeyWithIntegerValue; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,18 +45,18 @@ public class ApplicationRegisterServiceHandler extends ApplicationRegisterServic applicationIDService = moduleManager.find(AgentStreamModule.NAME).getService(IApplicationIDService.class); } - @Override public void register(Application request, StreamObserver responseObserver) { + @Override public void batchRegister(Applications request, StreamObserver responseObserver) { logger.debug("register application"); - ProtocolStringList applicationCodes = request.getApplicationCodeList(); + ProtocolStringList applicationCodes = request.getApplicationCodesList(); - ApplicationMapping.Builder builder = ApplicationMapping.newBuilder(); + ApplicationMappings.Builder builder = ApplicationMappings.newBuilder(); for (int i = 0; i < applicationCodes.size(); i++) { String applicationCode = applicationCodes.get(i); int applicationId = applicationIDService.getOrCreate(applicationCode); if (applicationId != 0) { KeyWithIntegerValue value = KeyWithIntegerValue.newBuilder().setKey(applicationCode).setValue(applicationId).build(); - builder.addApplication(value); + builder.addApplications(value); } } responseObserver.onNext(builder.build()); diff --git a/apm-collector/apm-collector-agent-grpc/collector-agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/handler/ApplicationRegisterServiceHandlerTestCase.java b/apm-collector/apm-collector-agent-grpc/collector-agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/handler/ApplicationRegisterServiceHandlerTestCase.java index 4abdd900f..e0efff8b9 100644 --- a/apm-collector/apm-collector-agent-grpc/collector-agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/handler/ApplicationRegisterServiceHandlerTestCase.java +++ b/apm-collector/apm-collector-agent-grpc/collector-agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/handler/ApplicationRegisterServiceHandlerTestCase.java @@ -21,9 +21,9 @@ package org.apache.skywalking.apm.collector.agent.grpc.handler; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; -import org.apache.skywalking.apm.network.proto.Application; -import org.apache.skywalking.apm.network.proto.ApplicationMapping; +import org.apache.skywalking.apm.network.proto.ApplicationMappings; import org.apache.skywalking.apm.network.proto.ApplicationRegisterServiceGrpc; +import org.apache.skywalking.apm.network.proto.Applications; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,8 +40,8 @@ public class ApplicationRegisterServiceHandlerTestCase { ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 11800).usePlaintext(true).build(); stub = ApplicationRegisterServiceGrpc.newBlockingStub(channel); - Application application = Application.newBuilder().addApplicationCode("test141").build(); - ApplicationMapping mapping = stub.register(application); - logger.debug(mapping.getApplication(0).getKey() + ", " + mapping.getApplication(0).getValue()); + Applications application = Applications.newBuilder().addApplicationCodes("test141").build(); + ApplicationMappings mapping = stub.batchRegister(application); + logger.debug(mapping.getApplications(0).getKey() + ", " + mapping.getApplications(0).getValue()); } } diff --git a/apm-network/src/main/proto/ApplicationRegisterService.proto b/apm-network/src/main/proto/ApplicationRegisterService.proto index 2143448b8..1852ee4ed 100644 --- a/apm-network/src/main/proto/ApplicationRegisterService.proto +++ b/apm-network/src/main/proto/ApplicationRegisterService.proto @@ -7,14 +7,14 @@ import "KeyWithIntegerValue.proto"; //register service for ApplicationCode, this service is called when service starts. service ApplicationRegisterService { - rpc register (Application) returns (ApplicationMapping) { + rpc batchRegister (Applications) returns (ApplicationMappings) { } } -message Application { - repeated string applicationCode = 1; +message Applications { + repeated string applicationCodes = 1; } -message ApplicationMapping { - repeated KeyWithIntegerValue application = 1; +message ApplicationMappings { + repeated KeyWithIntegerValue applications = 1; } diff --git a/apm-network/src/main/proto/TraceSegmentService.proto b/apm-network/src/main/proto/TraceSegmentService.proto index 607d8a6e4..5ac1aba91 100644 --- a/apm-network/src/main/proto/TraceSegmentService.proto +++ b/apm-network/src/main/proto/TraceSegmentService.proto @@ -78,6 +78,7 @@ enum SpanLayer { RPCFramework = 2; Http = 3; MQ = 4; + Cache = 5; } message LogMessage { diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/SpanLayer.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/SpanLayer.java index 158b673ca..5bd5980d3 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/SpanLayer.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/SpanLayer.java @@ -16,7 +16,6 @@ * */ - package org.apache.skywalking.apm.agent.core.context.trace; /** @@ -26,7 +25,8 @@ public enum SpanLayer { DB(1), RPC_FRAMEWORK(2), HTTP(3), - MQ(4); + MQ(4), + CACHE(5); private int code; @@ -42,6 +42,10 @@ public enum SpanLayer { span.setLayer(SpanLayer.DB); } + public static void asCache(AbstractSpan span) { + span.setLayer(SpanLayer.CACHE); + } + public static void asRPCFramework(AbstractSpan span) { span.setLayer(SpanLayer.RPC_FRAMEWORK); } diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/ApplicationDictionary.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/ApplicationDictionary.java index 33648dacf..28d934b0b 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/ApplicationDictionary.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/ApplicationDictionary.java @@ -23,9 +23,9 @@ import io.netty.util.internal.ConcurrentSet; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import org.apache.skywalking.apm.network.proto.Application; -import org.apache.skywalking.apm.network.proto.ApplicationMapping; +import org.apache.skywalking.apm.network.proto.ApplicationMappings; import org.apache.skywalking.apm.network.proto.ApplicationRegisterServiceGrpc; +import org.apache.skywalking.apm.network.proto.Applications; import org.apache.skywalking.apm.network.proto.KeyWithIntegerValue; import static org.apache.skywalking.apm.agent.core.conf.Config.Dictionary.APPLICATION_CODE_BUFFER_SIZE; @@ -55,10 +55,10 @@ public enum ApplicationDictionary { public void syncRemoteDictionary( ApplicationRegisterServiceGrpc.ApplicationRegisterServiceBlockingStub applicationRegisterServiceBlockingStub) { if (unRegisterApplications.size() > 0) { - ApplicationMapping applicationMapping = applicationRegisterServiceBlockingStub.register( - Application.newBuilder().addAllApplicationCode(unRegisterApplications).build()); - if (applicationMapping.getApplicationCount() > 0) { - for (KeyWithIntegerValue keyWithIntegerValue : applicationMapping.getApplicationList()) { + ApplicationMappings applicationMapping = applicationRegisterServiceBlockingStub.batchRegister( + Applications.newBuilder().addAllApplicationCodes(unRegisterApplications).build()); + if (applicationMapping.getApplicationsCount() > 0) { + for (KeyWithIntegerValue keyWithIntegerValue : applicationMapping.getApplicationsList()) { unRegisterApplications.remove(keyWithIntegerValue.getKey()); applicationDictionary.put(keyWithIntegerValue.getKey(), keyWithIntegerValue.getValue()); } diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/AppAndServiceRegisterClient.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/AppAndServiceRegisterClient.java index a214fdd22..61cbd5172 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/AppAndServiceRegisterClient.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/AppAndServiceRegisterClient.java @@ -38,13 +38,13 @@ import org.apache.skywalking.apm.agent.core.dictionary.DictionaryUtil; import org.apache.skywalking.apm.agent.core.dictionary.OperationNameDictionary; import org.apache.skywalking.apm.agent.core.logging.api.ILog; import org.apache.skywalking.apm.agent.core.logging.api.LogManager; -import org.apache.skywalking.apm.network.proto.Application; import org.apache.skywalking.apm.network.proto.ApplicationInstance; import org.apache.skywalking.apm.network.proto.ApplicationInstanceHeartbeat; import org.apache.skywalking.apm.network.proto.ApplicationInstanceMapping; import org.apache.skywalking.apm.network.proto.ApplicationInstanceRecover; -import org.apache.skywalking.apm.network.proto.ApplicationMapping; +import org.apache.skywalking.apm.network.proto.ApplicationMappings; import org.apache.skywalking.apm.network.proto.ApplicationRegisterServiceGrpc; +import org.apache.skywalking.apm.network.proto.Applications; import org.apache.skywalking.apm.network.proto.InstanceDiscoveryServiceGrpc; import org.apache.skywalking.apm.network.proto.ServiceNameDiscoveryServiceGrpc; @@ -112,10 +112,10 @@ public class AppAndServiceRegisterClient implements BootService, GRPCChannelList try { if (RemoteDownstreamConfig.Agent.APPLICATION_ID == DictionaryUtil.nullValue()) { if (applicationRegisterServiceBlockingStub != null) { - ApplicationMapping applicationMapping = applicationRegisterServiceBlockingStub.register( - Application.newBuilder().addApplicationCode(Config.Agent.APPLICATION_CODE).build()); - if (applicationMapping.getApplicationCount() > 0) { - RemoteDownstreamConfig.Agent.APPLICATION_ID = applicationMapping.getApplication(0).getValue(); + ApplicationMappings applicationMapping = applicationRegisterServiceBlockingStub.batchRegister( + Applications.newBuilder().addApplicationCodes(Config.Agent.APPLICATION_CODE).build()); + if (applicationMapping.getApplicationsCount() > 0) { + RemoteDownstreamConfig.Agent.APPLICATION_ID = applicationMapping.getApplications(0).getValue(); shouldTry = true; } } diff --git a/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jedis/v2/JedisMethodInterceptor.java b/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jedis/v2/JedisMethodInterceptor.java index 40df37888..a4d900d21 100644 --- a/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jedis/v2/JedisMethodInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jedis/v2/JedisMethodInterceptor.java @@ -37,7 +37,7 @@ public class JedisMethodInterceptor implements InstanceMethodsAroundInterceptor AbstractSpan span = ContextManager.createExitSpan("Jedis/" + method.getName(), peer); span.setComponent(ComponentsDefine.REDIS); Tags.DB_TYPE.set(span, "Redis"); - SpanLayer.asDB(span); + SpanLayer.asCache(span); if (allArguments.length > 0 && allArguments[0] instanceof String) { Tags.DB_STATEMENT.set(span, method.getName() + " " + allArguments[0]); diff --git a/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/jedis/v2/JedisMethodInterceptorTest.java b/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/jedis/v2/JedisMethodInterceptorTest.java index 2381c2911..f5d99c8f1 100644 --- a/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/jedis/v2/JedisMethodInterceptorTest.java +++ b/apm-sniffer/apm-sdk-plugin/jedis-2.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/jedis/v2/JedisMethodInterceptorTest.java @@ -132,7 +132,7 @@ public class JedisMethodInterceptorTest { List tags = SpanHelper.getTags(span); assertThat(tags.get(0).getValue(), is("Redis")); assertThat(tags.get(1).getValue(), is("set OperationKey")); - assertThat(SpanHelper.getLayer(span), CoreMatchers.is(SpanLayer.DB)); + assertThat(SpanHelper.getLayer(span), CoreMatchers.is(SpanLayer.CACHE)); } private Method getMockSetMethod() { diff --git a/apm-sniffer/apm-sdk-plugin/rocketMQ-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/rocketMQ/v4/AbstractMessageConsumeInterceptor.java b/apm-sniffer/apm-sdk-plugin/rocketMQ-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/rocketMQ/v4/AbstractMessageConsumeInterceptor.java index 5300afc40..049d789e2 100644 --- a/apm-sniffer/apm-sdk-plugin/rocketMQ-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/rocketMQ/v4/AbstractMessageConsumeInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/rocketMQ-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/rocketMQ/v4/AbstractMessageConsumeInterceptor.java @@ -53,7 +53,7 @@ public abstract class AbstractMessageConsumeInterceptor implements InstanceMetho AbstractSpan span = ContextManager.createEntrySpan(COMSUMER_OPERATION_NAME_PREFIX + msgs.get(0).getTopic() + "/Consumer", contextCarrier); span.setComponent(ComponentsDefine.ROCKET_MQ); - span.setLayer(SpanLayer.MQ); + SpanLayer.asMQ(span); for (int i = 1; i < msgs.size(); i++) { ContextManager.extract(getContextCarrierFromMessage(msgs.get(i))); } diff --git a/apm-sniffer/apm-sdk-plugin/rocketMQ-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/rocketMQ/v4/MessageSendInterceptor.java b/apm-sniffer/apm-sdk-plugin/rocketMQ-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/rocketMQ/v4/MessageSendInterceptor.java index 9df13ece4..05eadfc52 100644 --- a/apm-sniffer/apm-sdk-plugin/rocketMQ-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/rocketMQ/v4/MessageSendInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/rocketMQ-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/rocketMQ/v4/MessageSendInterceptor.java @@ -60,7 +60,7 @@ public class MessageSendInterceptor implements InstanceMethodsAroundInterceptor String namingServiceAddress = String.valueOf(objInst.getSkyWalkingDynamicField()); AbstractSpan span = ContextManager.createExitSpan(buildOperationName(message.getTopic()), contextCarrier, namingServiceAddress); span.setComponent(ComponentsDefine.ROCKET_MQ); - span.setLayer(SpanLayer.MQ); + SpanLayer.asMQ(span); span.tag("brokerName", (String)allArguments[1]); span.tag("tags", message.getTags()); span.tag("communication.mode", ((CommunicationMode)allArguments[5]).name()); diff --git a/apm-sniffer/apm-sdk-plugin/spymemcached-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spymemcached/v2/MemcachedMethodInterceptor.java b/apm-sniffer/apm-sdk-plugin/spymemcached-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spymemcached/v2/MemcachedMethodInterceptor.java index bd2de96ab..caca92cce 100644 --- a/apm-sniffer/apm-sdk-plugin/spymemcached-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spymemcached/v2/MemcachedMethodInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/spymemcached-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spymemcached/v2/MemcachedMethodInterceptor.java @@ -40,7 +40,7 @@ public class MemcachedMethodInterceptor implements InstanceMethodsAroundIntercep AbstractSpan span = ContextManager.createExitSpan(SPY_MEMCACHE + method.getName(), peer); span.setComponent(ComponentsDefine.MEMCACHED); Tags.DB_TYPE.set(span, ComponentsDefine.MEMCACHED.getName()); - SpanLayer.asDB(span); + SpanLayer.asCache(span); Tags.DB_STATEMENT.set(span, method.getName() + " " + allArguments[0]); } diff --git a/apm-sniffer/apm-sdk-plugin/spymemcached-2.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/spymemcached/v2/MemcachedMethodInterceptorTest.java b/apm-sniffer/apm-sdk-plugin/spymemcached-2.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/spymemcached/v2/MemcachedMethodInterceptorTest.java index efb8c985f..a1acf0fb4 100644 --- a/apm-sniffer/apm-sdk-plugin/spymemcached-2.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/spymemcached/v2/MemcachedMethodInterceptorTest.java +++ b/apm-sniffer/apm-sdk-plugin/spymemcached-2.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/spymemcached/v2/MemcachedMethodInterceptorTest.java @@ -116,7 +116,7 @@ public class MemcachedMethodInterceptorTest { List tags = SpanHelper.getTags(span); assertThat(tags.get(0).getValue(), is("Memcached")); assertThat(tags.get(1).getValue(), is("set OperationKey")); - MatcherAssert.assertThat(SpanHelper.getLayer(span), CoreMatchers.is(SpanLayer.DB)); + MatcherAssert.assertThat(SpanHelper.getLayer(span), CoreMatchers.is(SpanLayer.CACHE)); } private Method getMockSetMethod() { diff --git a/apm-sniffer/apm-sdk-plugin/xmemcached-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/xmemcached/v2/XMemcachedMethodInterceptor.java b/apm-sniffer/apm-sdk-plugin/xmemcached-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/xmemcached/v2/XMemcachedMethodInterceptor.java index 3ae9ed32d..feb22baa5 100644 --- a/apm-sniffer/apm-sdk-plugin/xmemcached-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/xmemcached/v2/XMemcachedMethodInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/xmemcached-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/xmemcached/v2/XMemcachedMethodInterceptor.java @@ -46,7 +46,7 @@ public class XMemcachedMethodInterceptor implements InstanceMethodsAroundInterce AbstractSpan span = ContextManager.createExitSpan(XMEMCACHED + method.getName(), peer); span.setComponent(ComponentsDefine.MEMCACHED); Tags.DB_TYPE.set(span, ComponentsDefine.MEMCACHED.getName()); - SpanLayer.asDB(span); + SpanLayer.asCache(span); Tags.DB_STATEMENT.set(span, method.getName() + " " + allArguments[0]); } diff --git a/apm-sniffer/apm-sdk-plugin/xmemcached-2.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/xmemcached/v2/XMemcachedMethodInterceptorTest.java b/apm-sniffer/apm-sdk-plugin/xmemcached-2.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/xmemcached/v2/XMemcachedMethodInterceptorTest.java index 67788862d..55dfbf2fd 100644 --- a/apm-sniffer/apm-sdk-plugin/xmemcached-2.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/xmemcached/v2/XMemcachedMethodInterceptorTest.java +++ b/apm-sniffer/apm-sdk-plugin/xmemcached-2.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/xmemcached/v2/XMemcachedMethodInterceptorTest.java @@ -119,7 +119,7 @@ public class XMemcachedMethodInterceptorTest { List tags = SpanHelper.getTags(span); assertThat(tags.get(0).getValue(), is("Memcached")); assertThat(tags.get(1).getValue(), is("set OperationKey")); - assertThat(SpanHelper.getLayer(span), CoreMatchers.is(SpanLayer.DB)); + assertThat(SpanHelper.getLayer(span), CoreMatchers.is(SpanLayer.CACHE)); } private Method getMockSetMethod() throws Exception { From 09b979c5af374a548b9ccbc4a6f08801bbce38bf Mon Sep 17 00:00:00 2001 From: wu-sheng Date: Tue, 19 Dec 2017 15:27:14 +0800 Subject: [PATCH 6/8] Fix npe --- .../skywalking/apm/agent/core/sampling/SamplingService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/sampling/SamplingService.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/sampling/SamplingService.java index 15d831427..e2910bba6 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/sampling/SamplingService.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/sampling/SamplingService.java @@ -26,10 +26,10 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import org.apache.skywalking.apm.agent.core.boot.BootService; import org.apache.skywalking.apm.agent.core.boot.DefaultNamedThreadFactory; +import org.apache.skywalking.apm.agent.core.conf.Config; import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment; import org.apache.skywalking.apm.agent.core.logging.api.ILog; import org.apache.skywalking.apm.agent.core.logging.api.LogManager; -import org.apache.skywalking.apm.agent.core.conf.Config; /** * The SamplingService take charge of how to sample the {@link TraceSegment}. Every {@link TraceSegment}s @@ -83,7 +83,9 @@ public class SamplingService implements BootService { @Override public void shutdown() throws Throwable { - scheduledFuture.cancel(true); + if (scheduledFuture != null) { + scheduledFuture.cancel(true); + } } /** From 16c6b51810cd72e8efc64dc192868f55102e8972 Mon Sep 17 00:00:00 2001 From: wusheng Date: Tue, 19 Dec 2017 21:51:28 +0800 Subject: [PATCH 7/8] Try to fix a url. --- docs/cn/How-to-communicate-with-the-collector-CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cn/How-to-communicate-with-the-collector-CN.md b/docs/cn/How-to-communicate-with-the-collector-CN.md index 84e82f03c..115480d66 100644 --- a/docs/cn/How-to-communicate-with-the-collector-CN.md +++ b/docs/cn/How-to-communicate-with-the-collector-CN.md @@ -349,4 +349,4 @@ message LogMessage { - entryServiceName/entryServiceId - parentServiceName/parentServiceId - peerId/peer -- componentId为默认支持的插件id,非官方支持,需传输名称或修改服务端源代码。[官方组件列表](https://github.com/apache/incubator-skywalking/blob/master/apm-network/src/main/java/org.apache.skywalking.apm/network/trace/component/ComponentsDefine.java) +- componentId为默认支持的插件id,非官方支持,需传输名称或修改服务端源代码。[官方组件列表](../../apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java) From 94cd91db7347f2d2da1b7ecae6868ae4ca921c19 Mon Sep 17 00:00:00 2001 From: wusheng Date: Tue, 19 Dec 2017 22:23:19 +0800 Subject: [PATCH 8/8] Fix a class name. --- docs/cn/skywalking-opentracing-CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cn/skywalking-opentracing-CN.md b/docs/cn/skywalking-opentracing-CN.md index ff8287f94..588641915 100644 --- a/docs/cn/skywalking-opentracing-CN.md +++ b/docs/cn/skywalking-opentracing-CN.md @@ -11,7 +11,7 @@ * 使用OpenTracing的标准API和桥接器,使用手动埋点 ```java -Tracer tracer = new org.apache.skywalking.apm.toolkit.opentracing.SkyWalkingTracer(); +Tracer tracer = new org.apache.skywalking.apm.toolkit.opentracing.SkywalkingTracer(); Tracer.SpanBuilder spanBuilder = tracer.buildSpan("/yourApplication/yourService"); ```