The django_migrations_unapplied_total metric is not resetting the values even after migrations are completed, causing the alert never to go off. (unless the app is restarted)
Ran the migrate command on a different process:
pdm run manage.py migrate
Rechecked the metrics at /metrics endpoint. Observed no update in the metrics.
Restarted the server:
pdm run manage.py runserver
Observed the updated metrics at /metrics endpoint:
The django_migrations_unapplied_total metric is not resetting the values even after migrations are completed, causing the alert never to go off. (unless the app is restarted)
Also, the founder of Prometheus node-exporter raised the same issue here: https://github.com/korfuri/django-prometheus/issues/405
Reproduce: Rolled back some migrations using:
pdm run manage.py migrate auth 0005
Then, I started the server:
pdm run manage.py runserver
Observed the metrics at /metrics endpoint:
Ran the migrate command on a different process:
pdm run manage.py migrate
Rechecked the metrics at /metrics endpoint. Observed no update in the metrics.Restarted the server:
pdm run manage.py runserver
Observed the updated metrics at /metrics endpoint:
Related ticket: https://reeftechnologies.atlassian.net/jira/software/c/projects/NICE/boards/41?selectedIssue=NICE-325