This is an automated email from the ASF dual-hosted git repository. haonan pushed a commit to branch metric_ssl in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit d9e9e7c77cea05be37a77947b7f0b264740e308d Author: HTHou <[email protected]> AuthorDate: Mon Sep 8 11:47:14 2025 +0800 dev --- .../apache/iotdb/metrics/config/MetricConfig.java | 23 ++++++++++++---------- .../reporter/prometheus/PrometheusReporter.java | 2 ++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/config/MetricConfig.java b/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/config/MetricConfig.java index b71bb6ad882..31a41dd4eac 100644 --- a/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/config/MetricConfig.java +++ b/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/config/MetricConfig.java @@ -79,11 +79,11 @@ public class MetricConfig { private long upTimeInNs = 0; private String internalDatabase = "root.__system"; - private boolean enableSSL = false; - private String keyStorePath = ""; - private String keyStorePassword = ""; - private String trustStorePath = ""; - private String trustStorePassword = ""; + private boolean enableSSL = true; + private String keyStorePath = "/Users/ht/.keystore"; + private String keyStorePassword = "123456"; + private String trustStorePath = "/Users/ht/.truststore"; + private String trustStorePassword = "123456"; public MetricConfig() { // try to get pid of iotdb instance @@ -95,16 +95,19 @@ public class MetricConfig { } public List<ReporterType> getMetricReporterList() { + this.metricReporterList = new ArrayList<>(); + this.metricReporterList.add(ReporterType.valueOf("PROMETHEUS")); return metricReporterList; } public void setMetricReporterList(String metricReporterList) { this.metricReporterList = new ArrayList<>(); - for (String type : metricReporterList.split(",")) { - if (type.trim().length() != 0) { - this.metricReporterList.add(ReporterType.valueOf(type)); - } - } + // for (String type : metricReporterList.split(",")) { + // if (type.trim().length() != 0) { + // this.metricReporterList.add(ReporterType.valueOf(type)); + // } + // } + this.metricReporterList.add(ReporterType.valueOf("PROMETHEUS")); } public InternalReporterType getInternalReportType() { diff --git a/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/reporter/prometheus/PrometheusReporter.java b/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/reporter/prometheus/PrometheusReporter.java index b8997ea0dcd..74d5f6f9024 100644 --- a/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/reporter/prometheus/PrometheusReporter.java +++ b/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/reporter/prometheus/PrometheusReporter.java @@ -19,6 +19,7 @@ package org.apache.iotdb.metrics.reporter.prometheus; +import io.netty.handler.ssl.ClientAuth; import org.apache.iotdb.metrics.AbstractMetricManager; import org.apache.iotdb.metrics.config.MetricConfig; import org.apache.iotdb.metrics.config.MetricConfigDescriptor; @@ -309,6 +310,7 @@ public class PrometheusReporter implements Reporter { if (sslContextBuilder == null) { throw new Exception("Keystore or Truststore is null"); } + sslContextBuilder.clientAuth(ClientAuth.REQUIRE); return sslContextBuilder.build(); }
