MINOR: Remove ZooKeeper mentions in Sanitizer (#18420)

Reviewers: Mickael Maison <mickael.maison@gmail.com>
This commit is contained in:
Ken Huang 2025-01-09 21:33:43 +08:00 committed by GitHub
parent 3bda9f817d
commit 64b8b4a632
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 11 deletions

View File

@ -24,14 +24,11 @@ import java.util.regex.Pattern;
import javax.management.ObjectName;
/**
* Utility class for sanitizing/desanitizing/quoting values used in JMX metric names
* or as ZooKeeper node name.
* Utility class for sanitizing/desanitizing/quoting values used in JMX metric names.
* <p>
* User principals and client-ids are URL-encoded using ({@link #sanitize(String)}
* for use as ZooKeeper node names. User principals are URL-encoded in all metric
* names as well. All other metric tags including client-id are quoted if they
* contain special characters using {@link #jmxSanitize(String)} when
* registering in JMX.
* User principals are URL-encoded using ({@link #sanitize(String)} in all metric names.
* All other metric tags including client-id are quoted if they contain special characters
* using {@link #jmxSanitize(String)} when registering in JMX.
*/
public class Sanitizer {
@ -43,8 +40,7 @@ public class Sanitizer {
private static final Pattern MBEAN_PATTERN = Pattern.compile("[\\w-%\\. \t]*");
/**
* Sanitize `name` for safe use as JMX metric name as well as ZooKeeper node name
* using URL-encoding.
* Sanitize `name` for safe use as JMX metric name.
*/
public static String sanitize(String name) {
String encoded = URLEncoder.encode(name, StandardCharsets.UTF_8);
@ -63,8 +59,7 @@ public class Sanitizer {
}
/**
* Desanitize name that was URL-encoded using {@link #sanitize(String)}. This
* is used to obtain the desanitized version of node names in ZooKeeper.
* Desanitize name that was URL-encoded using {@link #sanitize(String)}.
*/
public static String desanitize(String name) {
return URLDecoder.decode(name, StandardCharsets.UTF_8);