Changing the newTimer in APIMetrics to return APITimer

The newTimer methods in the APIMetrics where modified to pass the url so
an APITimer would be returned from the registry.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
This commit is contained in:
Amnon Heiman 2015-07-14 18:01:30 +03:00
parent 9d143efb07
commit 62eec8aaf2

View File

@ -14,6 +14,7 @@ import com.yammer.metrics.core.Gauge;
import com.yammer.metrics.core.Histogram; import com.yammer.metrics.core.Histogram;
import com.yammer.metrics.core.Meter; import com.yammer.metrics.core.Meter;
import com.yammer.metrics.core.MetricName; import com.yammer.metrics.core.MetricName;
import com.yammer.metrics.core.APITimer;
import com.yammer.metrics.core.Timer; import com.yammer.metrics.core.Timer;
import com.yammer.metrics.reporting.JmxReporter; import com.yammer.metrics.reporting.JmxReporter;
@ -288,7 +289,7 @@ public class APIMetrics {
} }
/** /**
* Creates a new {@link com.yammer.metrics.core.Timer} and registers it * Creates a new {@link com.yammer.metrics.core.APITimer} and registers it
* under the given class and name. * under the given class and name.
* *
* @param klass * @param klass
@ -299,15 +300,15 @@ public class APIMetrics {
* the duration scale unit of the new timer * the duration scale unit of the new timer
* @param rateUnit * @param rateUnit
* the rate scale unit of the new timer * the rate scale unit of the new timer
* @return a new {@link com.yammer.metrics.core.Timer} * @return a new {@link com.yammer.metrics.core.APITimer}
*/ */
public static Timer newTimer(Class<?> klass, String name, public static Timer newTimer(String url, Class<?> klass, String name,
TimeUnit durationUnit, TimeUnit rateUnit) { TimeUnit durationUnit, TimeUnit rateUnit) {
return DEFAULT_REGISTRY.newTimer(klass, name, durationUnit, rateUnit); return DEFAULT_REGISTRY.newTimer(url, klass, name, durationUnit, rateUnit);
} }
/** /**
* Creates a new {@link com.yammer.metrics.core.Timer} and registers it * Creates a new {@link com.yammer.metrics.core.APITimer} and registers it
* under the given class and name, measuring elapsed time in milliseconds * under the given class and name, measuring elapsed time in milliseconds
* and invocations per second. * and invocations per second.
* *
@ -315,14 +316,14 @@ public class APIMetrics {
* the class which owns the metric * the class which owns the metric
* @param name * @param name
* the name of the metric * the name of the metric
* @return a new {@link com.yammer.metrics.core.Timer} * @return a new {@link com.yammer.metrics.core.APITimer}
*/ */
public static Timer newTimer(Class<?> klass, String name) { public static Timer newTimer(String url, Class<?> klass, String name) {
return DEFAULT_REGISTRY.newTimer(klass, name); return DEFAULT_REGISTRY.newTimer(url, klass, name);
} }
/** /**
* Creates a new {@link com.yammer.metrics.core.Timer} and registers it * Creates a new {@link com.yammer.metrics.core.APITimer} and registers it
* under the given class, name, and scope. * under the given class, name, and scope.
* *
* @param klass * @param klass
@ -335,16 +336,16 @@ public class APIMetrics {
* the duration scale unit of the new timer * the duration scale unit of the new timer
* @param rateUnit * @param rateUnit
* the rate scale unit of the new timer * the rate scale unit of the new timer
* @return a new {@link com.yammer.metrics.core.Timer} * @return a new {@link com.yammer.metrics.core.APITimer}
*/ */
public static Timer newTimer(Class<?> klass, String name, String scope, public static Timer newTimer(String url, Class<?> klass, String name, String scope,
TimeUnit durationUnit, TimeUnit rateUnit) { TimeUnit durationUnit, TimeUnit rateUnit) {
return DEFAULT_REGISTRY.newTimer(klass, name, scope, durationUnit, return DEFAULT_REGISTRY.newTimer(url, klass, name, scope, durationUnit,
rateUnit); rateUnit);
} }
/** /**
* Creates a new {@link com.yammer.metrics.core.Timer} and registers it * Creates a new {@link com.yammer.metrics.core.APITimer} and registers it
* under the given class, name, and scope, measuring elapsed time in * under the given class, name, and scope, measuring elapsed time in
* milliseconds and invocations per second. * milliseconds and invocations per second.
* *
@ -354,14 +355,14 @@ public class APIMetrics {
* the name of the metric * the name of the metric
* @param scope * @param scope
* the scope of the metric * the scope of the metric
* @return a new {@link com.yammer.metrics.core.Timer} * @return a new {@link com.yammer.metrics.core.APITimer}
*/ */
public static Timer newTimer(Class<?> klass, String name, String scope) { public static Timer newTimer(String url, Class<?> klass, String name, String scope) {
return DEFAULT_REGISTRY.newTimer(klass, name, scope); return DEFAULT_REGISTRY.newTimer(url, klass, name, scope);
} }
/** /**
* Creates a new {@link com.yammer.metrics.core.Timer} and registers it * Creates a new {@link com.yammer.metrics.core.APITimer} and registers it
* under the given metric name. * under the given metric name.
* *
* @param metricName * @param metricName
@ -370,11 +371,11 @@ public class APIMetrics {
* the duration scale unit of the new timer * the duration scale unit of the new timer
* @param rateUnit * @param rateUnit
* the rate scale unit of the new timer * the rate scale unit of the new timer
* @return a new {@link com.yammer.metrics.core.Timer} * @return a new {@link com.yammer.metrics.core.APITimer}
*/ */
public static Timer newTimer(MetricName metricName, TimeUnit durationUnit, public static Timer newTimer(String url, MetricName metricName, TimeUnit durationUnit,
TimeUnit rateUnit) { TimeUnit rateUnit) {
return DEFAULT_REGISTRY.newTimer(metricName, durationUnit, rateUnit); return DEFAULT_REGISTRY.newTimer(url, metricName, durationUnit, rateUnit);
} }
/** /**