ome / omero-ms-zarr

Experimental micro-service for implementing the Zarr spec over HTTP
https://www.openmicroscopy.org/omero
GNU General Public License v2.0
17 stars 12 forks source link

Add /heath endpoint for checking availability #34

Open manics opened 4 years ago

manics commented 4 years ago

To support horizontal scaling, e.g. in container orchestration systems, it would be helpful to have an unauthenticated endpoint to indicate whether the service was healthy. This could be fairly simple to begin with, returning a code 200 with a JSON response e.g. {"status": "ok"} if the service is capable of servicing requests, and a HTTP error code if not. The JSON response could optionally give details of the problem but this is not essential.

See for example

mtbc commented 4 years ago

Note also https://github.com/ome/omero-ms-zarr/blob/v0.1.0/src/main/java/org/openmicroscopy/ms/zarr/ZarrDataVerticle.java#L77.

joshmoore commented 4 years ago

see also: https://vertx.io/docs/vertx-health-check/java/

(I especially like:

// Status can provide addition data provided as JSON
healthCheckHandler.register("my-procedure-name", future -> {
  future.complete(Status.OK(new JsonObject().put("available-memory", "2mb")));
});

)