-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge "Add classifiers and decorators"
- Loading branch information
Showing
324 changed files
with
28,248 additions
and
14,341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
teiv/src/main/java/org/oran/smo/teiv/controller/health/TiesHealthIndicator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* ============LICENSE_START======================================================= | ||
* Copyright (C) 2024 Ericsson | ||
* Modifications Copyright (C) 2024 OpenInfra Foundation Europe | ||
* ================================================================================ | ||
* Licensed 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. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* ============LICENSE_END========================================================= | ||
*/ | ||
package org.oran.smo.teiv.controller.health; | ||
|
||
import org.oran.smo.teiv.availability.DependentServiceAvailabilityKafka; | ||
|
||
import org.springframework.boot.actuate.health.Health; | ||
import org.springframework.boot.actuate.health.HealthIndicator; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
public abstract class TiesHealthIndicator implements HealthIndicator { | ||
|
||
protected final HealthStatus healthStatus; | ||
protected final DependentServiceAvailabilityKafka dependentServiceAvailabilityKafka; | ||
|
||
protected abstract String getServiceName(); | ||
|
||
protected TiesHealthIndicator(HealthStatus healthStatus, | ||
DependentServiceAvailabilityKafka dependentServiceAvailabilityKafka) { | ||
this.healthStatus = healthStatus; | ||
this.dependentServiceAvailabilityKafka = dependentServiceAvailabilityKafka; | ||
} | ||
|
||
protected Health healthUp() { | ||
String message = getServiceName() + " is UP and Healthy."; | ||
log.debug(message); | ||
return Health.up().withDetail("UP", message).build(); | ||
} | ||
|
||
protected Health healthDown(String reason) { | ||
String errorMessage = getServiceName() + " is DOWN because: " + reason; | ||
log.error(errorMessage); | ||
return Health.down().withDetail("Error", errorMessage).build(); | ||
} | ||
|
||
protected boolean isKafkaReachable() { | ||
return dependentServiceAvailabilityKafka.checkService(); | ||
} | ||
} |
Oops, something went wrong.