Created
August 24, 2019 02:22
-
-
Save zhaohuabing/76c934e067315769ee6ca71e69da7dc3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Aspect | |
@Component | |
public class TracingAspect { | |
@Autowired | |
Tracer tracer; | |
@Around("@annotation(com.zhaohuabing.demo.instrument.Traced)") | |
public Object aroundAdvice(ProceedingJoinPoint jp) throws Throwable { | |
String class_name = jp.getTarget().getClass().getName(); | |
String method_name = jp.getSignature().getName(); | |
Span span = tracer.buildSpan(class_name + "." + method_name).withTag("class", class_name) | |
.withTag("method", method_name).start(); | |
Object result = jp.proceed(); | |
span.finish(); | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment