kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ewe...@apache.org
Subject kafka git commit: KAFKA-6008: Sanitize the app id before creating app id metric
Date Wed, 04 Oct 2017 18:52:13 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk f8621b417 -> ac7695c32


KAFKA-6008: Sanitize the app id before creating app id metric

Author: Jakub Scholz <www@scholzj.com>

Reviewers: Randall Hauch <rhauch@gmail.com>, Ewen Cheslack-Postava <ewen@confluent.io>

Closes #4012 from scholzj/KAFKA-6008


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/ac7695c3
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/ac7695c3
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/ac7695c3

Branch: refs/heads/trunk
Commit: ac7695c32a4d8424bafcb8eb5409a4a4ad752c4a
Parents: f8621b4
Author: Jakub Scholz <www@scholzj.com>
Authored: Wed Oct 4 13:26:21 2017 +0200
Committer: Ewen Cheslack-Postava <me@ewencp.org>
Committed: Wed Oct 4 11:44:15 2017 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/kafka/common/utils/AppInfoParser.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/ac7695c3/clients/src/main/java/org/apache/kafka/common/utils/AppInfoParser.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/common/utils/AppInfoParser.java b/clients/src/main/java/org/apache/kafka/common/utils/AppInfoParser.java
index 6053da6..9a1bab8 100644
--- a/clients/src/main/java/org/apache/kafka/common/utils/AppInfoParser.java
+++ b/clients/src/main/java/org/apache/kafka/common/utils/AppInfoParser.java
@@ -28,6 +28,7 @@ import org.apache.kafka.common.MetricName;
 import org.apache.kafka.common.metrics.Gauge;
 import org.apache.kafka.common.metrics.MetricConfig;
 import org.apache.kafka.common.metrics.Metrics;
+import org.apache.kafka.common.metrics.Sanitizer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -57,7 +58,7 @@ public class AppInfoParser {
 
     public static synchronized void registerAppInfo(String prefix, String id, Metrics metrics)
{
         try {
-            ObjectName name = new ObjectName(prefix + ":type=app-info,id=" + id);
+            ObjectName name = new ObjectName(prefix + ":type=app-info,id=" + Sanitizer.sanitize(id));
             AppInfo mBean = new AppInfo();
             ManagementFactory.getPlatformMBeanServer().registerMBean(mBean, name);
 


Mime
View raw message