Skip to content

Commit

Permalink
chore: add HealthConstant
Browse files Browse the repository at this point in the history
  • Loading branch information
Lambert-Rao committed Feb 23, 2024
1 parent 403d2d4 commit 7db1411
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.eventmesh.dashboard.console.constant;

public class HealthConstant {
public static final String HEALTH_NEW_LINE_ENDING = "\n";
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package org.apache.eventmesh.dashboard.console.health;

import static org.apache.eventmesh.dashboard.console.constant.HealthConstant.HEALTH_NEW_LINE_ENDING;

import org.apache.eventmesh.dashboard.console.enums.health.HealthCheckStatus;
import org.apache.eventmesh.dashboard.console.health.check.config.HealthCheckObjectConfig;

Expand All @@ -41,7 +43,8 @@ public void update(String type, Long typeId, HealthCheckStatus status, String re
cacheMap.put(type, subMap);
}
CheckResult oldResult = subMap.get(typeId);
String oldDesc = Objects.isNull(oldResult.getResultDesc()) || oldResult.getResultDesc().isEmpty() ? "" : oldResult.getResultDesc() + "\n";
String oldDesc = Objects.isNull(oldResult.getResultDesc()) || oldResult.getResultDesc().isEmpty() ? ""
: oldResult.getResultDesc() + HEALTH_NEW_LINE_ENDING;
String description = oldDesc + resultDesc;
description += " Latency: " + latency.toString() + "ms";
CheckResult result = new CheckResult(status, description, LocalDateTime.now(),
Expand Down

0 comments on commit 7db1411

Please sign in to comment.