JMX: remove duplicate annotations
This commit is contained in:
@@ -20,10 +20,7 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.jmx.export.annotation.ManagedMetric;
|
||||
import org.springframework.jmx.export.annotation.ManagedOperation;
|
||||
import org.springframework.jmx.export.annotation.ManagedResource;
|
||||
import org.springframework.jmx.support.MetricType;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
/**
|
||||
@@ -110,7 +107,7 @@ public class DirectChannelMetrics implements MethodInterceptor, MessageChannelMe
|
||||
timer.stop();
|
||||
if ((Boolean)result) {
|
||||
sendSuccessRatio.success();
|
||||
sendDuration.append(timer.getTotalTimeSeconds());
|
||||
sendDuration.append(timer.getTotalTimeMillis());
|
||||
} else {
|
||||
sendSuccessRatio.failure();
|
||||
sendErrorCount.incrementAndGet();
|
||||
@@ -132,7 +129,6 @@ public class DirectChannelMetrics implements MethodInterceptor, MessageChannelMe
|
||||
}
|
||||
}
|
||||
|
||||
@ManagedOperation
|
||||
public synchronized void reset() {
|
||||
sendDuration.reset();
|
||||
sendErrorRate.reset();
|
||||
@@ -142,52 +138,42 @@ public class DirectChannelMetrics implements MethodInterceptor, MessageChannelMe
|
||||
sendErrorCount.set(0);
|
||||
}
|
||||
|
||||
@ManagedMetric(metricType = MetricType.COUNTER, displayName = "MessageChannel Sends")
|
||||
public int getSendCount() {
|
||||
return sendCount.get();
|
||||
}
|
||||
|
||||
@ManagedMetric(metricType = MetricType.COUNTER, displayName = "MessageChannel Send Errors")
|
||||
public int getSendErrorCount() {
|
||||
return sendErrorCount.get();
|
||||
}
|
||||
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Channel Time Since Last Send in Seconds")
|
||||
public double getTimeSinceLastSend() {
|
||||
return sendRate.getTimeSinceLastMeasurement();
|
||||
}
|
||||
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Channel Send Rate per Second")
|
||||
public double getMeanSendRate() {
|
||||
return sendRate.getMean();
|
||||
}
|
||||
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Channel Error Rate per Second")
|
||||
public double getMeanErrorRate() {
|
||||
return sendErrorRate.getMean();
|
||||
}
|
||||
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Mean Channel Error Ratio per Minute")
|
||||
public double getMeanErrorRatio() {
|
||||
return 1 - sendSuccessRatio.getMean();
|
||||
}
|
||||
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Channel Send Mean Duration")
|
||||
public double getMeanSendDuration() {
|
||||
return sendDuration.getMean();
|
||||
}
|
||||
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Channel Send Min Duration")
|
||||
public double getMinSendDuration() {
|
||||
return sendDuration.getMin();
|
||||
}
|
||||
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Channel Send Max Duration")
|
||||
public double getMaxSendDuration() {
|
||||
return sendDuration.getMax();
|
||||
}
|
||||
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Channel Send Standard Deviation Duration")
|
||||
public double getStandardDeviationSendDuration() {
|
||||
return sendDuration.getStandardDeviation();
|
||||
}
|
||||
|
||||
@@ -56,7 +56,6 @@ public class LifecycleMessageHandlerMetrics implements MessageHandlerMetrics, Li
|
||||
lifecycle.stop();
|
||||
}
|
||||
|
||||
@ManagedOperation
|
||||
public void reset() {
|
||||
delegate.reset();
|
||||
}
|
||||
|
||||
@@ -32,37 +32,37 @@ public interface MessageHandlerMetrics {
|
||||
/**
|
||||
* @return the number of successful handler calls
|
||||
*/
|
||||
@ManagedMetric(metricType = MetricType.COUNTER, displayName = "Handler Execution Count", description = "rate=1h")
|
||||
@ManagedMetric(metricType = MetricType.COUNTER, displayName = "Handler Execution Count")
|
||||
int getHandleCount();
|
||||
|
||||
/**
|
||||
* @return the number of failed handler calls
|
||||
*/
|
||||
@ManagedMetric(metricType = MetricType.COUNTER, displayName = "Handler Error Count", description = "rate=1h")
|
||||
@ManagedMetric(metricType = MetricType.COUNTER, displayName = "Handler Error Count")
|
||||
int getErrorCount();
|
||||
|
||||
/**
|
||||
* @return the maximum handler duration (milliseconds)
|
||||
*/
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Handler Mean Duration")
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Handler Mean Duration (ms)")
|
||||
double getMeanDuration();
|
||||
|
||||
/**
|
||||
* @return the minimum handler duration (milliseconds)
|
||||
*/
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Handler Min Duration")
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Handler Min Duration (ms)")
|
||||
double getMinDuration();
|
||||
|
||||
/**
|
||||
* @return the standard deviation handler duration (milliseconds)
|
||||
*/
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Handler Max Duration")
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Handler Max Duration (ms)")
|
||||
double getMaxDuration();
|
||||
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Handler Standard Deviation Duration")
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Handler Standard Deviation Duration (ms)")
|
||||
double getStandardDeviationDuration();
|
||||
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Handler Active Status")
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Handler Active Count")
|
||||
int getActiveCount();
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,10 +26,7 @@ import org.springframework.integration.MessageDeliveryException;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.integration.MessageRejectedException;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
import org.springframework.jmx.export.annotation.ManagedMetric;
|
||||
import org.springframework.jmx.export.annotation.ManagedOperation;
|
||||
import org.springframework.jmx.export.annotation.ManagedResource;
|
||||
import org.springframework.jmx.support.MetricType;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
/**
|
||||
@@ -114,7 +111,7 @@ public class SimpleMessageHandlerMetrics implements MethodInterceptor, MessageHa
|
||||
handler.handleMessage(message);
|
||||
|
||||
timer.stop();
|
||||
duration.append(timer.getTotalTimeSeconds());
|
||||
duration.append(timer.getTotalTimeMillis());
|
||||
} catch (RuntimeException e) {
|
||||
errorCount.incrementAndGet();
|
||||
throw e;
|
||||
@@ -126,14 +123,12 @@ public class SimpleMessageHandlerMetrics implements MethodInterceptor, MessageHa
|
||||
}
|
||||
}
|
||||
|
||||
@ManagedOperation
|
||||
public synchronized void reset() {
|
||||
duration.reset();
|
||||
errorCount.set(0);
|
||||
handleCount.set(0);
|
||||
}
|
||||
|
||||
@ManagedMetric(metricType = MetricType.COUNTER, displayName = "Handler Execution Count", description = "rate=1h")
|
||||
public int getHandleCount() {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Getting Handle Count:" + this);
|
||||
@@ -141,32 +136,26 @@ public class SimpleMessageHandlerMetrics implements MethodInterceptor, MessageHa
|
||||
return handleCount.get();
|
||||
}
|
||||
|
||||
@ManagedMetric(metricType = MetricType.COUNTER, displayName = "Handler Error Count", description = "rate=1h")
|
||||
public int getErrorCount() {
|
||||
return errorCount.get();
|
||||
}
|
||||
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Handler Mean Duration")
|
||||
public double getMeanDuration() {
|
||||
return duration.getMean();
|
||||
}
|
||||
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Handler Min Duration")
|
||||
public double getMinDuration() {
|
||||
return duration.getMin();
|
||||
}
|
||||
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Handler Max Duration")
|
||||
public double getMaxDuration() {
|
||||
return duration.getMax();
|
||||
}
|
||||
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Handler Standard Deviation Duration")
|
||||
public double getStandardDeviationDuration() {
|
||||
return duration.getStandardDeviation();
|
||||
}
|
||||
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Handler Active Count")
|
||||
public int getActiveCount() {
|
||||
return activeCount.get();
|
||||
}
|
||||
|
||||
@@ -18,9 +18,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.springframework.integration.core.MessageSource;
|
||||
import org.springframework.jmx.export.annotation.ManagedMetric;
|
||||
import org.springframework.jmx.export.annotation.ManagedOperation;
|
||||
import org.springframework.jmx.support.MetricType;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
@@ -62,12 +59,10 @@ public class SimpleMessageSourceMetrics implements MethodInterceptor, MessageSou
|
||||
return messageSource;
|
||||
}
|
||||
|
||||
@ManagedOperation
|
||||
public void reset() {
|
||||
messageCount.set(0);
|
||||
}
|
||||
|
||||
@ManagedMetric(metricType = MetricType.COUNTER, displayName = "Message Source Message Count")
|
||||
public int getMessageCount() {
|
||||
return messageCount.get();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user