Spring Data mongo profiling data -
is possible profiling data spring data mongo db layer.
i know if use this: http://docs.mongodb.org/manual/tutorial/manage-the-database-profiler/ can degree of info out of application.
i custom write aspect measure queries , operations.
however, looking built in functionality. there via jmx or like?
thanks in advance
i searched around quite bit , not find thing created mechanism track timing , metrics mongo.
given using elk gather log , metrics data, added annotation , aspect track timings. put on whatever wanted measure connects our mongo methods. gather data , puts them in logs , through kibana can see access under load mongo on each type of access.
this annotation
@retention(retentionpolicy.runtime) @target({elementtype.method, elementtype.type}) public @interface timedmethod { }
this aspect:
@component() @slf4j(topic="com.cisco.services.common.rpil.metrics") @aspect public class timedmethodaspect { @around("@annotation(com.cisco.services.common.rpil.metrics.timedmethod) && execution(public * *(..))") public object time(proceedingjoinpoint pjp) throws throwable { long start = system.nanotime(); string throwablename = null; try { return pjp.proceed(); } catch(throwable t) { throwablename = t.getclass().getname(); throw t; } { long duration = system.nanotime() - start; if (throwablename != null) { log.info("timed [{}]: {} nsecs, exception [{}]", pjp.getsignature().tostring(), duration, throwablename); } else { log.info("timed [{}]: {} nsecs", pjp.getsignature().tostring(), duration); } } } }
basically works this:
@timedmethod public object measureme() { ... }
Comments
Post a Comment