Skip to content

Commit 7fce148

Browse files
committed
ci: Add mixin ci
1 parent cf0bff8 commit 7fce148

File tree

7 files changed

+59
-1137
lines changed

7 files changed

+59
-1137
lines changed

.github/workflows/mixin.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: mixin
2+
permissions:
3+
contents: read
4+
on:
5+
push:
6+
branches:
7+
- master
8+
paths:
9+
- "celery-mixin/**"
10+
- ".github/workflows/mixin.yml"
11+
pull_request:
12+
paths:
13+
- "celery-mixin/**"
14+
- ".github/workflows/mixin.yml"
15+
16+
defaults:
17+
run:
18+
working-directory: ./celery-mixin
19+
jobs:
20+
matrix:
21+
runs-on: ubuntu-latest
22+
name: ${{ matrix.name }}
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
include:
27+
- name: Lint Alerts
28+
run: make --always-make alerts-lint
29+
- name: Generate yaml
30+
run: make --always-make generate && git diff --exit-code
31+
- name: Lint Grafana Dashboards
32+
run: make --always-make dashboards-lint
33+
- name: Format Jsonnet
34+
run: make --always-make jsonnet-fmt && git diff --exit-code
35+
- name: Lint Jsonnet
36+
run: make --always-make jsonnet-lint
37+
- name: Format Markdown
38+
run: make --always-make markdownfmt && git diff --exit-code
39+
- name: Lint Markdown
40+
run: make --always-make vale && git diff --exit-code
41+
- name: Lint YAML
42+
run: make --always-make pint-lint
43+
- name: Run unit tests
44+
run: make --always-make test
45+
46+
steps:
47+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
48+
with:
49+
persist-credentials: false
50+
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
51+
with:
52+
go-version-file: ./celery-mixin/scripts/go.mod
53+
cache-dependency-path: ./celery-mixin/scripts/go.sum
54+
- run: ${{ matrix.run }}
55+
name: Run ${{ matrix.name }}

celery-mixin/alerts/alerts.libsonnet

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
annotations: {
4444
summary: 'Celery high task fail rate.',
4545
description: 'More than %(celeryTaskFailedThreshold)s%% tasks failed for the task {{ $labels.job }}/{{ $labels.queue_name }}/{{ $labels.name }} the past %(celeryTaskFailedInterval)s.' % $._config,
46-
dashboard_url: $._config.celeryTasksByTaskUrl + '?var-job={{ $labels.job }}&var-queue_name={{ $labels.queue_name }}&var-task={{ $labels.name }}',
46+
dashboard_url: $._config.dashboardUrls['celery-tasks-by-task'] + '?var-job={{ $labels.job }}&var-queue_name={{ $labels.queue_name }}&var-task={{ $labels.name }}',
4747
},
4848
'for': '1m',
4949
labels: {
@@ -68,7 +68,7 @@
6868
annotations: {
6969
summary: 'Celery high queue length.',
7070
description: 'More than %(celeryHighQueueLengthThreshold)s tasks in the queue {{ $labels.job }}/{{ $labels.queue_name }} the past %(celeryHighQueueLengthInterval)s.' % $._config,
71-
dashboard_url: $._config.celeryTasksOverviewUrl + '?&var-job={{ $labels.job }}&var-queue_name={{ $labels.queue_name }}',
71+
dashboard_url: $._config.dashboardUrls['celery-tasks-overview'] + '?&var-job={{ $labels.job }}&var-queue_name={{ $labels.queue_name }}',
7272
},
7373
},
7474
if $._config.celeryWorkerDownAlertEnabled then {
@@ -83,7 +83,7 @@
8383
annotations: {
8484
summary: 'A Celery worker is offline.',
8585
description: 'The Celery worker {{ $labels.job }}/{{ $labels.hostname }} is offline.',
86-
dashboard_url: $._config.celeryTasksOverviewUrl + '?&var-job={{ $labels.job }}',
86+
dashboard_url: $._config.dashboardUrls['celery-tasks-overview'] + '?&var-job={{ $labels.job }}',
8787
},
8888
},
8989
]),

celery-mixin/config.libsonnet

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
local g = import 'github.com/grafana/grafonnet/gen/grafonnet-latest/main.libsonnet';
2-
local annotation = g.dashboard.annotation;
3-
41
{
52
_config+:: {
63
local this = self,
@@ -20,12 +17,6 @@ local annotation = g.dashboard.annotation;
2017
celeryIgnoredTasks: 'None',
2118
celeryIgnoredQueues: 'None',
2219

23-
celeryTasksOverviewUid: 'celery-tasks-overview-32s3',
24-
celeryTasksByTaskUid: 'celery-tasks-by-task-32s3',
25-
26-
celeryTasksOverviewUrl: '%s/d/%s/celery-tasks-overview' % [self.grafanaUrl, self.celeryTasksOverviewUid],
27-
celeryTasksByTaskUrl: '%s/d/%s/celery-tasks-by-task' % [self.grafanaUrl, self.celeryTasksByTaskUid],
28-
2920
// If you have autoscaling workers then you maybe do not want to alert on workers that are down.
3021
celeryWorkerDownAlertEnabled: true,
3122
celeryCeleryHighQueueLengthAlertEnabled: true,
@@ -55,15 +46,5 @@ local annotation = g.dashboard.annotation;
5546
iconColor: 'green',
5647
tags: [],
5748
},
58-
59-
customAnnotation:: if $._config.annotation.enabled then
60-
annotation.withName($._config.annotation.name) +
61-
annotation.withIconColor($._config.annotation.iconColor) +
62-
annotation.withHide(false) +
63-
annotation.datasource.withUid($._config.annotation.datasource) +
64-
annotation.target.withMatchAny(true) +
65-
annotation.target.withTags($._config.annotation.tags) +
66-
annotation.target.withType('tags')
67-
else {},
6849
},
6950
}

celery-mixin/dashboards_out/.lint

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)