You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/07/23 22:37:37 UTC

[GitHub] [pinot] Jackie-Jiang commented on a diff in pull request #9031: Add health/readiness and health/liveness endpoint

Jackie-Jiang commented on code in PR #9031:
URL: https://github.com/apache/pinot/pull/9031#discussion_r928171637


##########
pinot-server/src/main/java/org/apache/pinot/server/api/resources/HealthCheckResource.java:
##########
@@ -55,7 +55,36 @@ public class HealthCheckResource {
       @ApiResponse(code = 503, message = "Server is not healthy")
   })
   public String checkHealth() {
-    Status status = ServiceStatus.getServiceStatus(_instanceId);
+    return getReadinessStatus(_instanceId);
+  }
+
+  @GET
+  @Path("/health/liveness")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Checking server liveness status.")
+  @ApiResponses(value = {
+      @ApiResponse(code = 200, message = "Server is healthy"),
+      @ApiResponse(code = 503, message = "Server is not healthy")
+  })
+  public String checkLiveness() {
+    // Returns OK since if we reached here, the admin application is running.
+    return "OK";
+  }
+
+  @GET
+  @Path("/health/readiness")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Checking server instance health")
+  @ApiResponses(value = {
+      @ApiResponse(code = 200, message = "Server is healthy"),
+      @ApiResponse(code = 503, message = "Server is not healthy")
+  })

Review Comment:
   (minor)
   ```suggestion
     @ApiOperation(value = "Checking server readiness status")
     @ApiResponses(value = {
         @ApiResponse(code = 200, message = "Server is ready to serve queries"),
         @ApiResponse(code = 503, message = "Server is not ready to serve queries")
     })
   ```



##########
pinot-server/src/main/java/org/apache/pinot/server/api/resources/HealthCheckResource.java:
##########
@@ -55,7 +55,36 @@ public class HealthCheckResource {
       @ApiResponse(code = 503, message = "Server is not healthy")
   })
   public String checkHealth() {

Review Comment:
   Consider adding a deprecate annotation with some comment



##########
pinot-server/src/main/java/org/apache/pinot/server/api/resources/HealthCheckResource.java:
##########
@@ -55,7 +55,36 @@ public class HealthCheckResource {
       @ApiResponse(code = 503, message = "Server is not healthy")
   })
   public String checkHealth() {
-    Status status = ServiceStatus.getServiceStatus(_instanceId);
+    return getReadinessStatus(_instanceId);
+  }
+
+  @GET
+  @Path("/health/liveness")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Checking server liveness status.")
+  @ApiResponses(value = {
+      @ApiResponse(code = 200, message = "Server is healthy"),
+      @ApiResponse(code = 503, message = "Server is not healthy")

Review Comment:
   (minor)
   ```suggestion
         @ApiResponse(code = 200, message = "Server is live"),
         @ApiResponse(code = 503, message = "Server is not live")
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org