From 8d47871229216b165a5e339816780e0b272baf84 Mon Sep 17 00:00:00 2001 From: Shichao Nie Date: Fri, 10 Jan 2025 14:14:50 +0800 Subject: [PATCH] feat(config): fix exporter uri type Signed-off-by: Shichao Nie --- core/src/main/java/kafka/automq/AutoMQConfig.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/kafka/automq/AutoMQConfig.java b/core/src/main/java/kafka/automq/AutoMQConfig.java index c939452ac5..398f0c682c 100644 --- a/core/src/main/java/kafka/automq/AutoMQConfig.java +++ b/core/src/main/java/kafka/automq/AutoMQConfig.java @@ -15,6 +15,7 @@ import kafka.server.KafkaConfig; import org.apache.kafka.common.config.ConfigDef; +import org.apache.kafka.common.config.types.Password; import org.apache.kafka.common.utils.Utils; import com.automq.stream.s3.ByteBufAllocPolicy; @@ -36,6 +37,7 @@ import static org.apache.kafka.common.config.ConfigDef.Type.BOOLEAN; import static org.apache.kafka.common.config.ConfigDef.Type.INT; import static org.apache.kafka.common.config.ConfigDef.Type.LONG; +import static org.apache.kafka.common.config.ConfigDef.Type.PASSWORD; import static org.apache.kafka.common.config.ConfigDef.Type.STRING; public class AutoMQConfig { @@ -266,7 +268,7 @@ public static void define(ConfigDef configDef) { .define(AutoMQConfig.S3_NETWORK_REFILL_PERIOD_MS_CONFIG, INT, S3_REFILL_PERIOD_MS, MEDIUM, AutoMQConfig.S3_NETWORK_REFILL_PERIOD_MS_DOC) .define(AutoMQConfig.S3_TELEMETRY_METRICS_LEVEL_CONFIG, STRING, "INFO", MEDIUM, AutoMQConfig.S3_TELEMETRY_METRICS_LEVEL_DOC) .define(AutoMQConfig.S3_TELEMETRY_EXPORTER_REPORT_INTERVAL_MS_CONFIG, INT, S3_METRICS_EXPORTER_REPORT_INTERVAL_MS, MEDIUM, AutoMQConfig.S3_TELEMETRY_EXPORTER_REPORT_INTERVAL_MS_DOC) - .define(AutoMQConfig.S3_TELEMETRY_METRICS_EXPORTER_URI_CONFIG, STRING, null, HIGH, AutoMQConfig.S3_TELEMETRY_METRICS_EXPORTER_URI_DOC) + .define(AutoMQConfig.S3_TELEMETRY_METRICS_EXPORTER_URI_CONFIG, PASSWORD, null, HIGH, AutoMQConfig.S3_TELEMETRY_METRICS_EXPORTER_URI_DOC) .define(AutoMQConfig.S3_TELEMETRY_METRICS_BASE_LABELS_CONFIG, STRING, null, MEDIUM, AutoMQConfig.S3_TELEMETRY_METRICS_BASE_LABELS_DOC) .define(AutoMQConfig.S3_BACK_PRESSURE_ENABLED_CONFIG, BOOLEAN, AutoMQConfig.S3_BACK_PRESSURE_ENABLED_DEFAULT, MEDIUM, AutoMQConfig.S3_BACK_PRESSURE_ENABLED_DOC) .define(AutoMQConfig.S3_BACK_PRESSURE_COOLDOWN_MS_CONFIG, LONG, AutoMQConfig.S3_BACK_PRESSURE_COOLDOWN_MS_DEFAULT, MEDIUM, AutoMQConfig.S3_BACK_PRESSURE_COOLDOWN_MS_DOC) @@ -367,7 +369,8 @@ private static String genWALConfig(KafkaConfig config) { } private static String genMetricsExporterURI(KafkaConfig config) { - String uri = config.getString(S3_TELEMETRY_METRICS_EXPORTER_URI_CONFIG); + Password pwd = config.getPassword(S3_TELEMETRY_METRICS_EXPORTER_URI_CONFIG); + String uri = pwd.value(); if (uri == null) { uri = buildMetrixExporterURIWithOldConfigs(config); }