From c4728bf10548d6c4db1d79db87248466629060d2 Mon Sep 17 00:00:00 2001 From: Yu Ning <78631860+Chillax-0v0@users.noreply.github.com> Date: Wed, 31 Jan 2024 18:26:16 +0800 Subject: [PATCH] perf(s3stream): comment out the trace aspect (#911) Signed-off-by: Ning Yu --- .../s3/trace/aop/S3StreamTraceAspect.java | 36 +++++++++---------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/s3stream/src/main/java/com/automq/stream/s3/trace/aop/S3StreamTraceAspect.java b/s3stream/src/main/java/com/automq/stream/s3/trace/aop/S3StreamTraceAspect.java index a4923c5df..c2bdd5a6d 100644 --- a/s3stream/src/main/java/com/automq/stream/s3/trace/aop/S3StreamTraceAspect.java +++ b/s3stream/src/main/java/com/automq/stream/s3/trace/aop/S3StreamTraceAspect.java @@ -17,29 +17,25 @@ package com.automq.stream.s3.trace.aop; -import com.automq.stream.s3.trace.TraceUtils; -import com.automq.stream.s3.trace.context.TraceContext; -import io.opentelemetry.instrumentation.annotations.WithSpan; -import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Pointcut; @Aspect public class S3StreamTraceAspect { - @Pointcut("@annotation(withSpan)") - public void trace(WithSpan withSpan) { - } - - @Around(value = "trace(withSpan) && execution(* com.automq.stream..*(..))", argNames = "joinPoint,withSpan") - public Object createSpan(ProceedingJoinPoint joinPoint, WithSpan withSpan) throws Throwable { - Object[] args = joinPoint.getArgs(); - if (args.length > 0 && args[0] instanceof TraceContext) { - TraceContext context = (TraceContext) args[0]; - return TraceUtils.trace(context, joinPoint, withSpan); - } - - return joinPoint.proceed(); - } + // Commented out because it's costly to trace + // + // @Pointcut("@annotation(withSpan)") + // public void trace(WithSpan withSpan) { + // } + // + // @Around(value = "trace(withSpan) && execution(* com.automq.stream..*(..))", argNames = "joinPoint,withSpan") + // public Object createSpan(ProceedingJoinPoint joinPoint, WithSpan withSpan) throws Throwable { + // Object[] args = joinPoint.getArgs(); + // if (args.length > 0 && args[0] instanceof TraceContext) { + // TraceContext context = (TraceContext) args[0]; + // return TraceUtils.trace(context, joinPoint, withSpan); + // } + // + // return joinPoint.proceed(); + // } }