You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sirona.apache.org by rm...@apache.org on 2014/02/23 23:23:12 UTC
svn commit: r1571108 -
/incubator/sirona/trunk/agent/performance/aop/src/main/java/org/apache/sirona/aop/AbstractPerformanceInterceptor.java
Author: rmannibucau
Date: Sun Feb 23 22:23:12 2014
New Revision: 1571108
URL: http://svn.apache.org/r1571108
Log:
limiting text used for exceptions (counters), we should surely rework a bit it later
Modified:
incubator/sirona/trunk/agent/performance/aop/src/main/java/org/apache/sirona/aop/AbstractPerformanceInterceptor.java
Modified: incubator/sirona/trunk/agent/performance/aop/src/main/java/org/apache/sirona/aop/AbstractPerformanceInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/agent/performance/aop/src/main/java/org/apache/sirona/aop/AbstractPerformanceInterceptor.java?rev=1571108&r1=1571107&r2=1571108&view=diff
==============================================================================
--- incubator/sirona/trunk/agent/performance/aop/src/main/java/org/apache/sirona/aop/AbstractPerformanceInterceptor.java (original)
+++ incubator/sirona/trunk/agent/performance/aop/src/main/java/org/apache/sirona/aop/AbstractPerformanceInterceptor.java Sun Feb 23 22:23:12 2014
@@ -186,6 +186,8 @@ public abstract class AbstractPerformanc
* The handler for cases where interception is not possible and you need to pass the "before"object to be able to monitor.
*/
public static class Context {
+ private static final int MAX_LENGTH = Configuration.getInteger(Configuration.CONFIG_PROPERTY_PREFIX + "performance.exception.max-length", 100);
+
protected final ActivationContext activationContext;
protected final StopWatch stopWatch;
@@ -210,7 +212,8 @@ public abstract class AbstractPerformanc
if (error != null) {
final ByteArrayOutputStream writer = new ByteArrayOutputStream();
error.printStackTrace(new PrintStream(writer));
- Repository.INSTANCE.getCounter(new Counter.Key(Role.FAILURES, writer.toString())).add(elapsedTime);
+ final String toString = writer.toString();
+ Repository.INSTANCE.getCounter(new Counter.Key(Role.FAILURES, toString.substring(0, Math.min(MAX_LENGTH, toString.length())))).add(elapsedTime);
}
activationContext.elapsedTime(elapsedTime);