<commit_before># Health Check

>**Notes:**
  - Liveness and readiness probes were [introduced][ce-10416] in GitLab 9.1.
  - The `health_check` endpoint was [introduced][ce-3888] in GitLab 8.8 and will
    be deprecated in GitLab 9.1. Read more in the [old behavior](#old-behavior)
    section.
  - [Access token](#access-token) has been deprecated in GitLab 9.4
    in favor of [IP whitelist](#ip-whitelist)

GitLab provides liveness and readiness probes to indicate service health and
reachability to required services. These probes report on the status of the
database connection, Redis connection, and access to the filesystem. These
endpoints [can be provided to schedulers like Kubernetes][kubernetes] to hold
traffic until the system is ready or restart the container as needed.

## IP whitelist

To access monitoring resources, the client IP needs to be included in a whitelist.

[Read how to add IPs to a whitelist for the monitoring endpoints][admin].

## Using the endpoints

With default whitelist settings, the probes can be accessed from localhost:

- `http://localhost/-/health`
- `http://localhost/-/readiness`
- `http://localhost/-/liveness`


The first endpoint, `/-/health/`, only checks whether the application server is running. It does
-not verify the database or other services are running. A successful response with return
a 200 status code with the following message:

```
GitLab OK
```

The readiness and liveness probes will provide a report of system health in JSON format.

Readiness example output:

```
{
   "queues_check" : {
      "status" : "ok"
   },
   "redis_check" : {
      "status" : "ok"
   },
   "shared_state_check" : {
      "status" : "ok"<commit_msg>Fix typo in health check documentation<commit_after># Health Check

>**Notes:**
  - Liveness and readiness probes were [introduced][ce-10416] in GitLab 9.1.
  - The `health_check` endpoint was [introduced][ce-3888] in GitLab 8.8 and will
    be deprecated in GitLab 9.1. Read more in the [old behavior](#old-behavior)
    section.
  - [Access token](#access-token) has been deprecated in GitLab 9.4
    in favor of [IP whitelist](#ip-whitelist)

GitLab provides liveness and readiness probes to indicate service health and
reachability to required services. These probes report on the status of the
database connection, Redis connection, and access to the filesystem. These
endpoints [can be provided to schedulers like Kubernetes][kubernetes] to hold
traffic until the system is ready or restart the container as needed.

## IP whitelist

To access monitoring resources, the client IP needs to be included in a whitelist.

[Read how to add IPs to a whitelist for the monitoring endpoints][admin].

## Using the endpoints

With default whitelist settings, the probes can be accessed from localhost:

- `http://localhost/-/health`
- `http://localhost/-/readiness`
- `http://localhost/-/liveness`


The first endpoint, `/-/health/`, only checks whether the application server is running. It does
-not verify the database or other services are running. A successful response will return
a 200 status code with the following message:

```
GitLab OK
```

The readiness and liveness probes will provide a report of system health in JSON format.

Readiness example output:

```
{
   "queues_check" : {
      "status" : "ok"
   },
   "redis_check" : {
      "status" : "ok"
   },
   "shared_state_check" : {
      "status" : "ok"
{'fraction_non_alphanumeric': 0.09013754755633596, 'fraction_numerical': 0.011706175007316359, 'mean_word_length': 3.896848137535817, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6978390', 'n_tokens_mistral': 1047, 'n_tokens_neox': 928, 'n_words': 430}