commit | e746a7787a4a16133aee76a53be67b954498211e | [log] [tgz] |
---|---|---|
author | Antonio Barone <syntonyze@gmail.com> | Tue Jan 29 15:53:19 2019 +0000 |
committer | Antonio Barone <syntonyze@gmail.com> | Tue Jan 29 15:53:19 2019 +0000 |
tree | f2040f47fd5db9e89dce2b8508551f8d1df6766d | |
parent | 75532242fa3e9048f5b3c03b376229628a1598fe [diff] |
Do not use QueryProcessor multiple times The QueryProcessor object is non-threadsafe and it should not be reused. This is been enforced with runtime state checks from stable-2.15 onwards. Rather than using the same object through multiple requests, the QueryChanges healthcheck now will be instantiated with a _provider_ of QueryChanges, so that a new QueryProcessor is used each time the healthcheck is executed. Change-Id: Ifa4e621eaf87a409c428a618e2a7f2dcd0bb2ca7
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" }, "jgit": { "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" }, "jgit": { "ts": 139402910202, "elapsed": 80, "result": "passed" } }
As for all other endpoints in Gerrit, some metrics are automatically emitted when the /config/server/healthcheck~status
endpoint is hit (thanks to the Dropwizard library).
Some additional metrics are also produced to give extra insights on their result about results and latency of healthcheck sub component, such as jgit, reviewdb, etc.
More information can be found in the config.md file.