Copilot commented on code in PR #10840: URL: https://github.com/apache/gravitino/pull/10840#discussion_r3122951000
########## docs/open-api/health.yaml: ########## @@ -0,0 +1,168 @@ +# 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. + + +--- + +paths: + /health: + get: + tags: + - health + summary: Aggregate health + operationId: aggregateHealth + description: > + Returns aggregate health status combining liveness and readiness checks. + Returns 200 when all checks pass; 503 when any check fails. + This endpoint is exempt from authentication so probes can reach it without credentials. + security: [] + responses: + "200": + $ref: "#/components/responses/HealthResponse" + "503": + $ref: "#/components/responses/HealthResponse" + "4XX": + $ref: "./openapi.yaml#/components/responses/BadRequestErrorResponse" + "5xx": + $ref: "./openapi.yaml#/components/responses/ServerErrorResponse" + Review Comment: In the OpenAPI spec, response-code range keys should be uppercase (e.g., `5XX`). The current `5xx` keys may be rejected by validators/tooling. Please change `5xx` to `5XX` to match the OpenAPI patterned-field syntax (and keep casing consistent with `4XX`). ########## conf/gravitino.conf.template: ########## @@ -19,6 +19,8 @@ # THE CONFIGURATION FOR Gravitino SERVER gravitino.server.shutdown.timeout = 3000 +# Timeout in milliseconds for the entity-store liveness probe used by health endpoints Review Comment: The comment describes this as an "entity-store liveness probe", but it configures the readiness probe used by `/api/health/ready`. Please update the comment so operators understand which probe this affects. ```suggestion # Timeout in milliseconds for the entity-store readiness probe used by /api/health/ready ``` ########## server/src/main/java/org/apache/gravitino/server/GravitinoServer.java: ########## @@ -175,6 +176,11 @@ protected void configure() { server.addServlet(servlet, API_ANY_PATH); Servlet configServlet = new ConfigServlet(serverConfig); server.addServlet(configServlet, "/configs"); + + // Root-level alias for enterprise GTMs that require probes at well-known root paths. + // Forwards /health, /health/live, /health/ready to the canonical /api/health/* endpoints. + server.addServlet(new HealthAliasServlet(), "/health/*"); Review Comment: The PR description mentions a root-level alias at `/health.html`, but the server only registers `HealthAliasServlet` for `/health/*`. As a result `/health.html` won't be served, and even if mapped, `HealthAliasServlet` would currently forward `/health.html` to `/api/health.html` (which doesn't exist). Consider adding an explicit servlet mapping for `/health.html` and special-casing it to forward to `/api/health` (and add/adjust unit tests accordingly). ########## server-common/src/main/java/org/apache/gravitino/server/ServerConfig.java: ########## @@ -35,6 +35,15 @@ public class ServerConfig extends Config { .checkValue(value -> value > 0, ConfigConstants.POSITIVE_NUMBER_ERROR_MSG) .createWithDefault(3 * 1000); + public static final ConfigEntry<Long> HEALTH_ENTITY_STORE_PROBE_TIMEOUT_MS = + new ConfigBuilder("gravitino.server.health.entityStore.probeTimeoutMs") + .doc( + "Timeout in milliseconds for the entity-store liveness probe used by health endpoints") + .version(ConfigConstants.VERSION_1_3_0) + .longConf() + .checkValue(value -> value > 0, ConfigConstants.POSITIVE_NUMBER_ERROR_MSG) + .createWithDefault(2000L); Review Comment: The config doc string says this timeout is for an "entity-store liveness probe", but the probe is used by the readiness check (`/api/health/ready`). Please update the description to avoid confusion (readiness vs liveness semantics). ########## server-common/src/main/java/org/apache/gravitino/server/ServerConfig.java: ########## @@ -35,6 +35,15 @@ public class ServerConfig extends Config { .checkValue(value -> value > 0, ConfigConstants.POSITIVE_NUMBER_ERROR_MSG) .createWithDefault(3 * 1000); + public static final ConfigEntry<Long> HEALTH_ENTITY_STORE_PROBE_TIMEOUT_MS = + new ConfigBuilder("gravitino.server.health.entityStore.probeTimeoutMs") + .doc( + "Timeout in milliseconds for the entity-store liveness probe used by health endpoints") + .version(ConfigConstants.VERSION_1_3_0) + .longConf() + .checkValue(value -> value > 0, ConfigConstants.POSITIVE_NUMBER_ERROR_MSG) + .createWithDefault(2000L); Review Comment: This PR introduces a new config key (`gravitino.server.health.entityStore.probeTimeoutMs`), which conflicts with the PR description statement "No property keys added or removed." Either update the PR description or clarify that this PR adds a new optional server configuration entry. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
