diff --git a/README.md b/README.md index ce3286b26af2d1abb3fb79df22b583fdfdfb6a0f..625d210bcc4cc6b010bed641714ab03f3a1bee49 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ This project adheres to the Contributor Covenant [code of conduct](CODE_OF_CONDU [Open Skywalking Organization Teams and Contributors](https://github.com/OpenSkywalking/Organization/blob/master/README.md) # Partners - + # License [Apache 2.0 License.](/LICENSE) diff --git a/README_ZH.md b/README_ZH.md index 78bf6fce3dc45552396579d17e4ce271350c6dd0..32374fd7588b74adfe98e73ccae89c4d54e943e1 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -68,7 +68,7 @@ This project adheres to the Contributor Covenant [code of conduct](CODE_OF_CONDU [Open Skywalking Organization Teams and Contributors](https://github.com/OpenSkywalking/Organization/blob/master/README.md) # Partners - + # License [Apache 2.0 License.](/LICENSE) diff --git a/apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentSpanListener.java b/apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentSpanListener.java index fe24049d518b38ecf7fbf1098bdc331547e7548f..1eb17e2239b0d587a60c1217792368d423f5826a 100644 --- a/apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentSpanListener.java +++ b/apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentSpanListener.java @@ -60,6 +60,7 @@ public class NodeComponentSpanListener implements EntrySpanListener, ExitSpanLis } nodeComponent.setPeerId(spanDecorator.getPeerId()); + nodeComponent.setPeer(Const.EMPTY_STRING); id = id + Const.ID_SPLIT + nodeComponent.getPeerId(); nodeComponent.setId(id); nodeComponents.add(nodeComponent); @@ -81,6 +82,7 @@ public class NodeComponentSpanListener implements EntrySpanListener, ExitSpanLis } nodeComponent.setPeerId(applicationId); + nodeComponent.setPeer(Const.EMPTY_STRING); id = id + Const.ID_SPLIT + String.valueOf(applicationId); nodeComponent.setId(id); diff --git a/apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/NodeMappingSpanListener.java b/apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/NodeMappingSpanListener.java index 319f917a0347033e513366bb46ea8247bccc6de3..410830ea88e83c579a7f00de9e52ef4ac3c60011 100644 --- a/apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/NodeMappingSpanListener.java +++ b/apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/NodeMappingSpanListener.java @@ -51,6 +51,7 @@ public class NodeMappingSpanListener implements RefsListener, FirstSpanListener NodeMappingDataDefine.NodeMapping nodeMapping = new NodeMappingDataDefine.NodeMapping(); nodeMapping.setApplicationId(applicationId); nodeMapping.setAddressId(referenceDecorator.getNetworkAddressId()); + nodeMapping.setAddress(Const.EMPTY_STRING); String id = String.valueOf(applicationId) + Const.ID_SPLIT + String.valueOf(nodeMapping.getAddressId()); nodeMapping.setId(id); nodeMappings.add(nodeMapping); diff --git a/apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferenceSpanListener.java b/apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferenceSpanListener.java index 61888efd0a23d8e002e339ee18fd012c326c162b..ccbcd8189587fb6db8d7b34a6c634a0de03b0f44 100644 --- a/apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferenceSpanListener.java +++ b/apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferenceSpanListener.java @@ -53,6 +53,7 @@ public class NodeReferenceSpanListener implements EntrySpanListener, ExitSpanLis NodeReferenceDataDefine.NodeReference nodeReference = new NodeReferenceDataDefine.NodeReference(); nodeReference.setFrontApplicationId(applicationId); nodeReference.setBehindApplicationId(spanDecorator.getPeerId()); + nodeReference.setBehindPeer(Const.EMPTY_STRING); nodeReference.setTimeBucket(TimeBucketUtils.INSTANCE.getMinuteTimeBucket(spanDecorator.getStartTime())); StringBuilder idBuilder = new StringBuilder(); @@ -79,6 +80,7 @@ public class NodeReferenceSpanListener implements EntrySpanListener, ExitSpanLis NodeReferenceDataDefine.NodeReference nodeReference = new NodeReferenceDataDefine.NodeReference(); nodeReference.setFrontApplicationId(Const.USER_ID); nodeReference.setBehindApplicationId(applicationId); + nodeReference.setBehindPeer(Const.EMPTY_STRING); nodeReference.setTimeBucket(TimeBucketUtils.INSTANCE.getMinuteTimeBucket(spanDecorator.getStartTime())); String idBuilder = String.valueOf(nodeReference.getTimeBucket()) + Const.ID_SPLIT + nodeReference.getFrontApplicationId() + @@ -96,6 +98,7 @@ public class NodeReferenceSpanListener implements EntrySpanListener, ExitSpanLis NodeReferenceDataDefine.NodeReference referenceSum = new NodeReferenceDataDefine.NodeReference(); referenceSum.setFrontApplicationId(parentApplicationId); referenceSum.setBehindApplicationId(applicationId); + referenceSum.setBehindPeer(Const.EMPTY_STRING); references.add(referenceSum); } diff --git a/apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferenceSpanListener.java b/apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferenceSpanListener.java index 63ec5d86238c18072a63376f9abd572276777090..dc7a0cb65cea2de4b222a96a64270cd5c073e6ee 100644 --- a/apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferenceSpanListener.java +++ b/apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferenceSpanListener.java @@ -127,12 +127,15 @@ public class ServiceReferenceSpanListener implements FirstSpanListener, EntrySpa idBuilder.append(entryServiceId).append(Const.ID_SPLIT); serviceReference.setEntryServiceId(entryServiceId); + serviceReference.setEntryServiceName(Const.EMPTY_STRING); idBuilder.append(frontServiceId).append(Const.ID_SPLIT); serviceReference.setFrontServiceId(frontServiceId); + serviceReference.setFrontServiceName(Const.EMPTY_STRING); idBuilder.append(behindServiceId); serviceReference.setBehindServiceId(behindServiceId); + serviceReference.setBehindServiceName(Const.EMPTY_STRING); serviceReference.setId(idBuilder.toString()); serviceReference.setTimeBucket(timeBucket); diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/postgresql/define/Jdbc3ConnectionInstrumentation.java b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/postgresql/define/Jdbc3ConnectionInstrumentation.java index 54c8cc4856e480efdfa127543f2dd8bcc7c1f28b..191d8607b16ddc539741d3b9f68c49cb787b0880 100644 --- a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/postgresql/define/Jdbc3ConnectionInstrumentation.java +++ b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/postgresql/define/Jdbc3ConnectionInstrumentation.java @@ -41,8 +41,8 @@ import static org.skywalking.apm.plugin.jdbc.define.Constants.ROLLBACK_METHOD_NA import static org.skywalking.apm.plugin.jdbc.define.Constants.SERVICE_METHOD_INTERCEPT_CLASS; /** - * {@link ConnectionInstrumentation} intercept the following methods that the class which extend {@link - * org.postgresql.jdbc.PgConnection}.
+ * {@link Jdbc3ConnectionInstrumentation} intercept the following methods that the class which extend {@link + * org.postgresql.jdbc3.Jdbc3Connection}.
* * 1. Enhance prepareStatement by org.skywalking.apm.plugin.jdbc.define.JDBCPrepareStatementInterceptor * 2. Enhance prepareCall by diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/postgresql/define/Jdbc4ConnectionInstrumentation.java b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/postgresql/define/Jdbc4ConnectionInstrumentation.java new file mode 100644 index 0000000000000000000000000000000000000000..7be5b62f6032d16adf51dbaa4f1e9a42ba7e8a22 --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/postgresql/define/Jdbc4ConnectionInstrumentation.java @@ -0,0 +1,124 @@ +/* + * Copyright 2017, OpenSkywalking Organization All rights reserved. + * + * Licensed 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. + * + * Project repository: https://github.com/OpenSkywalking/skywalking + */ + +package org.skywalking.apm.plugin.jdbc.postgresql.define; + +import net.bytebuddy.description.method.MethodDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; +import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; +import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; +import org.skywalking.apm.agent.core.plugin.match.ClassMatch; + +import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.takesArguments; +import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName; +import static org.skywalking.apm.plugin.jdbc.define.Constants.CLOSE_METHOD_NAME; +import static org.skywalking.apm.plugin.jdbc.define.Constants.COMMIT_METHOD_NAME; +import static org.skywalking.apm.plugin.jdbc.define.Constants.CREATE_STATEMENT_INTERCEPT_CLASS; +import static org.skywalking.apm.plugin.jdbc.define.Constants.CREATE_STATEMENT_METHOD_NAME; +import static org.skywalking.apm.plugin.jdbc.define.Constants.PREPARE_CALL_INTERCEPT_CLASS; +import static org.skywalking.apm.plugin.jdbc.define.Constants.PREPARE_CALL_METHOD_NAME; +import static org.skywalking.apm.plugin.jdbc.define.Constants.PREPARE_STATEMENT_INTERCEPT_CLASS; +import static org.skywalking.apm.plugin.jdbc.define.Constants.PREPARE_STATEMENT_METHOD_NAME; +import static org.skywalking.apm.plugin.jdbc.define.Constants.RELEASE_SAVE_POINT_METHOD_NAME; +import static org.skywalking.apm.plugin.jdbc.define.Constants.ROLLBACK_METHOD_NAME; +import static org.skywalking.apm.plugin.jdbc.define.Constants.SERVICE_METHOD_INTERCEPT_CLASS; + +/** + * {@link Jdbc4ConnectionInstrumentation} intercept the following methods that the class which extend {@link + * org.postgresql.jdbc4.Jdbc4Connection}.
+ * + * 1. Enhance prepareStatement by org.skywalking.apm.plugin.jdbc.define.JDBCPrepareStatementInterceptor + * 2. Enhance prepareCall by + * org.skywalking.apm.plugin.jdbc.define.JDBCPrepareCallInterceptor + * 3. Enhance createStatement + * by org.skywalking.apm.plugin.jdbc.define.JDBCStatementInterceptor + * 4. Enhance commit, rollback, close, releaseSavepoint by org.skywalking.apm.plugin.jdbc.define.ConnectionServiceMethodInterceptor + * + * @author zhangxin + */ +public class Jdbc4ConnectionInstrumentation extends ClassInstanceMethodsEnhancePluginDefine { + + public static final String ENHANCE_CLASS = "org.postgresql.jdbc4.Jdbc4Connection"; + + @Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() { + return new ConstructorInterceptPoint[0]; + } + + @Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { + return new InstanceMethodsInterceptPoint[] { + new InstanceMethodsInterceptPoint() { + @Override public ElementMatcher getMethodsMatcher() { + return named(PREPARE_STATEMENT_METHOD_NAME).and(takesArguments(4)); + } + + @Override public String getMethodsInterceptor() { + return PREPARE_STATEMENT_INTERCEPT_CLASS; + } + + @Override public boolean isOverrideArgs() { + return false; + } + }, + new InstanceMethodsInterceptPoint() { + @Override public ElementMatcher getMethodsMatcher() { + return named(PREPARE_CALL_METHOD_NAME).and(takesArguments(4)); + } + + @Override public String getMethodsInterceptor() { + return PREPARE_CALL_INTERCEPT_CLASS; + } + + @Override public boolean isOverrideArgs() { + return false; + } + }, + new InstanceMethodsInterceptPoint() { + @Override public ElementMatcher getMethodsMatcher() { + return named(CREATE_STATEMENT_METHOD_NAME).and(takesArguments(3)); + } + + @Override public String getMethodsInterceptor() { + return CREATE_STATEMENT_INTERCEPT_CLASS; + } + + @Override public boolean isOverrideArgs() { + return false; + } + }, + new InstanceMethodsInterceptPoint() { + @Override public ElementMatcher getMethodsMatcher() { + return named(COMMIT_METHOD_NAME).or(named(ROLLBACK_METHOD_NAME)).or(named(CLOSE_METHOD_NAME)).or(named(RELEASE_SAVE_POINT_METHOD_NAME)); + } + + @Override public String getMethodsInterceptor() { + return SERVICE_METHOD_INTERCEPT_CLASS; + } + + @Override public boolean isOverrideArgs() { + return false; + } + } + }; + } + + @Override protected ClassMatch enhanceClass() { + return byName(ENHANCE_CLASS); + } +} diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/resources/skywalking-plugin.def index 816cdda1003b15a6407d025410905ad89af8a33e..3fe0ad09bc367d8700b902b01c9cd02549f88cd2 100644 --- a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/resources/skywalking-plugin.def +++ b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/resources/skywalking-plugin.def @@ -1,3 +1,4 @@ postgresql-8.x=org.skywalking.apm.plugin.jdbc.postgresql.define.DriverInstrumentation postgresql-8.x=org.skywalking.apm.plugin.jdbc.postgresql.define.Jdbc3ConnectionInstrumentation +postgresql-8.x=org.skywalking.apm.plugin.jdbc.postgresql.define.Jdbc4ConnectionInstrumentation postgresql-8.x=org.skywalking.apm.plugin.jdbc.postgresql.define.ConnectionInstrumentation