Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mixin): Fix alert syntax #274

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions celery-mixin/alerts/alerts.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
},
annotations: {
summary: 'Celery high queue length.',
description: 'More than %(celeryHighQueueLengthThreshold)s tasks in the queue {{{ $labels.job }}/{ $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 @@ -83,7 +83,7 @@
annotations: {
summary: 'A Celery worker 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 }}',
dashboard_url: $._config.celeryTasksOverviewUrl + '?&var-job={{ $labels.job }}',
},
},
]),
Expand Down
4 changes: 2 additions & 2 deletions celery-mixin/prometheus-alerts.yaml
Original file line number Diff line number Diff line change
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.job }}/{ $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,7 @@
"severity": "warning"
- "alert": "CeleryWorkerDown"
"annotations":
"dashboard_url": "https://grafana.com/d/celery-tasks-overview-32s3/celery-tasks-overview?&var-job={{ $labels.job }}&var-queue_name={{ $labels.queue_name }}"
"dashboard_url": "https://grafana.com/d/celery-tasks-overview-32s3/celery-tasks-overview?&var-job={{ $labels.job }}"
"description": "The Celery worker {{ $labels.job }}/{{ $labels.hostname }} is offline."
"summary": "A Celery worker is offline."
"expr": |
Expand Down
28 changes: 15 additions & 13 deletions celery-mixin/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ tests:
- interval: 5m
input_series:
- series: 'celery_task_failed_total{job="celery-exporter", namespace="staging", queue_name="celery", name="test-task"}'
values: '1+10x10'
values: "1+10x10"
- series: 'celery_task_succeeded_total{job="celery-exporter", namespace="staging", queue_name="celery", name="test-task"}'
values: '1+10x10'
values: "1+10x10"
alert_rule_test:
- eval_time: 15m
alertname: CeleryTaskHighFailRate
Expand All @@ -21,15 +21,15 @@ tests:
queue_name: celery
name: test-task
exp_annotations:
summary: 'Celery high task fail rate.'
description: 'More than 5% tasks failed for the task celery/test-task the past 10m.'
dashboard_url: 'https://grafana.com/d/celery-tasks-by-task-32s3/celery-tasks-by-task?&var-queue_name=celery&var-task=test-task'
summary: "Celery high task fail rate."
description: "More than 5% tasks failed for the task celery-exporter/celery/test-task the past 10m."
dashboard_url: "https://grafana.com/d/celery-tasks-by-task-32s3/celery-tasks-by-task?var-job=celery-exporter&var-queue_name=celery&var-task=test-task"
- interval: 1m
input_series:
- series: 'celery_queue_length{job="celery-exporter", namespace="staging", queue_name="celery-low-queue"}'
values: '1+0x50'
values: "1+0x50"
- series: 'celery_queue_length{job="celery-exporter", namespace="staging", queue_name="celery-high-queue"}'
values: '1000+200x50'
values: "1000+200x50"
alert_rule_test:
- eval_time: 40m
alertname: CeleryHighQueueLength
Expand All @@ -40,14 +40,15 @@ tests:
namespace: staging
queue_name: celery-high-queue
exp_annotations:
summary: 'Celery high queue length.'
description: 'More than 100 tasks in the queue celery-high-queue the past 20m.'
summary: "Celery high queue length."
description: "More than 100 tasks in the queue celery-exporter/celery-high-queue the past 20m."
dashboard_url: https://grafana.com/d/celery-tasks-overview-32s3/celery-tasks-overview?&var-job=celery-exporter&var-queue_name=celery-high-queue
- interval: 1m
input_series:
- series: 'celery_worker_up{job="celery-exporter", namespace="staging", hostname="down"}'
values: '0+0x20'
values: "0+0x20"
- series: 'celery_worker_up{job="celery-exporter", namespace="staging", hostname="up"}'
values: '1+0x20'
values: "1+0x20"
alert_rule_test:
- eval_time: 20m
alertname: CeleryWorkerDown
Expand All @@ -58,5 +59,6 @@ tests:
namespace: staging
hostname: down
exp_annotations:
summary: 'A Celery worker is offline.'
description: 'The Celery worker down is offline.'
summary: "A Celery worker is offline."
description: "The Celery worker celery-exporter/down is offline."
dashboard_url: "https://grafana.com/d/celery-tasks-overview-32s3/celery-tasks-overview?&var-job=celery-exporter"
Loading