"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/MonitoringBaseAspect.java" between
moskito-moskito-2.9.3.tar.gz and moskito-moskito-2.10.0.tar.gz

About: MoSKito (Monitoring System Kit) is a framework for java application monitoring. Sources.

MonitoringBaseAspect.java  (moskito-moskito-2.9.3):MonitoringBaseAspect.java  (moskito-moskito-2.10.0)
package net.anotheria.moskito.aop.aspect; package net.anotheria.moskito.aop.aspect;
import net.anotheria.moskito.core.calltrace.CurrentlyTracedCall; import net.anotheria.moskito.core.calltrace.CurrentlyTracedCall;
import net.anotheria.moskito.core.calltrace.RunningTraceContainer; import net.anotheria.moskito.core.calltrace.RunningTraceContainer;
import net.anotheria.moskito.core.calltrace.TraceStep; import net.anotheria.moskito.core.calltrace.TraceStep;
import net.anotheria.moskito.core.calltrace.TracedCall; import net.anotheria.moskito.core.calltrace.TracedCall;
import net.anotheria.moskito.core.calltrace.TracingUtil; import net.anotheria.moskito.core.calltrace.TracingUtil;
import net.anotheria.moskito.core.config.MoskitoConfiguration; import net.anotheria.moskito.core.config.MoskitoConfiguration;
import net.anotheria.moskito.core.config.MoskitoConfigurationHolder; import net.anotheria.moskito.core.config.MoskitoConfigurationHolder;
import net.anotheria.moskito.core.context.CurrentMeasurement;
import net.anotheria.moskito.core.context.MoSKitoContext; import net.anotheria.moskito.core.context.MoSKitoContext;
import net.anotheria.moskito.core.dynamic.OnDemandStatsProducer; import net.anotheria.moskito.core.dynamic.OnDemandStatsProducer;
import net.anotheria.moskito.core.journey.Journey; import net.anotheria.moskito.core.journey.Journey;
import net.anotheria.moskito.core.journey.JourneyManagerFactory; import net.anotheria.moskito.core.journey.JourneyManagerFactory;
import net.anotheria.moskito.core.predefined.ServiceStats; import net.anotheria.moskito.core.predefined.ServiceStats;
import net.anotheria.moskito.core.predefined.ServiceStatsFactory; import net.anotheria.moskito.core.predefined.ServiceStatsFactory;
import net.anotheria.moskito.core.tracer.Trace; import net.anotheria.moskito.core.tracer.Trace;
import net.anotheria.moskito.core.tracer.TracerRepository; import net.anotheria.moskito.core.tracer.TracerRepository;
import net.anotheria.moskito.core.tracer.Tracers; import net.anotheria.moskito.core.tracer.Tracers;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
skipping to change at line 63 skipping to change at line 64
return pjp.proceed(); return pjp.proceed();
OnDemandStatsProducer<ServiceStats> producer = getProducer(pjp, aProduce rId, aCategory, aSubsystem, false, FACTORY, true); OnDemandStatsProducer<ServiceStats> producer = getProducer(pjp, aProduce rId, aCategory, aSubsystem, false, FACTORY, true);
String producerId = producer.getProducerId(); String producerId = producer.getProducerId();
String prevProducerId = lastProducerId.get(); String prevProducerId = lastProducerId.get();
lastProducerId.set(producerId); lastProducerId.set(producerId);
//calculate cumulated stats (default stats). //calculate cumulated stats (default stats).
//we only do this if previous producer wasn't same as current -> meaning if we call a second method in the same producer we don't count it as new call. //we only do this if previous producer wasn't same as current -> meaning if we call a second method in the same producer we don't count it as new call.
boolean calculateCumulatedStats = !producerId.equals(prevProducerId); boolean calculateCumulatedStats = !producerId.equals(prevProducerId);
//check if we are the first producer
CurrentMeasurement cm = MoSKitoContext.get().notifyProducerEntry(
producer);
String methodName = getMethodStatName(pjp.getSignature()); String methodName = getMethodStatName(pjp.getSignature());
ServiceStats defaultStats = producer.getDefaultStats(); ServiceStats defaultStats = producer.getDefaultStats();
ServiceStats methodStats = producer.getStats(methodName); ServiceStats methodStats = producer.getStats(methodName);
final Object[] args = pjp.getArgs(); final Object[] args = pjp.getArgs();
if (calculateCumulatedStats) { if (calculateCumulatedStats) {
defaultStats.addRequest(); defaultStats.addRequest();
} }
if (methodStats != null) { if (methodStats != null) {
methodStats.addRequest(); methodStats.addRequest();
skipping to change at line 106 skipping to change at line 110
if (currentTrace == null && tracePassingOfThisProducer){ if (currentTrace == null && tracePassingOfThisProducer){
//ok, we will create a new journey on the fly. //ok, we will create a new journey on the fly.
String journeyCallName = Tracers.getCallName(trace); String journeyCallName = Tracers.getCallName(trace);
RunningTraceContainer.startTracedCall(journeyCallName); RunningTraceContainer.startTracedCall(journeyCallName);
journeyStartedByMe = true; journeyStartedByMe = true;
currentTrace = (CurrentlyTracedCall) RunningTraceContainer.getCurren tlyTracedCall(); currentTrace = (CurrentlyTracedCall) RunningTraceContainer.getCurren tlyTracedCall();
} }
StringBuilder call = null; StringBuilder call = null;
if (currentTrace != null || tracePassingOfThisProducer || isLoggingEnabl ed) { if (currentTrace != null || tracePassingOfThisProducer || isLoggingEnabl ed || cm.isFirst()) {
call = TracingUtil.buildCall(producerId, methodName, args, tracePass ingOfThisProducer ? Tracers.getCallName(trace) : null); call = TracingUtil.buildCall(producerId, methodName, args, tracePass ingOfThisProducer ? Tracers.getCallName(trace) : null);
} }
if (currentTrace != null) { if (currentTrace != null) {
currentStep = currentTrace.startStep(call.toString(), producer, meth odName); currentStep = currentTrace.startStep(call.toString(), producer, meth odName);
} }
if (cm.isFirst()){
cm.setCallDescription(call.toString());
}
long startTime = System.nanoTime(); long startTime = System.nanoTime();
Object ret = null; Object ret = null;
try { try {
ret = pjp.proceed(); ret = pjp.proceed();
return ret; return ret;
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
if (calculateCumulatedStats) if (calculateCumulatedStats)
defaultStats.notifyError(e.getTargetException()); defaultStats.notifyError(e.getTargetException());
if (methodStats != null) { if (methodStats != null) {
methodStats.notifyError(); methodStats.notifyError();
skipping to change at line 188 skipping to change at line 197
} }
tracerRepository.addTracedExecution(producerId, trace); tracerRepository.addTracedExecution(producerId, trace);
} }
//TODO added this temporarly to 2.9.2 -> will be developed further i n 2.10.0 //TODO added this temporarly to 2.9.2 -> will be developed further i n 2.10.0
if (isLoggingEnabled){ if (isLoggingEnabled){
call.append(" = ").append(TracingUtil.parameter2s tring(ret)); call.append(" = ").append(TracingUtil.parameter2s tring(ret));
System.out.println(call.toString()); System.out.println(call.toString());
} }
if (cm.isFirst()){
cm.notifyProducerFinished();
}
} }
} }
} }
 End of changes. 5 change blocks. 
1 lines changed or deleted 15 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)