forked from Kamva-Academy/Kamva-Backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fe3ed1b
commit bcaf5c6
Showing
3 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
from manage_content_service.celery_app import app as celery_app | ||
import time | ||
|
||
__all__ = ("celery_app",) | ||
__all__ = ("celery_app",) | ||
start_time = time.time() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# views.py | ||
from django.http import JsonResponse | ||
import time | ||
from . import start_time | ||
|
||
|
||
def health_check(request): | ||
""" | ||
Health check for monitoring services. | ||
""" | ||
# Here you can perform additional checks like database, cache, etc. | ||
|
||
# Assuming start_time is recorded when the app starts | ||
uptime = time.time() - start_time | ||
status = { | ||
"status": "ok", | ||
"uptime": uptime, | ||
"response_time": 0, # You can calculate the response time here | ||
"apdex": 0, # You can add Apdex calculation here | ||
"last_check": time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(uptime)), | ||
} | ||
|
||
return JsonResponse(status) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters