diff --git a/collector/collector-basic/src/main/java/org/apache/hertzbeat/collector/collect/http/promethus/exporter/ExporterParser.java b/collector/collector-basic/src/main/java/org/apache/hertzbeat/collector/collect/http/promethus/exporter/ExporterParser.java index 4684be338cf..f7d3b9d4504 100644 --- a/collector/collector-basic/src/main/java/org/apache/hertzbeat/collector/collect/http/promethus/exporter/ExporterParser.java +++ b/collector/collector-basic/src/main/java/org/apache/hertzbeat/collector/collect/http/promethus/exporter/ExporterParser.java @@ -76,7 +76,9 @@ public Map textToMetric(String resp) { private void parseLine(Map metricMap, StrBuffer buffer) { buffer.skipBlankTabs(); - if (buffer.isEmpty()) return; + if (buffer.isEmpty()) { + return; + } switch (buffer.charAt(0)) { case '#' -> { buffer.read(); @@ -231,7 +233,9 @@ private void startReadLabelValue(MetricFamily.Metric metric, MetricFamily.Label private void readLabelValue(MetricFamily.Metric metric, MetricFamily.Label label, StrBuffer buffer) { buffer.skipBlankTabs(); - if (buffer.isEmpty()) return; + if (buffer.isEmpty()) { + return; + } switch (this.currentMetricFamily.getMetricType()) { case INFO -> { MetricFamily.Info info = new MetricFamily.Info(); diff --git a/collector/collector-basic/src/main/java/org/apache/hertzbeat/collector/collect/prometheus/parser/TextParser.java b/collector/collector-basic/src/main/java/org/apache/hertzbeat/collector/collect/prometheus/parser/TextParser.java index b80e4b497f7..480a6149a3a 100644 --- a/collector/collector-basic/src/main/java/org/apache/hertzbeat/collector/collect/prometheus/parser/TextParser.java +++ b/collector/collector-basic/src/main/java/org/apache/hertzbeat/collector/collect/prometheus/parser/TextParser.java @@ -66,7 +66,9 @@ public static Map textToMetricFamilies(String resp) { private static void parseLine(Map metricMap, StrBuffer buffer) { buffer.skipBlankTabs(); - if (buffer.isEmpty()) return; + if (buffer.isEmpty()) { + return; + } switch (buffer.charAt(0)) { case '#': case ENTER: @@ -95,7 +97,9 @@ private static void parseMetric(Map metricMap, StrBuffer b private static void readLabels(MetricFamily.Metric metric, StrBuffer buffer) { buffer.skipBlankTabs(); - if (buffer.isEmpty()) return; + if (buffer.isEmpty()) { + return; + } metric.setLabels(new LinkedList<>()); if (buffer.charAt(0) == LEFT_CURLY_BRACKET) { buffer.read(); @@ -107,11 +111,15 @@ private static void readLabels(MetricFamily.Metric metric, StrBuffer buffer) { private static void startReadLabelName(MetricFamily.Metric metric, StrBuffer buffer) { buffer.skipBlankTabs(); - if (buffer.isEmpty()) return; + if (buffer.isEmpty()) { + return; + } if (buffer.charAt(0) == RIGHT_CURLY_BRACKET) { buffer.read(); buffer.skipBlankTabs(); - if (buffer.isEmpty()) return; + if (buffer.isEmpty()) { + return; + } readLabelValue(metric, buffer); return; } @@ -129,7 +137,9 @@ private static void startReadLabelName(MetricFamily.Metric metric, StrBuffer buf private static void startReadLabelValue(MetricFamily.Metric metric, MetricFamily.Label label, StrBuffer buffer) { buffer.skipBlankTabs(); - if (buffer.isEmpty()) return; + if (buffer.isEmpty()) { + return; + } char c = buffer.read(); if (c != QUOTES) { throw new ParseException("expected '\"' at start of label value, line: " + buffer.toStr()); @@ -140,7 +150,9 @@ private static void startReadLabelValue(MetricFamily.Metric metric, MetricFamily throw new ParseException("no valid label value: " + labelValue); } metric.getLabels().add(label); - if (buffer.isEmpty()) return; + if (buffer.isEmpty()) { + return; + } c = buffer.read(); switch (c) { case COMMA -> startReadLabelName(metric, buffer); @@ -151,7 +163,9 @@ private static void startReadLabelValue(MetricFamily.Metric metric, MetricFamily private static void readLabelValue(MetricFamily.Metric metric, StrBuffer buffer) { buffer.skipBlankTabs(); - if (buffer.isEmpty()) return; + if (buffer.isEmpty()) { + return; + } metric.setValue(buffer.toDouble()); } diff --git a/collector/collector-basic/src/main/java/org/apache/hertzbeat/collector/collect/snmp/SnmpCollectImpl.java b/collector/collector-basic/src/main/java/org/apache/hertzbeat/collector/collect/snmp/SnmpCollectImpl.java index 361b762d648..4483952f747 100644 --- a/collector/collector-basic/src/main/java/org/apache/hertzbeat/collector/collect/snmp/SnmpCollectImpl.java +++ b/collector/collector-basic/src/main/java/org/apache/hertzbeat/collector/collect/snmp/SnmpCollectImpl.java @@ -316,16 +316,23 @@ private void snmpClose(Snmp snmp, int version) throws IOException { } private TargetBuilder.PrivProtocol getPrivPasswordEncryption(String privPasswordEncryption) { - if (privPasswordEncryption == null) return TargetBuilder.PrivProtocol.des; - else if (AES128.equals(privPasswordEncryption)) { + if (privPasswordEncryption == null) { + return TargetBuilder.PrivProtocol.des; + } else if (AES128.equals(privPasswordEncryption)) { return TargetBuilder.PrivProtocol.aes128; - } else return TargetBuilder.PrivProtocol.des; + } else { + return TargetBuilder.PrivProtocol.des; + } } private TargetBuilder.AuthProtocol getAuthPasswordEncryption(String authPasswordEncryption) { - if (authPasswordEncryption == null) return TargetBuilder.AuthProtocol.md5; - else if (SHA1.equals(authPasswordEncryption)) return TargetBuilder.AuthProtocol.sha1; - else return TargetBuilder.AuthProtocol.md5; + if (authPasswordEncryption == null) { + return TargetBuilder.AuthProtocol.md5; + } else if (SHA1.equals(authPasswordEncryption)) { + return TargetBuilder.AuthProtocol.sha1; + } else { + return TargetBuilder.AuthProtocol.md5; + } } private String getContextName(String contextName) { diff --git a/collector/collector-common/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/SshConnect.java b/collector/collector-common/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/SshConnect.java index 5e05aada1ce..02c08342e18 100644 --- a/collector/collector-common/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/SshConnect.java +++ b/collector/collector-common/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/SshConnect.java @@ -38,6 +38,7 @@ public void closeConnection() throws Exception { } } + @Override public ClientSession getConnection() { return clientSession; } diff --git a/common/src/main/java/org/apache/hertzbeat/common/queue/impl/RedisCommonDataQueue.java b/common/src/main/java/org/apache/hertzbeat/common/queue/impl/RedisCommonDataQueue.java index 1283489cea3..54afeffd0ad 100644 --- a/common/src/main/java/org/apache/hertzbeat/common/queue/impl/RedisCommonDataQueue.java +++ b/common/src/main/java/org/apache/hertzbeat/common/queue/impl/RedisCommonDataQueue.java @@ -163,6 +163,7 @@ public void sendMetricsData(CollectRep.MetricsData metricsData) { } } + @Override public void destroy() { connection.close(); diff --git a/manager/src/main/java/org/apache/hertzbeat/manager/component/alerter/impl/EmailAlertNotifyHandlerImpl.java b/manager/src/main/java/org/apache/hertzbeat/manager/component/alerter/impl/EmailAlertNotifyHandlerImpl.java index 3e5cf037893..b1070a9d3be 100644 --- a/manager/src/main/java/org/apache/hertzbeat/manager/component/alerter/impl/EmailAlertNotifyHandlerImpl.java +++ b/manager/src/main/java/org/apache/hertzbeat/manager/component/alerter/impl/EmailAlertNotifyHandlerImpl.java @@ -137,6 +137,7 @@ public byte type() { return 1; } + @Override @EventListener(SystemConfigChangeEvent.class) public void onEvent(SystemConfigChangeEvent event) { log.info("{} receive system config change event: {}.", this.getClass().getName(), event.getSource()); diff --git a/manager/src/main/resources/logback-spring.xml b/manager/src/main/resources/logback-spring.xml index fd8ffd90155..950db709625 100644 --- a/manager/src/main/resources/logback-spring.xml +++ b/manager/src/main/resources/logback-spring.xml @@ -83,7 +83,6 @@ - diff --git a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/AbstractHistoryDataStorage.java b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/AbstractHistoryDataStorage.java index 8c2c20da2e9..f11e4e0f1f2 100644 --- a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/AbstractHistoryDataStorage.java +++ b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/AbstractHistoryDataStorage.java @@ -31,6 +31,7 @@ public abstract class AbstractHistoryDataStorage implements HistoryDataReader, H /** * @return data storage available */ + @Override public boolean isServerAvailable() { return serverAvailable; } diff --git a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/tdengine/TdEngineDataStorage.java b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/tdengine/TdEngineDataStorage.java index 8a16182b1ce..2bab22f79e5 100644 --- a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/tdengine/TdEngineDataStorage.java +++ b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/tdengine/TdEngineDataStorage.java @@ -57,7 +57,7 @@ @Slf4j public class TdEngineDataStorage extends AbstractHistoryDataStorage { - private static final String CONSTANTS_URL_PREFIX = "jdbc:TAOS://"; + private static final String CONSTANTS_URL_PREFIX = "jdbc:TAOS-RS://"; private static final Pattern SQL_SPECIAL_STRING_PATTERN = Pattern.compile("(\\\\)|(')"); private static final String INSTANCE_NULL = "''"; private static final String CONSTANTS_CREATE_DATABASE = "CREATE DATABASE IF NOT EXISTS %s";