Search in sources :

Example 21 with ConnectionInfo

use of org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo in project incubator-skywalking by apache.

the class ConnectionServiceMethodInterceptor method beforeMethod.

@Override
public final void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
    ConnectionInfo connectInfo = (ConnectionInfo) objInst.getSkyWalkingDynamicField();
    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, "");
    span.setComponent(connectInfo.getComponent());
    SpanLayer.asDB(span);
}
Also used : ConnectionInfo(org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo) AbstractSpan(org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan)

Aggregations

ConnectionInfo (org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo)21 Test (org.junit.Test)14 AbstractSpan (org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan)7 StatementEnhanceInfos (org.apache.skywalking.apm.plugin.jdbc.define.StatementEnhanceInfos)6