From 4eea04ce26a773ab9b9dd30e4f141bbac8f76ec7 Mon Sep 17 00:00:00 2001 From: jsy Date: Tue, 16 Jan 2024 15:56:04 +0800 Subject: [PATCH] fix: fix pmd (#778) --- .../server/common/ctl/ProductCtlServiceImpl.java | 4 ++-- .../server/common/service/MetricInfoServiceImpl.java | 4 ++-- .../src/main/java/prometheus/Prometheus.java | 6 ------ .../src/main/java/prometheus/PrometheusTypes.java | 5 ----- .../server/home/common/util/ResultCodeEnum.java | 2 +- .../server/home/biz/common/MetaDictKey.java | 2 +- .../server/home/web/controller/QueryFacadeImpl.java | 12 ++++++++---- 7 files changed, 14 insertions(+), 21 deletions(-) diff --git a/server/common/common-service/src/main/java/io/holoinsight/server/common/ctl/ProductCtlServiceImpl.java b/server/common/common-service/src/main/java/io/holoinsight/server/common/ctl/ProductCtlServiceImpl.java index 3f3a96e5a..086905e42 100644 --- a/server/common/common-service/src/main/java/io/holoinsight/server/common/ctl/ProductCtlServiceImpl.java +++ b/server/common/common-service/src/main/java/io/holoinsight/server/common/ctl/ProductCtlServiceImpl.java @@ -133,9 +133,9 @@ public Map> productCtl(MonitorProductCode code, Map metricInfos = listByMap(columnMap); if (CollectionUtils.isEmpty(metricInfos)) { Map newColumnMap = new HashMap<>(); - newColumnMap.put("tenant", "-"); - newColumnMap.put("workspace", "-"); + // newColumnMap.put("tenant", "-"); + // newColumnMap.put("workspace", "-"); newColumnMap.put("metric_table", metric); newColumnMap.put("deleted", 0); List globalMetrics = listByMap(newColumnMap); diff --git a/server/gateway/gateway-grpc-gen/src/main/java/prometheus/Prometheus.java b/server/gateway/gateway-grpc-gen/src/main/java/prometheus/Prometheus.java index de3f9b7a5..a4c189a5b 100644 --- a/server/gateway/gateway-grpc-gen/src/main/java/prometheus/Prometheus.java +++ b/server/gateway/gateway-grpc-gen/src/main/java/prometheus/Prometheus.java @@ -504,7 +504,6 @@ public prometheus.Prometheus.WriteRequest build() { @java.lang.Override public prometheus.Prometheus.WriteRequest buildPartial() { prometheus.Prometheus.WriteRequest result = new prometheus.Prometheus.WriteRequest(this); - int from_bitField0_ = bitField0_; if (timeseriesBuilder_ == null) { if (((bitField0_ & 0x00000001) != 0)) { timeseries_ = java.util.Collections.unmodifiableList(timeseries_); @@ -1961,7 +1960,6 @@ public prometheus.Prometheus.ReadRequest build() { @java.lang.Override public prometheus.Prometheus.ReadRequest buildPartial() { prometheus.Prometheus.ReadRequest result = new prometheus.Prometheus.ReadRequest(this); - int from_bitField0_ = bitField0_; if (queriesBuilder_ == null) { if (((bitField0_ & 0x00000001) != 0)) { queries_ = java.util.Collections.unmodifiableList(queries_); @@ -3072,7 +3070,6 @@ public prometheus.Prometheus.ReadResponse build() { @java.lang.Override public prometheus.Prometheus.ReadResponse buildPartial() { prometheus.Prometheus.ReadResponse result = new prometheus.Prometheus.ReadResponse(this); - int from_bitField0_ = bitField0_; if (resultsBuilder_ == null) { if (((bitField0_ & 0x00000001) != 0)) { results_ = java.util.Collections.unmodifiableList(results_); @@ -4104,7 +4101,6 @@ public prometheus.Prometheus.Query build() { @java.lang.Override public prometheus.Prometheus.Query buildPartial() { prometheus.Prometheus.Query result = new prometheus.Prometheus.Query(this); - int from_bitField0_ = bitField0_; result.startTimestampMs_ = startTimestampMs_; result.endTimestampMs_ = endTimestampMs_; if (matchersBuilder_ == null) { @@ -5160,7 +5156,6 @@ public prometheus.Prometheus.QueryResult build() { @java.lang.Override public prometheus.Prometheus.QueryResult buildPartial() { prometheus.Prometheus.QueryResult result = new prometheus.Prometheus.QueryResult(this); - int from_bitField0_ = bitField0_; if (timeseriesBuilder_ == null) { if (((bitField0_ & 0x00000001) != 0)) { timeseries_ = java.util.Collections.unmodifiableList(timeseries_); @@ -6099,7 +6094,6 @@ public prometheus.Prometheus.ChunkedReadResponse build() { public prometheus.Prometheus.ChunkedReadResponse buildPartial() { prometheus.Prometheus.ChunkedReadResponse result = new prometheus.Prometheus.ChunkedReadResponse(this); - int from_bitField0_ = bitField0_; if (chunkedSeriesBuilder_ == null) { if (((bitField0_ & 0x00000001) != 0)) { chunkedSeries_ = java.util.Collections.unmodifiableList(chunkedSeries_); diff --git a/server/gateway/gateway-grpc-gen/src/main/java/prometheus/PrometheusTypes.java b/server/gateway/gateway-grpc-gen/src/main/java/prometheus/PrometheusTypes.java index 8312a5bea..1c66b99b7 100644 --- a/server/gateway/gateway-grpc-gen/src/main/java/prometheus/PrometheusTypes.java +++ b/server/gateway/gateway-grpc-gen/src/main/java/prometheus/PrometheusTypes.java @@ -2365,7 +2365,6 @@ public prometheus.PrometheusTypes.Exemplar build() { @java.lang.Override public prometheus.PrometheusTypes.Exemplar buildPartial() { prometheus.PrometheusTypes.Exemplar result = new prometheus.PrometheusTypes.Exemplar(this); - int from_bitField0_ = bitField0_; if (labelsBuilder_ == null) { if (((bitField0_ & 0x00000001) != 0)) { labels_ = java.util.Collections.unmodifiableList(labels_); @@ -3597,7 +3596,6 @@ public prometheus.PrometheusTypes.TimeSeries build() { public prometheus.PrometheusTypes.TimeSeries buildPartial() { prometheus.PrometheusTypes.TimeSeries result = new prometheus.PrometheusTypes.TimeSeries(this); - int from_bitField0_ = bitField0_; if (labelsBuilder_ == null) { if (((bitField0_ & 0x00000001) != 0)) { labels_ = java.util.Collections.unmodifiableList(labels_); @@ -5781,7 +5779,6 @@ public prometheus.PrometheusTypes.Labels build() { @java.lang.Override public prometheus.PrometheusTypes.Labels buildPartial() { prometheus.PrometheusTypes.Labels result = new prometheus.PrometheusTypes.Labels(this); - int from_bitField0_ = bitField0_; if (labelsBuilder_ == null) { if (((bitField0_ & 0x00000001) != 0)) { labels_ = java.util.Collections.unmodifiableList(labels_); @@ -7931,7 +7928,6 @@ public prometheus.PrometheusTypes.ReadHints build() { public prometheus.PrometheusTypes.ReadHints buildPartial() { prometheus.PrometheusTypes.ReadHints result = new prometheus.PrometheusTypes.ReadHints(this); - int from_bitField0_ = bitField0_; result.stepMs_ = stepMs_; result.func_ = func_; result.startMs_ = startMs_; @@ -10092,7 +10088,6 @@ public prometheus.PrometheusTypes.ChunkedSeries build() { public prometheus.PrometheusTypes.ChunkedSeries buildPartial() { prometheus.PrometheusTypes.ChunkedSeries result = new prometheus.PrometheusTypes.ChunkedSeries(this); - int from_bitField0_ = bitField0_; if (labelsBuilder_ == null) { if (((bitField0_ & 0x00000001) != 0)) { labels_ = java.util.Collections.unmodifiableList(labels_); diff --git a/server/home/home-common/src/main/java/io/holoinsight/server/home/common/util/ResultCodeEnum.java b/server/home/home-common/src/main/java/io/holoinsight/server/home/common/util/ResultCodeEnum.java index 0a150b367..a2c7de4c0 100644 --- a/server/home/home-common/src/main/java/io/holoinsight/server/home/common/util/ResultCodeEnum.java +++ b/server/home/home-common/src/main/java/io/holoinsight/server/home/common/util/ResultCodeEnum.java @@ -68,7 +68,7 @@ public enum ResultCodeEnum { */ OBJECT_CONVERT_ERROR("OBJECT_CONVERT_ERROR", "对象转换出错"), - EXCEED_SERIES_LIMIT("EXCEED_SERIES_LIMIT", "超过查询限制"),; + EXCEED_SERIES_LIMIT("EXCEED_SERIES_LIMIT", "超过查询限制,请缩短时间范围"),; /** * 错误码 diff --git a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/common/MetaDictKey.java b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/common/MetaDictKey.java index d2fb74a66..3870c13fa 100644 --- a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/common/MetaDictKey.java +++ b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/common/MetaDictKey.java @@ -11,7 +11,7 @@ public class MetaDictKey { public static final String ULA = "ula"; public static final String ULA_CLOSE = "ula_close"; public static final String ULA_HOST = "ula_host"; - public static final String LOG_TIME_LAYOUT = "s"; + public static final String LOG_TIME_LAYOUT = "log_time_layout"; public static final String TOKEN_URL_WRITE_LIST = "token_url_write_list"; public static final String TOKEN_URL_NO_AUTH = "token_url_no_auth"; public static final String IS_APM_MATERIALIZED = "is_apm_materialized"; diff --git a/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/QueryFacadeImpl.java b/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/QueryFacadeImpl.java index cb87a5791..94f13d479 100644 --- a/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/QueryFacadeImpl.java +++ b/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/QueryFacadeImpl.java @@ -127,7 +127,8 @@ public void doManage() { JsonResult.createSuccessResult(result, response); } catch (Throwable t) { log.error("query error", t); - if (t.getMessage().contains("Evaluated points num") + if ((t.getMessage().contains("Evaluated points num") + || t.getMessage().contains("Evaluated series num")) && t.getMessage().contains("larger than")) { throw new MonitorException(ResultCodeEnum.EXCEED_SERIES_LIMIT, t.getMessage()); } @@ -182,7 +183,8 @@ public void doManage() { QueryResponse response = queryClientService.queryTags(convertRequest(request)); JsonResult.createSuccessResult(result, response); } catch (Throwable t) { - if (t.getMessage().contains("Evaluated points num") + if ((t.getMessage().contains("Evaluated points num") + || t.getMessage().contains("Evaluated series num")) && t.getMessage().contains("larger than")) { throw new MonitorException(ResultCodeEnum.EXCEED_SERIES_LIMIT, t.getMessage()); } @@ -409,7 +411,8 @@ public void doManage() { QueryResponse response = queryClientService.pqlRangeQuery(rangeRequest); JsonResult.createSuccessResult(result, response.getResults()); } catch (Throwable t) { - if (t.getMessage().contains("Evaluated points num") + if ((t.getMessage().contains("Evaluated points num") + || t.getMessage().contains("Evaluated series num")) && t.getMessage().contains("larger than")) { throw new MonitorException(ResultCodeEnum.EXCEED_SERIES_LIMIT, t.getMessage()); } @@ -449,7 +452,8 @@ public void doManage() { QueryResponse response = queryClientService.pqlInstantQuery(instantRequest); JsonResult.createSuccessResult(result, response.getResults()); } catch (Throwable t) { - if (t.getMessage().contains("Evaluated points num") + if ((t.getMessage().contains("Evaluated points num") + || t.getMessage().contains("Evaluated series num")) && t.getMessage().contains("larger than")) { throw new MonitorException(ResultCodeEnum.EXCEED_SERIES_LIMIT, t.getMessage()); }