DropWizardMetricMaker: Improve error messages for invalid arguments
- When the metric name is already defined, wrap the name in quotes in the error message. - Adjust error messages about invalid counter consistent to use singular for consitency with other similar error messages. Change-Id: If7298b5c6553f54b3422a83c613a888895cd7342
This commit is contained in:
@@ -151,8 +151,8 @@ public class DropWizardMetricMaker extends MetricMaker {
|
||||
|
||||
private static void checkCounterDescription(String name, Description desc) {
|
||||
checkMetricName(name);
|
||||
checkArgument(!desc.isConstant(), "counters must not be constant");
|
||||
checkArgument(!desc.isGauge(), "counters must not be gauge");
|
||||
checkArgument(!desc.isConstant(), "counter must not be constant");
|
||||
checkArgument(!desc.isGauge(), "counter must not be gauge");
|
||||
}
|
||||
|
||||
CounterImpl newCounterImpl(String name, boolean isRate) {
|
||||
@@ -326,7 +326,7 @@ public class DropWizardMetricMaker extends MetricMaker {
|
||||
if (!desc.getAnnotations()
|
||||
.get(Description.DESCRIPTION)
|
||||
.equals(annotations.get(Description.DESCRIPTION))) {
|
||||
throw new IllegalStateException(String.format("metric %s already defined", name));
|
||||
throw new IllegalStateException(String.format("metric '%s' already defined", name));
|
||||
}
|
||||
} else {
|
||||
descriptions.put(name, desc.getAnnotations());
|
||||
|
||||
Reference in New Issue
Block a user