commit | c26d83375e79ad986a8d5dd701110aa739f21c9b | [log] [tgz] |
---|---|---|
author | Luca Milanesio <luca.milanesio@gmail.com> | Tue Jan 15 15:59:39 2019 +0000 |
committer | Luca Milanesio <luca.milanesio@gmail.com> | Wed Jan 16 14:46:10 2019 +0000 |
tree | 96114be33301d54f735a3a80ccc99befa79add8d | |
parent | 06a1d9f5ffd9582e6f474f950f018f3c62594591 [diff] |
Implement JGit health-check Check that JGit is able to open and read objects from All-Projects repository. Change-Id: Ibc7dc325b2f3529636b6ed8297bf3ca13269b444
Allow having a single entry point to check the availability of the services that Gerrit exposes.
Clone or link this plugin to the plugins directory of Gerrit‘s source tree, and then run bazel build on the plugin’s directory.
Example:
git clone --recursive https://gerrit.googlesource.com/gerrit git clone https://gerrit.googlesource.com/plugins/healthcheck pushd gerrit/plugins && ln -s ../../healthcheck . && popd cd gerrit && bazel build plugins/healthcheck
The output plugin jar is created in:
bazel-genfiles/plugins/healthcheck/healthcheck.jar
Copy the healthcheck.jar into the Gerrit's /plugins directory and wait for the plugin to be automatically loaded.
The healthcheck plugin exposes a single endpoint under its root URL and provides a JSON output of the Gerrit health status.
The HTTP status code returned indicates whether Gerrit is healthy (HTTP status 200) or has some issues (HTTP status 500).
The HTTP response payload is a JSON output that contains the details of the checks performed.
Each check returns a JSON payload with the following information:
ts: epoch timestamp in millis of the individual check
elapsed: elapsed time in millis to complete the check
result: result of the health check
Example of a healthy Gerrit response:
GET /config/server/healthcheck~status 200 OK Content-Type: application/json { "ts": 139402910202, "elapsed": 100, "reviewdb": { "ts": 139402910202, "elapsed": 50, "result": "passed" }, "projectslist": { "ts": 139402910202, "elapsed": 100, "result": "passed" }, "auth": { "ts": 139402910202, "elapsed": 80, "result": "passed" } }
Example of a Gerrit instance with the projects list timing out:
GET /config/server/healthcheck~status 500 ERROR Content-Type: application/json { "ts": 139402910202, "elapsed": 100, "reviewdb": { "ts": 139402910202, "elapsed": 50, "result": "passed" }, "projectslist": { "ts": 139402910202, "elapsed": 100, "result": "timeout" }, "auth": { "ts": 139402910202, "elapsed": 80, "result": "passed" } }