Skip to content

Commit

Permalink
Addressed PR review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Alfredo Gutierrez <[email protected]>
  • Loading branch information
AlfredoG87 committed Aug 16, 2024
1 parent f37a287 commit 6f4bd85
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
6 changes: 3 additions & 3 deletions charts/hedera-block-node/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ spec:
path: {{ .Values.blockNode.health.liveness.endpoint }}
port: {{ .Values.service.port }}
readinessProbe:
httpGet:
path: {{ .Values.blockNode.health.readiness.endpoint }}
port: {{ .Values.service.port }}
httpGet:
path: {{ .Values.blockNode.health.readiness.endpoint }}
port: {{ .Values.service.port }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
4 changes: 2 additions & 2 deletions charts/hedera-block-node/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ blockNode:
PRIVATE_KEY: "fake_private_key"
health:
readiness:
endpoint: "/health/readiness"
endpoint: "/healthz/readiness"
liveness:
endpoint: "/health/liveness"
endpoint: "/healthz/liveness"
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.hedera.block.server.health;

import edu.umd.cs.findbugs.annotations.NonNull;
import io.helidon.webserver.http.HttpRules;
import io.helidon.webserver.http.HttpService;
import io.helidon.webserver.http.ServerRequest;
Expand All @@ -36,15 +37,15 @@ public interface HealthService extends HttpService {
* @param httpRules is used to configure the health endpoints routes
*/
@Override
void routing(HttpRules httpRules);
void routing(@NonNull final HttpRules httpRules);

/**
* Handles the request for liveness endpoint, that it most be defined on routing implementation.
*
* @param req the server request
* @param res the server response
*/
void handleLiveness(ServerRequest req, ServerResponse res);
void handleLiveness(@NonNull final ServerRequest req, @NonNull final ServerResponse res);

/**
* Handles the request for readiness endpoint, that it most be defined on routing
Expand All @@ -53,5 +54,5 @@ public interface HealthService extends HttpService {
* @param req the server request
* @param res the server response
*/
void handleReadiness(ServerRequest req, ServerResponse res);
void handleReadiness(@NonNull final ServerRequest req, @NonNull final ServerResponse res);
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public HealthServiceImpl(@NonNull ServiceStatus serviceStatus) {

@Override
public String getHealthRootPath() {
return "/health";
return "/healthz";
}

/**
Expand All @@ -50,23 +50,38 @@ public String getHealthRootPath() {
* @param httpRules is used to configure the health endpoints routes
*/
@Override
public void routing(HttpRules httpRules) {
public void routing(@NonNull final HttpRules httpRules) {
httpRules
.get(LIVENESS_PATH, this::handleLiveness)
.get(READINESS_PATH, this::handleReadiness);
}

/**
* Handles the request for liveness endpoint, that it most be defined on routing implementation.
*
* @param req the server request
* @param res the server response
*/
@Override
public void handleLiveness(ServerRequest req, ServerResponse res) {
public final void handleLiveness(
@NonNull final ServerRequest req, @NonNull final ServerResponse res) {
if (serviceStatus.isRunning()) {
res.status(200).send("OK");
} else {
res.status(503).send("Service is not running");
}
}

/**
* Handles the request for readiness endpoint, that it most be defined on routing
* implementation.
*
* @param req the server request
* @param res the server response
*/
@Override
public void handleReadiness(ServerRequest req, ServerResponse res) {
public final void handleReadiness(
@NonNull final ServerRequest req, @NonNull final ServerResponse res) {
if (serviceStatus.isRunning()) {
res.status(200).send("OK");
} else {
Expand Down

0 comments on commit 6f4bd85

Please sign in to comment.