Skip to content

Commit

Permalink
fix: Add job to alert descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
adinhodovic committed Oct 19, 2023
1 parent c837bab commit 57512fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions celery-mixin/alerts/alerts.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
||| % $._config,
annotations: {
summary: 'Celery high task fail rate.',
description: 'More than %(celeryTaskFailedThreshold)s%% tasks failed for the task {{ $labels.queue_name }}/{{ $labels.name }} the past %(celeryTaskFailedInterval)s.' % $._config,
description: 'More than %(celeryTaskFailedThreshold)s%% tasks failed for the task {{ $labels.job }}/{{ $labels.queue_name }}/{{ $labels.name }} the past %(celeryTaskFailedInterval)s.' % $._config,
dashboard_url: $._config.celeryTasksByTaskUrl + '?var-job={{ $labels.job }}&var-queue_name={{ $labels.queue_name }}&var-task={{ $labels.name }}',
},
'for': '1m',
Expand All @@ -67,7 +67,7 @@
},
annotations: {
summary: 'Celery high queue length.',
description: 'More than %(celeryHighQueueLengthThreshold)s tasks in the queue {{ $labels.queue_name }} the past %(celeryHighQueueLengthInterval)s.' % $._config,
description: 'More than %(celeryHighQueueLengthThreshold)s tasks in the queue {{{ $labels.job }}/{ $labels.queue_name }} the past %(celeryHighQueueLengthInterval)s.' % $._config,
dashboard_url: $._config.celeryTasksOverviewUrl + '?&var-job={{ $labels.job }}&var-queue_name={{ $labels.queue_name }}',
},
},
Expand All @@ -82,7 +82,8 @@
},
annotations: {
summary: 'A Celery worker is offline.',
description: 'The Celery worker {{ $labels.hostname }} is offline.',
description: 'The Celery worker {{ $labels.job }}/{{ $labels.hostname }} is offline.',
dashboard_url: $._config.celeryTasksOverviewUrl + '?&var-job={{ $labels.job }}&var-queue_name={{ $labels.queue_name }}',
},
},
]),
Expand Down
7 changes: 4 additions & 3 deletions celery-mixin/prometheus-alerts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- "alert": "CeleryTaskHighFailRate"
"annotations":
"dashboard_url": "https://grafana.com/d/celery-tasks-by-task-32s3/celery-tasks-by-task?var-job={{ $labels.job }}&var-queue_name={{ $labels.queue_name }}&var-task={{ $labels.name }}"
"description": "More than 5% tasks failed for the task {{ $labels.queue_name }}/{{ $labels.name }} the past 10m."
"description": "More than 5% tasks failed for the task {{ $labels.job }}/{{ $labels.queue_name }}/{{ $labels.name }} the past 10m."
"summary": "Celery high task fail rate."
"expr": |
sum(
Expand Down Expand Up @@ -45,7 +45,7 @@
- "alert": "CeleryHighQueueLength"
"annotations":
"dashboard_url": "https://grafana.com/d/celery-tasks-overview-32s3/celery-tasks-overview?&var-job={{ $labels.job }}&var-queue_name={{ $labels.queue_name }}"
"description": "More than 100 tasks in the queue {{ $labels.queue_name }} the past 20m."
"description": "More than 100 tasks in the queue {{{ $labels.job }}/{ $labels.queue_name }} the past 20m."
"summary": "Celery high queue length."
"expr": |
sum(
Expand All @@ -60,7 +60,8 @@
"severity": "warning"
- "alert": "CeleryWorkerDown"
"annotations":
"description": "The Celery worker {{ $labels.hostname }} is offline."
"dashboard_url": "https://grafana.com/d/celery-tasks-overview-32s3/celery-tasks-overview?&var-job={{ $labels.job }}&var-queue_name={{ $labels.queue_name }}"
"description": "The Celery worker {{ $labels.job }}/{{ $labels.hostname }} is offline."
"summary": "A Celery worker is offline."
"expr": |
celery_worker_up{job=~"celery|celery-exporter"} == 0
Expand Down

0 comments on commit 57512fc

Please sign in to comment.