Loading apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/skywalking/apm/plugin/jdbc/ConnectionServiceMethodInterceptor.java +3 −10 Original line number Diff line number Diff line Loading @@ -27,15 +27,14 @@ import org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; import org.skywalking.apm.plugin.jdbc.trace.ConnectionInfo; import org.skywalking.apm.util.StringUtil; /** * {@link ConnectionServiceMethodInterceptor} create an exit span when the client call the following methods in the class * that extend {@link java.sql.Connection}. * {@link ConnectionServiceMethodInterceptor} create an exit span when the following methods execute: * 1. close * 2. rollback * 3. releaseSavepoint * 4. commit * * @author zhangxin */ public class ConnectionServiceMethodInterceptor implements InstanceMethodsAroundInterceptor { Loading @@ -45,13 +44,7 @@ public class ConnectionServiceMethodInterceptor implements InstanceMethodsAround Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable { ConnectionInfo connectInfo = (ConnectionInfo)objInst.getSkyWalkingDynamicField(); String remotePeer; if (!StringUtil.isEmpty(connectInfo.getHosts())) { remotePeer = connectInfo.getHosts(); } else { remotePeer = connectInfo.getHost() + ":" + connectInfo.getPort(); } AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/Connection/" + method.getName(), remotePeer); AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/Connection/" + method.getName(), connectInfo.getDatabasePeer()); Tags.DB_TYPE.set(span, "sql"); Tags.DB_INSTANCE.set(span, connectInfo.getDatabaseName()); Tags.DB_STATEMENT.set(span, ""); Loading apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/skywalking/apm/plugin/jdbc/trace/CallableStatementTracing.java +1 −8 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import org.skywalking.apm.agent.core.context.ContextManager; import org.skywalking.apm.agent.core.context.tag.Tags; import org.skywalking.apm.agent.core.context.trace.AbstractSpan; import org.skywalking.apm.agent.core.context.trace.SpanLayer; import org.skywalking.apm.util.StringUtil; /** * {@link CallableStatementTracing} create an exit span when the client call the method in the class that extend {@link Loading @@ -37,13 +36,7 @@ public class CallableStatementTracing { ConnectionInfo connectInfo, String method, String sql, Executable<R> exec) throws SQLException { try { String remotePeer; if (!StringUtil.isEmpty(connectInfo.getHosts())) { remotePeer = connectInfo.getHosts(); } else { remotePeer = connectInfo.getHost() + ":" + connectInfo.getPort(); } AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/CallableStatement/" + method, remotePeer); AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/CallableStatement/" + method, connectInfo.getDatabasePeer()); Tags.DB_TYPE.set(span, "sql"); SpanLayer.asDB(span); Tags.DB_INSTANCE.set(span, connectInfo.getDatabaseName()); Loading apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/skywalking/apm/plugin/jdbc/trace/ConnectionInfo.java +6 −25 Original line number Diff line number Diff line Loading @@ -31,22 +31,12 @@ public class ConnectionInfo { * DB type, such as mysql, oracle, h2. */ private final String dbType; /** * Database host name. */ private String host; /** * Database port. */ private int port; /** * Operation database name. */ private final String databaseName; /** * Database hosts. */ private String hosts; private String databasePeer; /** * Component Loading @@ -55,15 +45,14 @@ public class ConnectionInfo { public ConnectionInfo(OfficialComponent component, String dbType, String host, int port, String databaseName) { this.dbType = dbType; this.host = host; this.port = port; this.databasePeer = host + ":" + port; this.databaseName = databaseName; this.component = component; } public ConnectionInfo(OfficialComponent component, String dbType, String hosts, String databaseName) { this.dbType = dbType; this.hosts = hosts; this.databasePeer = hosts; this.databaseName = databaseName; this.component = component; } Loading @@ -72,20 +61,12 @@ public class ConnectionInfo { return dbType; } public String getHost() { return host; } public int getPort() { return port; } public String getDatabaseName() { return databaseName; } public String getHosts() { return hosts; public String getDatabasePeer() { return databasePeer; } public OfficialComponent getComponent() { Loading apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/skywalking/apm/plugin/jdbc/trace/PreparedStatementTracing.java +1 −9 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import org.skywalking.apm.agent.core.context.ContextManager; import org.skywalking.apm.agent.core.context.tag.Tags; import org.skywalking.apm.agent.core.context.trace.AbstractSpan; import org.skywalking.apm.agent.core.context.trace.SpanLayer; import org.skywalking.apm.util.StringUtil; /** * {@link PreparedStatementTracing} create an exit span when the client call the method in the class that extend {@link Loading @@ -37,14 +36,7 @@ public class PreparedStatementTracing { ConnectionInfo connectInfo, String method, String sql, Executable<R> exec) throws SQLException { try { String remotePeer; if (!StringUtil.isEmpty(connectInfo.getHosts())) { remotePeer = connectInfo.getHosts(); } else { remotePeer = connectInfo.getHost() + ":" + connectInfo.getPort(); } AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/PreparedStatement/" + method, remotePeer); AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/PreparedStatement/" + method, connectInfo.getDatabasePeer()); Tags.DB_TYPE.set(span, "sql"); Tags.DB_INSTANCE.set(span, connectInfo.getDatabaseName()); Tags.DB_STATEMENT.set(span, sql); Loading apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/skywalking/apm/plugin/jdbc/trace/StatementTracing.java +1 −9 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import org.skywalking.apm.agent.core.context.ContextManager; import org.skywalking.apm.agent.core.context.tag.Tags; import org.skywalking.apm.agent.core.context.trace.AbstractSpan; import org.skywalking.apm.agent.core.context.trace.SpanLayer; import org.skywalking.apm.util.StringUtil; /** * {@link PreparedStatementTracing} create an exit span when the client call the method in the class that extend {@link Loading @@ -36,14 +35,7 @@ public class StatementTracing { ConnectionInfo connectInfo, String method, String sql, Executable<R> exec) throws SQLException { try { String remotePeer; if (!StringUtil.isEmpty(connectInfo.getHosts())) { remotePeer = connectInfo.getHosts(); } else { remotePeer = connectInfo.getHost() + ":" + connectInfo.getPort(); } AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/Statement/" + method, remotePeer); AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/Statement/" + method, connectInfo.getDatabasePeer()); Tags.DB_TYPE.set(span, "sql"); Tags.DB_INSTANCE.set(span, connectInfo.getDatabaseName()); Tags.DB_STATEMENT.set(span, sql); Loading Loading
apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/skywalking/apm/plugin/jdbc/ConnectionServiceMethodInterceptor.java +3 −10 Original line number Diff line number Diff line Loading @@ -27,15 +27,14 @@ import org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; import org.skywalking.apm.plugin.jdbc.trace.ConnectionInfo; import org.skywalking.apm.util.StringUtil; /** * {@link ConnectionServiceMethodInterceptor} create an exit span when the client call the following methods in the class * that extend {@link java.sql.Connection}. * {@link ConnectionServiceMethodInterceptor} create an exit span when the following methods execute: * 1. close * 2. rollback * 3. releaseSavepoint * 4. commit * * @author zhangxin */ public class ConnectionServiceMethodInterceptor implements InstanceMethodsAroundInterceptor { Loading @@ -45,13 +44,7 @@ public class ConnectionServiceMethodInterceptor implements InstanceMethodsAround Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable { ConnectionInfo connectInfo = (ConnectionInfo)objInst.getSkyWalkingDynamicField(); String remotePeer; if (!StringUtil.isEmpty(connectInfo.getHosts())) { remotePeer = connectInfo.getHosts(); } else { remotePeer = connectInfo.getHost() + ":" + connectInfo.getPort(); } AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/Connection/" + method.getName(), remotePeer); AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/Connection/" + method.getName(), connectInfo.getDatabasePeer()); Tags.DB_TYPE.set(span, "sql"); Tags.DB_INSTANCE.set(span, connectInfo.getDatabaseName()); Tags.DB_STATEMENT.set(span, ""); Loading
apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/skywalking/apm/plugin/jdbc/trace/CallableStatementTracing.java +1 −8 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import org.skywalking.apm.agent.core.context.ContextManager; import org.skywalking.apm.agent.core.context.tag.Tags; import org.skywalking.apm.agent.core.context.trace.AbstractSpan; import org.skywalking.apm.agent.core.context.trace.SpanLayer; import org.skywalking.apm.util.StringUtil; /** * {@link CallableStatementTracing} create an exit span when the client call the method in the class that extend {@link Loading @@ -37,13 +36,7 @@ public class CallableStatementTracing { ConnectionInfo connectInfo, String method, String sql, Executable<R> exec) throws SQLException { try { String remotePeer; if (!StringUtil.isEmpty(connectInfo.getHosts())) { remotePeer = connectInfo.getHosts(); } else { remotePeer = connectInfo.getHost() + ":" + connectInfo.getPort(); } AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/CallableStatement/" + method, remotePeer); AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/CallableStatement/" + method, connectInfo.getDatabasePeer()); Tags.DB_TYPE.set(span, "sql"); SpanLayer.asDB(span); Tags.DB_INSTANCE.set(span, connectInfo.getDatabaseName()); Loading
apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/skywalking/apm/plugin/jdbc/trace/ConnectionInfo.java +6 −25 Original line number Diff line number Diff line Loading @@ -31,22 +31,12 @@ public class ConnectionInfo { * DB type, such as mysql, oracle, h2. */ private final String dbType; /** * Database host name. */ private String host; /** * Database port. */ private int port; /** * Operation database name. */ private final String databaseName; /** * Database hosts. */ private String hosts; private String databasePeer; /** * Component Loading @@ -55,15 +45,14 @@ public class ConnectionInfo { public ConnectionInfo(OfficialComponent component, String dbType, String host, int port, String databaseName) { this.dbType = dbType; this.host = host; this.port = port; this.databasePeer = host + ":" + port; this.databaseName = databaseName; this.component = component; } public ConnectionInfo(OfficialComponent component, String dbType, String hosts, String databaseName) { this.dbType = dbType; this.hosts = hosts; this.databasePeer = hosts; this.databaseName = databaseName; this.component = component; } Loading @@ -72,20 +61,12 @@ public class ConnectionInfo { return dbType; } public String getHost() { return host; } public int getPort() { return port; } public String getDatabaseName() { return databaseName; } public String getHosts() { return hosts; public String getDatabasePeer() { return databasePeer; } public OfficialComponent getComponent() { Loading
apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/skywalking/apm/plugin/jdbc/trace/PreparedStatementTracing.java +1 −9 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import org.skywalking.apm.agent.core.context.ContextManager; import org.skywalking.apm.agent.core.context.tag.Tags; import org.skywalking.apm.agent.core.context.trace.AbstractSpan; import org.skywalking.apm.agent.core.context.trace.SpanLayer; import org.skywalking.apm.util.StringUtil; /** * {@link PreparedStatementTracing} create an exit span when the client call the method in the class that extend {@link Loading @@ -37,14 +36,7 @@ public class PreparedStatementTracing { ConnectionInfo connectInfo, String method, String sql, Executable<R> exec) throws SQLException { try { String remotePeer; if (!StringUtil.isEmpty(connectInfo.getHosts())) { remotePeer = connectInfo.getHosts(); } else { remotePeer = connectInfo.getHost() + ":" + connectInfo.getPort(); } AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/PreparedStatement/" + method, remotePeer); AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/PreparedStatement/" + method, connectInfo.getDatabasePeer()); Tags.DB_TYPE.set(span, "sql"); Tags.DB_INSTANCE.set(span, connectInfo.getDatabaseName()); Tags.DB_STATEMENT.set(span, sql); Loading
apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/skywalking/apm/plugin/jdbc/trace/StatementTracing.java +1 −9 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import org.skywalking.apm.agent.core.context.ContextManager; import org.skywalking.apm.agent.core.context.tag.Tags; import org.skywalking.apm.agent.core.context.trace.AbstractSpan; import org.skywalking.apm.agent.core.context.trace.SpanLayer; import org.skywalking.apm.util.StringUtil; /** * {@link PreparedStatementTracing} create an exit span when the client call the method in the class that extend {@link Loading @@ -36,14 +35,7 @@ public class StatementTracing { ConnectionInfo connectInfo, String method, String sql, Executable<R> exec) throws SQLException { try { String remotePeer; if (!StringUtil.isEmpty(connectInfo.getHosts())) { remotePeer = connectInfo.getHosts(); } else { remotePeer = connectInfo.getHost() + ":" + connectInfo.getPort(); } AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/Statement/" + method, remotePeer); AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/Statement/" + method, connectInfo.getDatabasePeer()); Tags.DB_TYPE.set(span, "sql"); Tags.DB_INSTANCE.set(span, connectInfo.getDatabaseName()); Tags.DB_STATEMENT.set(span, sql); Loading