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,
|
public LatencyMetrics(String url, MetricNameFactory factory,
|
||||||
String namePrefix) {
|
String namePrefix) {
|
||||||
this.factory = factory;
|
this(url, null, factory, namePrefix);
|
||||||
this.namePrefix = namePrefix;
|
|
||||||
|
|
||||||
latency = APIMetrics.newTimer(url + "/histogram",
|
|
||||||
factory.createMetricName(namePrefix + "Latency"),
|
|
||||||
TimeUnit.MICROSECONDS, TimeUnit.SECONDS);
|
|
||||||
totalLatency = APIMetrics.newCounter(url,
|
|
||||||
factory.createMetricName(namePrefix + "TotalLatency"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LatencyMetrics(String url, String paramName,
|
public LatencyMetrics(String url, String paramName,
|
||||||
@ -107,10 +100,11 @@ public class LatencyMetrics {
|
|||||||
this.factory = factory;
|
this.factory = factory;
|
||||||
this.namePrefix = namePrefix;
|
this.namePrefix = namePrefix;
|
||||||
|
|
||||||
latency = APIMetrics.newTimer(url + "/histogram/" + paramName,
|
paramName = (paramName == null)? "" : "/" + paramName;
|
||||||
|
latency = APIMetrics.newTimer(url + "/histogram" + paramName,
|
||||||
factory.createMetricName(namePrefix + "Latency"),
|
factory.createMetricName(namePrefix + "Latency"),
|
||||||
TimeUnit.MICROSECONDS, TimeUnit.SECONDS);
|
TimeUnit.MICROSECONDS, TimeUnit.SECONDS);
|
||||||
totalLatency = APIMetrics.newCounter(url + "/" + paramName,
|
totalLatency = APIMetrics.newCounter(url + paramName,
|
||||||
factory.createMetricName(namePrefix + "TotalLatency"));
|
factory.createMetricName(namePrefix + "TotalLatency"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user