Add /healthz endpoint for health monitoring in S3Proxy#763
Add /healthz endpoint for health monitoring in S3Proxy#763Aazme wants to merge 2 commits intogaul:masterfrom
Conversation
- Implemented a new `/healthz` endpoint to handle GET requests.
- Added the `handleVersionRequest` method to return a JSON response with health status:
- Response: `{ "status": "OK" }`
- Updated `S3ProxyHandler` to route requests to `/healthz` and handle responses effectively.
- The endpoint provides a simple mechanism for health monitoring and status validation.
gaul
left a comment
There was a problem hiding this comment.
Please address Checkstyle warnings:
Warning: src/main/java/org/gaul/s3proxy/S3ProxyHandler.java:[2042] (regexp) RegexpSingleline: Line has trailing spaces.
Warning: src/main/java/org/gaul/s3proxy/S3ProxyHandler.java:[2044] (regexp) RegexpSingleline: Line has trailing spaces.
|
|
||
| response.addHeader(HttpHeaders.ETAG, maybeQuoteETag(eTag)); | ||
| } | ||
| private void handleVersionRequest(HttpServletResponse response) throws IOException { |
There was a problem hiding this comment.
Should this be called handleStatuszRequest?
| response.setContentType("application/json"); | ||
| response.setCharacterEncoding("UTF-8"); | ||
|
|
||
| String versionInfo = "{ \"status\": \"OK\"}"; |
There was a problem hiding this comment.
Maybe this should return the current time, the time s3proxy launched, and the git hash? Are there any well-known statusz formats this could follow?
| addCorsResponseHeader(request, response); | ||
|
|
||
| response.addHeader(HttpHeaders.ETAG, maybeQuoteETag(eTag)); | ||
| } |
| String uri = request.getRequestURI(); | ||
| String originalUri = request.getRequestURI(); | ||
|
|
||
| // Check for the /version endpoint |
gaul
left a comment
There was a problem hiding this comment.
Can you exercise this in some kind of test, e.g., AwsSdkAnonymousTest?
| response.setContentType("application/json"); | ||
| response.setCharacterEncoding("UTF-8"); | ||
|
|
||
| String versionInfo = "{ \"status\": \"OK\"}"; |
There was a problem hiding this comment.
Maybe this should return the current time, the time s3proxy launched, and the git hash? Are there any well-known statusz formats this could follow?
|
I'm preparing a new release so please try to address my comments before the weekend. |
|
I'll work on those during the coming days, had a busy weeks |
For the "has my app started yet" aspect of "basic health check mechanism" in k8s, you can also do: The docker image exposes port 80 and the Java app/server is listening on port 80. Until the Java server is initialized, the TCP connection on port 80 won't be able to be established. The addition of an explicit |
|
@Aazme could you finish this PR? |
1 similar comment
|
@Aazme could you finish this PR? |
86c38be to
6b2f492
Compare
| <plugin> | ||
| <groupId>pl.project13.maven</groupId> | ||
| <artifactId>git-commit-id-plugin</artifactId> | ||
| <version>5.0.0</version> |
There was a problem hiding this comment.
How did you test this locally? The latest version of git-commit-id-plugin is 4.9.10: https://mvnrepository.com/artifact/pl.project13.maven/git-commit-id-plugin while the latest version of git-commit-id-maven-plugin is 9.0.2: git-commit-id-maven-plugin
This PR introduces a new /healthz endpoint in S3Proxy to provide a basic health check mechanism.
Changes:
Added a /healthz route to handle GET requests.
Implemented handleVersionRequest method to return a JSON response:
{ "status": "OK" }Updated S3ProxyHandler to route and process health check requests.
This endpoint serves as a lightweight solution for monitoring the service's availability.