Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/ospp' into ospp
Browse files Browse the repository at this point in the history
  • Loading branch information
All-The-Best-for committed Oct 26, 2024
2 parents 7e1901c + eceb67f commit a2b1f3f
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ public Map<String, MetricFamily> textToMetric(String resp) {

private void parseLine(Map<String, MetricFamily> metricMap, StrBuffer buffer) {
buffer.skipBlankTabs();
if (buffer.isEmpty()) return;
if (buffer.isEmpty()) {
return;
}
switch (buffer.charAt(0)) {
case '#' -> {
buffer.read();
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ public static Map<String, MetricFamily> textToMetricFamilies(String resp) {

private static void parseLine(Map<String, MetricFamily> metricMap, StrBuffer buffer) {
buffer.skipBlankTabs();
if (buffer.isEmpty()) return;
if (buffer.isEmpty()) {
return;
}
switch (buffer.charAt(0)) {
case '#':
case ENTER:
Expand Down Expand Up @@ -95,7 +97,9 @@ private static void parseMetric(Map<String, MetricFamily> 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();
Expand All @@ -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;
}
Expand All @@ -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());
Expand All @@ -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);
Expand All @@ -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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public void closeConnection() throws Exception {
}
}

@Override
public ClientSession getConnection() {
return clientSession;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ public void sendMetricsData(CollectRep.MetricsData metricsData) {
}
}

@Override
public void destroy() {

connection.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
1 change: 0 additions & 1 deletion manager/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
<logger name="io.netty" level="info"/>
<logger name="org.slf4j" level="info"/>
<logger name="ch.qos.logback" level="warn"/>
<logger name="org.apache.kafka.clients" level="info"/>
<logger name="org.hibernate" level="info"/>
<logger name="org.apache.http" level="info"/>
<logger name="com.zaxxer" level="info"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public abstract class AbstractHistoryDataStorage implements HistoryDataReader, H
/**
* @return data storage available
*/
@Override
public boolean isServerAvailable() {
return serverAvailable;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit a2b1f3f

Please sign in to comment.