Created
October 17, 2014 17:39
-
-
Save gabanox/aaa41593970af265c4f1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package com.telcel.aspects; | |
import org.aspectj.lang.ProceedingJoinPoint; | |
import org.aspectj.lang.annotation.Around; | |
import org.aspectj.lang.annotation.Aspect; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.stereotype.Component; | |
import org.springframework.util.StopWatch; | |
@Component | |
@Aspect | |
public class PerformanceAspect extends CallTracker { | |
Logger logger = LoggerFactory.getLogger(PerformanceAspect.class); | |
@Around("SystemArchitecture.Repository()") | |
public void trace(ProceedingJoinPoint proceedingJP) throws Throwable { | |
String methodInformation = proceedingJP.getStaticPart().getSignature().toString(); | |
StopWatch stopWatch = new StopWatch(methodInformation); | |
stopWatch.start(); | |
trackCall(); | |
try { | |
proceedingJP.proceed(); | |
} finally { | |
stopWatch.stop(); | |
logger.trace(stopWatch.shortSummary()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment