Skip to content

Commit

Permalink
perf(s3stream): comment out the trace aspect (#911)
Browse files Browse the repository at this point in the history
Signed-off-by: Ning Yu <ningyu@automq.com>
  • Loading branch information
Chillax-0v0 authored Jan 31, 2024
1 parent f980595 commit c4728bf
Showing 1 changed file with 16 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
// }
}

0 comments on commit c4728bf

Please sign in to comment.