Correct the duration of the transaction span for Neo4J 4.x (#353)
* Fix https://github.com/apache/skywalking/issues/9800, wait for the end of the transaction to close the span.
This commit is contained in:
parent
23b3c2d35e
commit
bd76d1a618
|
|
@ -16,6 +16,7 @@ Release Notes.
|
||||||
* Update `compose-start-script.template` to make compatible with new version docker compose
|
* Update `compose-start-script.template` to make compatible with new version docker compose
|
||||||
* Bump up grpc to 1.50.0 to fix CVE-2022-3171
|
* Bump up grpc to 1.50.0 to fix CVE-2022-3171
|
||||||
* Polish up nats plugin to unify MQ related tags
|
* Polish up nats plugin to unify MQ related tags
|
||||||
|
* Correct the duration of the transaction span for Neo4J 4.x.
|
||||||
|
|
||||||
#### Documentation
|
#### Documentation
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
package org.apache.skywalking.apm.plugin.neo4j.v4x;
|
package org.apache.skywalking.apm.plugin.neo4j.v4x;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.concurrent.CompletionStage;
|
||||||
import org.apache.skywalking.apm.agent.core.context.ContextManager;
|
import org.apache.skywalking.apm.agent.core.context.ContextManager;
|
||||||
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
|
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
|
||||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
|
import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
|
||||||
|
|
@ -61,13 +62,15 @@ public class TransactionRunInterceptor implements InstanceMethodsAroundIntercept
|
||||||
@Override
|
@Override
|
||||||
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
|
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
|
||||||
Object ret) throws Throwable {
|
Object ret) throws Throwable {
|
||||||
SessionRequiredInfo requiredInfo = (SessionRequiredInfo) objInst.getSkyWalkingDynamicField();
|
return ((CompletionStage<?>) ret).thenApply(resultCursor -> {
|
||||||
if (requiredInfo == null || requiredInfo.getSpan() == null) {
|
SessionRequiredInfo requiredInfo = (SessionRequiredInfo) objInst.getSkyWalkingDynamicField();
|
||||||
return ret;
|
if (requiredInfo == null || requiredInfo.getSpan() == null) {
|
||||||
}
|
return resultCursor;
|
||||||
|
}
|
||||||
|
|
||||||
requiredInfo.getSpan().asyncFinish();
|
requiredInfo.getSpan().asyncFinish();
|
||||||
return ret;
|
return resultCursor;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue