groups: - name: django rules: - alert: DjangoMigrationsUnapplied annotations: dashboard_url: https://grafana.com/d/django-overview-jkwq/django-overview?var-namespace={{ $labels.namespace }}&var-job={{ $labels.job }} description: The job {{ $labels.job }} has unapplied migrations. summary: Django has unapplied migrations. expr: | sum( django_migrations_unapplied_total{ job=~"django" } ) by (namespace, job) > 0 for: 15m labels: severity: warning - alert: DjangoDatabaseException annotations: dashboard_url: https://grafana.com/d/django-overview-jkwq/django-overview?var-namespace={{ $labels.namespace }}&var-job={{ $labels.job }} description: The job {{ $labels.job }} has hit the database exception {{ $labels.type }}. summary: Django database exception. expr: | sum ( increase( django_db_errors_total{ job=~"django" }[10m] ) ) by (type, namespace, job) > 0 labels: severity: info - alert: DjangoHighHttp4xxErrorRate annotations: dashboard_url: https://grafana.com/d/django-requests-by-view-jkwq/django-requests-by-view?var-namespace={{ $labels.namespace }}&var-job={{ $labels.job }}&var-view={{ $labels.view }} description: More than 5% HTTP requests with status 4xx for {{ $labels.job }}/{{ $labels.view }} the past 5m. summary: Django high HTTP 4xx error rate. expr: | sum( rate( django_http_responses_total_by_status_view_method_total{ job=~"django", status=~"^4.*", view!~"|health_check:health_check_home|prometheus-django-metrics" }[5m] ) ) by (namespace, job, view) / sum( rate( django_http_responses_total_by_status_view_method_total{ job=~"django", view!~"|health_check:health_check_home|prometheus-django-metrics" }[5m] ) ) by (namespace, job, view) * 100 > 5 for: 1m labels: severity: warning - alert: DjangoHighHttp5xxErrorRate annotations: dashboard_url: https://grafana.com/d/django-requests-by-view-jkwq/django-requests-by-view?var-namespace={{ $labels.namespace }}&var-job={{ $labels.job }}&var-view={{ $labels.view }} description: More than 5% HTTP requests with status 5xx for {{ $labels.job }}/{{ $labels.view }} the past 5m. summary: Django high HTTP 5xx error rate. expr: | sum( rate( django_http_responses_total_by_status_view_method_total{ job=~"django", status=~"^5.*", view!~"|health_check:health_check_home|prometheus-django-metrics" }[5m] ) ) by (namespace, job, view) / sum( rate( django_http_responses_total_by_status_view_method_total{ job=~"django", view!~"|health_check:health_check_home|prometheus-django-metrics" }[5m] ) ) by (namespace, job, view) * 100 > 5 for: 1m labels: severity: warning