LatencyMetrics: combine the different constructors
This combine the different constructor into one constructor with the logic and another one that calls it with a default value. Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
This commit is contained in:
parent
9c7ab3fcf6
commit
f16c49a860
@ -92,14 +92,7 @@ public class LatencyMetrics {
|
||||
*/
|
||||
public LatencyMetrics(String url, MetricNameFactory factory,
|
||||
String namePrefix) {
|
||||
this.factory = factory;
|
||||
this.namePrefix = namePrefix;
|
||||
|
||||
latency = APIMetrics.newTimer(url + "/histogram",
|
||||
factory.createMetricName(namePrefix + "Latency"),
|
||||
TimeUnit.MICROSECONDS, TimeUnit.SECONDS);
|
||||
totalLatency = APIMetrics.newCounter(url,
|
||||
factory.createMetricName(namePrefix + "TotalLatency"));
|
||||
this(url, null, factory, namePrefix);
|
||||
}
|
||||
|
||||
public LatencyMetrics(String url, String paramName,
|
||||
@ -107,10 +100,11 @@ public class LatencyMetrics {
|
||||
this.factory = factory;
|
||||
this.namePrefix = namePrefix;
|
||||
|
||||
latency = APIMetrics.newTimer(url + "/histogram/" + paramName,
|
||||
paramName = (paramName == null)? "" : "/" + paramName;
|
||||
latency = APIMetrics.newTimer(url + "/histogram" + paramName,
|
||||
factory.createMetricName(namePrefix + "Latency"),
|
||||
TimeUnit.MICROSECONDS, TimeUnit.SECONDS);
|
||||
totalLatency = APIMetrics.newCounter(url + "/" + paramName,
|
||||
totalLatency = APIMetrics.newCounter(url + paramName,
|
||||
factory.createMetricName(namePrefix + "TotalLatency"));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user