Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated the new docs with details #402

Open
wants to merge 4 commits into
base: new-docs
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 6 additions & 99 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/src/components/Layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const navigation = [
{
title: 'Advanced guides',
links: [
{ title: 'Writing sustom checks', href: '/writing-your-own-checks' },
{ title: 'Writing custom checks', href: '/writing-your-own-checks' },
{ title: 'Customizing the output', href: '/customize-output' },
{ title: 'Management Command', href: '/management-command' },
{ title: 'External Monitoring', href: '/monitoring' },
Expand Down
69 changes: 69 additions & 0 deletions docs/src/pages/checks/cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: Cache Health Check
pageTitle: django-health-check cache check
description: Verify that the Django application's caching system is operating seamlessly and efficiently
---

Caching is storing the outcome of a time-consuming calculation to avoid recomputing in the future.

The `health_check.cache` verifies that the Django application
caching mechanism is functioning as intended.


## Settings

The settings that need to be correct are the standard Django `CACHES`
settings in your `settings.py`.
To ensure that you have configured Caching properly go through this
[documentation](https://docs.djangoproject.com/en/4.2/topics/cache/)

## What does it check?

This check does the following:

- Reads the cache backend's configuration
- Writes to the cache backend
- Reads from the cache backend
- Checks for timeouts
- Deletes the test data from the cache backend
- Returns status

This ensures your app's cache backend is functioning correctly and is always available. It not only prevents [data inconsistencies](https://www.alachisoft.com/blogs/cache-database-data-inconsistency-pitfall-and-solutions/#:~:text=Data%20inconsistency%20issues%20occur%20when,the%20cache%20is%20not%20synchronized) and [race conditions](https://www.techtarget.com/searchstorage/definition/race-condition) but also helps identify and troubleshoot cache-related problems.

## Steps
1.Installation
```shell
#requirements.txt
django-health-check == x.x.x
```

2.Configure your health check URL endpoint:

```python
urlpatterns = [
# ... your existing URLs here ...
url(r'^health/', include('health_check.urls')),
]
```

3.Add the `health_check.cache` applications to your `INSTALLED_APPS`:

```python
INSTALLED_APPS = [
# ...
'health_check',
'health_check.cache',
]
```
4.The cache healthcheck tries to write and read a specific key within the cache backend.
It can be customized by setting `HEALTHCHECK_CACHE_KEY` in the `settings.py` file to another value:

```python
HEALTHCHECK_CACHE_KEY = "custom_health_check_key"
```

5.Run the health check
```shell
python manage.py health_check

```
71 changes: 71 additions & 0 deletions docs/src/pages/checks/contrib/celery.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: Celery Health Check
pageTitle: django-health-check celery check
description: Verify the Celery tasks are executed successfully.
---

The `health_check.contrib.celery` verifies that the Celery tasks
can be executed successfully within a specified timeout period

Ensure that you have celery installed and configured in your application.

Information about how to properly configure celery with django
is [here](https://docs.celeryq.dev/en/stable/django/first-steps-with-django.html)


## Settings

The settings that need to be correct are `HEALTHCHECK_CELERY_RESULT_TIMEOUT`
and `HEALTHCHECK_CELERY_QUEUE_TIMEOUT` in your `settings.py`.

## What does it check?

This check does the following:

- Checks celery worker status
- Checks that the celery workers can execute tasks
- Results are returned within specified time limits

Celery health checks helps you catch potential issues early, ensures proper configuration,
and provides insights into the real-time status of your Celery workers.


## Steps
1.Installation
```shell
#requirements.txt
django-health-check == x.x.x
```

2.Configure your health check URL endpoint:

```python
urlpatterns = [
# ... your existing URLs here ...
url(r'^health/', include('health_check.urls')),
]
```

3.Add the `health_check.contrib.celery` applications to your `INSTALLED_APPS`:

```python
INSTALLED_APPS = [
# ...
'health_check',
'health_check.contrib.celery',
]

# Set the timeout for waiting for Celery task results (in seconds)
HEALTHCHECK_CELERY_RESULT_TIMEOUT = 3 # this is the default time, Adjust the value as needed

# Set the timeout for the expiration of the Celery task in the queue (in seconds)
HEALTHCHECK_CELERY_QUEUE_TIMEOUT = 3 #this is the default time, Adjust the value as needed

#..... other celery settings.....

```
4.Run the health check
```shell
python manage.py health_check

```
Loading
Loading