WorkQueue: Sanitize metric name when queue is created
This is a follow up to I3f92b840b and makes sure that whatever metric is created from WorkQueue will conform to the naming rules. Change-Id: I332cb50b80bcf80333dad9b4105e599bbcdb01c4 Signed-off-by: Jacek Centkowski <jcentkowski@collab.net> Signed-off-by: David Pursehouse <dpursehouse@collab.net>
This commit is contained in:
committed by
David Pursehouse
parent
d7a17e19a1
commit
fccd70ed65
@@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.git;
|
package com.google.gerrit.server.git;
|
||||||
|
|
||||||
|
import static com.google.gerrit.metrics.dropwizard.DropWizardMetricMaker.sanitizeMetricName;
|
||||||
|
|
||||||
import com.google.common.base.CaseFormat;
|
import com.google.common.base.CaseFormat;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
import com.google.gerrit.extensions.events.LifecycleListener;
|
import com.google.gerrit.extensions.events.LifecycleListener;
|
||||||
@@ -284,7 +286,7 @@ public class WorkQueue {
|
|||||||
CaseFormat.UPPER_CAMEL.to(
|
CaseFormat.UPPER_CAMEL.to(
|
||||||
CaseFormat.LOWER_UNDERSCORE,
|
CaseFormat.LOWER_UNDERSCORE,
|
||||||
queueName.replaceFirst("SSH", "Ssh").replaceAll("-", ""));
|
queueName.replaceFirst("SSH", "Ssh").replaceAll("-", ""));
|
||||||
return String.format("queue/%s/%s", name, metricName);
|
return sanitizeMetricName(String.format("queue/%s/%s", name, metricName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unregisterWorkQueue() {
|
public void unregisterWorkQueue() {
|
||||||
|
|||||||
Reference in New Issue
Block a user