[GitHub] [skywalking] kezhenxu94 commented on a change in pull request #5842: Add the plugin for mssql-jtds 1.x plugin.
kezhenxu94 commented on a change in pull request #5842: URL: https://github.com/apache/skywalking/pull/5842#discussion_r523709168 ## File path: apm-sniffer/apm-sdk-plugin/mssql-jtds-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/mssql/jtds/v1/define/AbstractConnectionInstrumentation.java ## @@ -0,0 +1,150 @@ +/* + * 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.mssql.jtds.v1.define; + +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.plugin.jdbc.define.Constants; + +import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.takesArguments; + +/** + * {@link AbstractConnectionInstrumentation} define how to enhance the following methods that the class which extend + * {@link java.sql.Connection}. + * + * 1. Enhance prepareStatement by org.apache.skywalking.apm.plugin.jdbc.define.JDBCPrepareStatementInterceptor + * 3. Enhance prepareCall by org.apache.skywalking.apm.plugin.jdbc.define.JDBCPrepareCallInterceptor + * 4. Enhance createStatement by org.apache.skywalking.apm.plugin.jdbc.define.JDBCStatementInterceptor + * 5. Enhance commit, rollback, close, releaseSavepoint by org.apache.skywalking.apm.plugin.jdbc.define.ConnectionServiceMethodInterceptor Review comment: ```suggestion * 1. Enhance prepareStatement by org.apache.skywalking.apm.plugin.jdbc.define.JDBCPrepareStatementInterceptor * 2. Enhance prepareCall by org.apache.skywalking.apm.plugin.jdbc.define.JDBCPrepareCallInterceptor * 3. Enhance createStatement by org.apache.skywalking.apm.plugin.jdbc.define.JDBCStatementInterceptor * 4. Enhance commit, rollback, close, releaseSavepoint by org.apache.skywalking.apm.plugin.jdbc.define.ConnectionServiceMethodInterceptor ``` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [skywalking] kezhenxu94 commented on a change in pull request #5842: Add the plugin for mssql-jtds 1.x plugin.
kezhenxu94 commented on a change in pull request #5842: URL: https://github.com/apache/skywalking/pull/5842#discussion_r523690770 ## File path: .github/workflows/plugins-test.0.yaml ## @@ -70,6 +70,7 @@ jobs: - gson-scenario - elasticjob-3.x-scenario - springmvc-reactive-scenario + - mssql-jtds-scenario Review comment: Put this in file `plugins-test.1.yaml` ## File path: apm-sniffer/apm-sdk-plugin/mssql-jtds-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/mssql/jtds/v1/define/ConnectionJDBC2Instrumentation.java ## @@ -0,0 +1,35 @@ +/* + * 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.mssql.jtds.v1.define; + +import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; + +import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName; + +/** + * {@link ConnectionJDBC2Instrumentation} presents that skywalking intercepts {@link net.sourceforge.jtds.jdbc.ConnectionJDBC2}. + */ +public class ConnectionJDBC2Instrumentation extends AbstractConnectionInstrumentation { +public static final String ENHANCE_CLASS = "net.sourceforge.jtds.jdbc.ConnectionJDBC2"; + +@Override +protected ClassMatch enhanceClass() { +return byName(ENHANCE_CLASS); Review comment: Why not use `org.apache.skywalking.apm.agent.core.plugin.match.MultiClassNameMatch` so that you don't need several subclasses? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [skywalking] kezhenxu94 commented on a change in pull request #5842: Add the plugin for mssql-jtds 1.x plugin.
kezhenxu94 commented on a change in pull request #5842: URL: https://github.com/apache/skywalking/pull/5842#discussion_r523670862 ## File path: .github/workflows/plugins-test.0.yaml ## @@ -70,6 +70,7 @@ jobs: - gson-scenario - elasticjob-3.x-scenario - springmvc-reactive-scenario + - mssql-jtds-scenario Review comment: Put this to `plugins-test.1.yaml` ## File path: apm-sniffer/apm-sdk-plugin/mssql-jtds-1.x-plugin/pom.xml ## @@ -0,0 +1,51 @@ + + +http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> + +apm-sdk-plugin +org.apache.skywalking +8.3.0-SNAPSHOT + +4.0.0 + +apm-mssql-jtds-1.x-plugin +jar + +mssql-jtds-1.x-plugin +http://maven.apache.org + + +1.2.6 + + + + +org.apache.skywalking +apm-jdbc-commons +${project.version} +provided Review comment: This line is unnecessary, (harmless though) ## File path: apm-sniffer/apm-sdk-plugin/mssql-jtds-1.x-plugin/pom.xml ## @@ -0,0 +1,51 @@ + + +http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> + +apm-sdk-plugin +org.apache.skywalking +8.3.0-SNAPSHOT + +4.0.0 + +apm-mssql-jtds-1.x-plugin +jar + +mssql-jtds-1.x-plugin +http://maven.apache.org + + +1.2.6 + + + + +org.apache.skywalking +apm-jdbc-commons +${project.version} +provided + + + +net.sourceforge.jtds +jtds +${mssql-jtds.version} + Review comment: Should be `provided` scope This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org