Commit 8bfa648b authored by 吴晟's avatar 吴晟
Browse files

Provide a new method for creating exit span.

parent 2169b112
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -108,6 +108,12 @@ public class ContextManager implements TracingContextListener, BootService, Igno
        return span;
    }

    public static AbstractSpan createExitSpan(String operationName, String remotePeer) {
        AbstractTracerContext context = getOrCreate(operationName, false);
        AbstractSpan span = context.createExitSpan(operationName, remotePeer);
        return span;
    }

    public static void inject(ContextCarrier carrier) {
        get().inject(carrier);
    }
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ public class CallableStatementTracing {
            } else {
                remotePeer = connectInfo.getHost() + ":" + connectInfo.getPort();
            }
            AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/CallableStatement/" + method, new ContextCarrier(), remotePeer);
            AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/CallableStatement/" + method, remotePeer);
            Tags.DB_TYPE.set(span, "sql");
            SpanLayer.asDB(span);
            Tags.DB_INSTANCE.set(span, connectInfo.getDatabaseName());
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ public class ConnectionTracing {
            } else {
                remotePeer = connectInfo.getHost() + ":" + connectInfo.getPort();
            }
            AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/Connection/" + method, new ContextCarrier(), remotePeer);
            AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/Connection/" + method, remotePeer);
            Tags.DB_TYPE.set(span, "sql");
            Tags.DB_INSTANCE.set(span, connectInfo.getDatabaseName());
            Tags.DB_STATEMENT.set(span, sql);
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ public class StatementTracing {
                remotePeer = connectInfo.getHost() + ":" + connectInfo.getPort();
            }

            AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/Statement/" + method, new ContextCarrier(), remotePeer);
            AbstractSpan span = ContextManager.createExitSpan(connectInfo.getDBType() + "/JDBI/Statement/" + method, remotePeer);
            Tags.DB_TYPE.set(span, "sql");
            Tags.DB_INSTANCE.set(span, connectInfo.getDatabaseName());
            Tags.DB_STATEMENT.set(span, sql);
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ public class JedisMethodInterceptor implements InstanceMethodsAroundInterceptor
    @Override public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
        Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
        String peer = String.valueOf(objInst.getSkyWalkingDynamicField());
        AbstractSpan span = ContextManager.createExitSpan("Jedis/" + method.getName(), new ContextCarrier(), peer);
        AbstractSpan span = ContextManager.createExitSpan("Jedis/" + method.getName(), peer);
        span.setComponent(ComponentsDefine.REDIS);
        Tags.DB_TYPE.set(span, "Redis");
        SpanLayer.asDB(span);
Loading