Skip to content

Commit

Permalink
fix: fix pmd (#778)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsy1001de authored Jan 16, 2024
1 parent 16b3c3a commit 4eea04c
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ public Map<String, Set<String>> productCtl(MonitorProductCode code, Map<String,
MonitorInstanceCfg cfg = J.fromJson(instance.getConfig(), MonitorInstanceCfg.class);
control(action, uniqueId, code.getCode(), cfg.getClosed(), productClosed);
log.info(
"[product_ctl] exec ctl, tenant={}, tenantName={}, workspace={}, workspaceName={}, instance={}, uniqueId={}, action={}",
"[product_ctl] exec ctl, tenant={}, tenantName={}, workspace={}, workspaceName={}, instance={}, uniqueId={}, code={}, action={}",
instance.getTenant(), instance.getTenantName(), instance.getWorkspace(),
instance.getWorkspaceName(), instance.getInstance(), uniqueId, action);
instance.getWorkspaceName(), instance.getInstance(), uniqueId, code.getCode(), action);
instance.setConfig(J.toJson(cfg));
monitorInstanceService.updateByInstance(instance);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public MetricInfoDTO queryByMetric(String tenant, String workspace, String metri
List<MetricInfo> metricInfos = listByMap(columnMap);
if (CollectionUtils.isEmpty(metricInfos)) {
Map<String, Object> 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<MetricInfo> globalMetrics = listByMap(newColumnMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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_);
Expand Down Expand Up @@ -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_);
Expand Down Expand Up @@ -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_);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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_);
Expand Down Expand Up @@ -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_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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_);
Expand Down Expand Up @@ -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_);
Expand Down Expand Up @@ -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_);
Expand Down Expand Up @@ -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_;
Expand Down Expand Up @@ -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_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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", "超过查询限制,请缩短时间范围"),;

/**
* 错误码
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
}
Expand Down

0 comments on commit 4eea04c

Please sign in to comment.