Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix]Fix and pass the checkstyle error in warehouse module code #1590

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion script/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<module name="SuppressWarningsFilter"/>

<property name="charset" value="UTF-8"/>
<property name="severity" value="error"/>
<property name="severity" value="warning"/>
<property name="fileExtensions" value="java, properties, xml"/>
<!-- Excludes all 'module-info.java' files -->
<!-- See https://checkstyle.org/config_filefilters.html -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public void setKafka(KafkaProperties kafka) {
this.kafka = kafka;
}

/**
* kafka配置信息
*/
public static class KafkaProperties {
/**
* kafka数据入口是否启动
Expand Down Expand Up @@ -233,6 +236,9 @@ public void setGreptime(GreptimeProperties greptime) {
this.greptime = greptime;
}

/**
* 内存存储配置信息
*/
public static class MemoryProperties {
/**
* 内存数据存储是否启动
Expand Down Expand Up @@ -260,6 +266,9 @@ public void setInitSize(Integer initSize) {
}
}

/**
* JPA配置信息
*/
public static class JpaProperties {
/**
* use mysql/h2 jpa store metrics history data
Expand Down Expand Up @@ -301,6 +310,9 @@ public void setMaxHistoryRecordNum(Integer maxHistoryRecordNum) {
}
}

/**
* Influxdb配置信息
*/
public static class InfluxdbProperties {
/**
* influxdb数据存储是否启动
Expand Down Expand Up @@ -376,6 +388,9 @@ public void setReplication(int replication) {
}
}

/**
* TdEngine配置信息
*/
public static class TdEngineProperties {
/**
* Whether the TdEngine data store is enabled
Expand Down Expand Up @@ -451,6 +466,9 @@ public void setTableStrColumnDefineMaxLength(int tableStrColumnDefineMaxLength)
}
}

/**
* VictoriaMetrics配置信息
*/
public static class VictoriaMetricsProperties {
/**
* Whether the VictoriaMetrics data store is enabled
Expand Down Expand Up @@ -503,6 +521,9 @@ public void setPassword(String password) {

}

/**
* Redis配置信息
*/
public static class RedisProperties {
/**
* redis数据存储是否启动
Expand Down Expand Up @@ -566,6 +587,9 @@ public void setPassword(String password) {
}
}

/**
* IoTDB配置信息
*/
public static class IotDbProperties {
/**
* Whether the iotDB data store is enabled
Expand Down Expand Up @@ -698,6 +722,9 @@ public void setExpireTime(String expireTime) {
}
}

/**
* GrepTimeDB配置信息
*/
public static class GreptimeProperties {
/**
* Whether the GrepTimeDB data store is enabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ public class HistoryGrepTimeDbDataStorage extends AbstractHistoryDataStorage {
private static final String QUERY_INSTANCE_SQL
= "SELECT DISTINCT instance FROM %s WHERE ts >= now() - interval '1' WEEK";
private static final String QUERY_HISTORY_INTERVAL_WITH_INSTANCE_SQL
= "SELECT first, avg ,max, min FROM (SELECT \"%s\" as first FROM %s WHERE monitor_id = %s and ts >= %s and ts < %s ORDER BY ts LIMIT 1) LEFT JOIN (SELECT avg(\"%s\") as avg, min(\"%s\") as min, max(\"%s\") as max FROM %s WHERE ts >= %s and ts < %s) ON 1=1";
= "SELECT first, avg ,max, min FROM (SELECT \"%s\" as first FROM %s WHERE monitor_id = %s and ts >= %s" +
" and ts < %s ORDER BY ts LIMIT 1) LEFT JOIN (SELECT avg(\"%s\") as avg, min(\"%s\") as min, max(\"%s\") as max FROM %s WHERE ts >= %s and ts < %s) ON 1=1";
private static final String TABLE_NOT_EXIST = "not exist";
private static final String DATABASE_NOT_EXIST = "not exist";
private GreptimeDB greptimeDb;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ void saveData(CollectRep.MetricsData metricsData) {
.int32(null);
break;
}
default:
historyBuilder.metricType(CommonConstants.TYPE_NUMBER);
break;
}
} else {
switch (fieldType) {
Expand All @@ -182,6 +185,10 @@ void saveData(CollectRep.MetricsData metricsData) {
.int32(Integer.parseInt(columnValue));
break;
}
default:
historyBuilder.metricType(CommonConstants.TYPE_NUMBER)
.dou(Double.parseDouble(columnValue));
break;
}

if (field.getLabel()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,10 @@ public Map<String, List<Value>> getHistoryIntervalMetricData(Long monitorId, Str
}
return instanceValuesMap;
}


/**
* victoria metrics content
*/
@Data
@Builder
@AllArgsConstructor
Expand All @@ -470,6 +473,9 @@ public static final class VictoriaMetricsContent {
private Long[] timestamps;
}

/**
* victoria metrics query content
*/
@Data
@Builder
@AllArgsConstructor
Expand All @@ -479,7 +485,10 @@ public static final class VictoriaMetricsQueryContent {
private String status;

private ContentData data;


/**
* content data
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
Expand All @@ -489,6 +498,9 @@ public static final class ContentData {

private List<Content> result;

/**
* content
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ public RealTimeRedisDataStorage(WarehouseProperties properties) {
this.serverAvailable = initRedisClient(properties);
this.db = getRedisSelectDb(properties);
}

private Integer getRedisSelectDb(WarehouseProperties properties){
return properties.getStore().getRedis().getDb();
}

@Override
public CollectRep.MetricsData getCurrentMetricsData(@NonNull Long monitorId, @NonNull String metric) {
RedisCommands<String, CollectRep.MetricsData> commands = connection.sync();
Expand Down
Loading