-
Notifications
You must be signed in to change notification settings - Fork 2
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
Yurii Purdenko
committed
Jul 25, 2024
1 parent
61d77ad
commit d909628
Showing
8 changed files
with
68 additions
and
9 deletions.
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
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,12 @@ | ||
from django.http import HttpResponse | ||
from prometheus_client import Counter, Gauge | ||
from prometheus_client import generate_latest, CONTENT_TYPE_LATEST | ||
|
||
USER_REGISTRATION_COUNT = Counter('django_user_registration_total', 'Total user registrations') | ||
USER_LOGIN_COUNT = Counter('django_user_login_total', 'Total user logins') | ||
CAMERA_REGISTRATION_COUNT = Counter('django_camera_registration_total', 'Total camera registrations') | ||
LAST_USER_LOGIN_TIME = Gauge('django_user_last_login_timestamp', 'Timestamp of the last user login') | ||
|
||
|
||
def custom_metrics(request): | ||
return HttpResponse(generate_latest(), content_type=CONTENT_TYPE_LATEST) |
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
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
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
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,8 @@ | ||
global: | ||
scrape_interval: 15s | ||
|
||
scrape_configs: | ||
- job_name: 'django' | ||
metrics_path: '/metrics' | ||
static_configs: | ||
- targets: ['bhtom:8000','upload-service:8000'] |
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
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