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
|
||||
* Bump up grpc to 1.50.0 to fix CVE-2022-3171
|
||||
* Polish up nats plugin to unify MQ related tags
|
||||
* Correct the duration of the transaction span for Neo4J 4.x.
|
||||
|
||||
#### Documentation
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
package org.apache.skywalking.apm.plugin.neo4j.v4x;
|
||||
|
||||
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.tag.Tags;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
|
||||
|
|
@ -61,13 +62,15 @@ public class TransactionRunInterceptor implements InstanceMethodsAroundIntercept
|
|||
@Override
|
||||
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
|
||||
Object ret) throws Throwable {
|
||||
SessionRequiredInfo requiredInfo = (SessionRequiredInfo) objInst.getSkyWalkingDynamicField();
|
||||
if (requiredInfo == null || requiredInfo.getSpan() == null) {
|
||||
return ret;
|
||||
}
|
||||
return ((CompletionStage<?>) ret).thenApply(resultCursor -> {
|
||||
SessionRequiredInfo requiredInfo = (SessionRequiredInfo) objInst.getSkyWalkingDynamicField();
|
||||
if (requiredInfo == null || requiredInfo.getSpan() == null) {
|
||||
return resultCursor;
|
||||
}
|
||||
|
||||
requiredInfo.getSpan().asyncFinish();
|
||||
return ret;
|
||||
requiredInfo.getSpan().asyncFinish();
|
||||
return resultCursor;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue