Skip to content

Commit 6300cb9

Browse files
committed
feat(mixins): Used shared lib
1 parent b5cc1a2 commit 6300cb9

7 files changed

Lines changed: 128 additions & 286 deletions

File tree

celery-mixin/dashboards/celery-tasks-by-task.libsonnet

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
local mixinUtils = import 'github.com/adinhodovic/mixin-utils/utils.libsonnet';
12
local g = import 'github.com/grafana/grafonnet/gen/grafonnet-latest/main.libsonnet';
23
local dashboardUtil = import 'util.libsonnet';
34

@@ -122,7 +123,7 @@ local tbOverride = tbStandardOptions.override;
122123
local panels = {
123124

124125
taskExceptionsTable:
125-
dashboardUtil.tablePanel(
126+
mixinUtils.dashboards.tablePanel(
126127
'Task Exceptions',
127128
'short',
128129
queries.taskExceptions,
@@ -156,7 +157,7 @@ local tbOverride = tbStandardOptions.override;
156157
),
157158

158159
tasksStatsTable:
159-
dashboardUtil.tablePanel(
160+
mixinUtils.dashboards.tablePanel(
160161
'Task Stats',
161162
'short',
162163
[
@@ -237,7 +238,7 @@ local tbOverride = tbStandardOptions.override;
237238
tbStandardOptions.withNoValue(0),
238239

239240
tasksFailedByExceptionTimeSeries:
240-
dashboardUtil.timeSeriesPanel(
241+
mixinUtils.dashboards.timeSeriesPanel(
241242
'Task Exceptions',
242243
'short',
243244
queries.taskFailedByExceptionInterval,
@@ -247,7 +248,7 @@ local tbOverride = tbStandardOptions.override;
247248
),
248249

249250
tasksCompletedTimeSeries:
250-
dashboardUtil.timeSeriesPanel(
251+
mixinUtils.dashboards.timeSeriesPanel(
251252
'Tasks Completed',
252253
'short',
253254
[
@@ -285,7 +286,7 @@ local tbOverride = tbStandardOptions.override;
285286
),
286287

287288
tasksRuntimeTimeSeries:
288-
dashboardUtil.timeSeriesPanel(
289+
mixinUtils.dashboards.timeSeriesPanel(
289290
'Tasks Runtime',
290291
's',
291292
[
@@ -358,11 +359,9 @@ local tbOverride = tbStandardOptions.override;
358359
startY=18
359360
);
360361

361-
dashboardUtil.bypassDashboardValidation +
362+
mixinUtils.dashboards.bypassDashboardValidation +
362363
dashboard.new('Celery / Tasks / By Task') +
363-
dashboard.withDescription(
364-
'A dashboard to monitor Celery tasks grouped by task name. %s' % dashboardUtil.dashboardDescriptionLink
365-
) +
364+
dashboard.withDescription('A dashboard to monitor Celery tasks grouped by task name. %s' % mixinUtils.dashboards.dashboardDescriptionLink('celery-exporter', 'https://github.com/danihodovic/celery-exporter')) +
366365
dashboard.withUid($._config.dashboardIds[dashboardName]) +
367366
dashboard.withTags($._config.tags) +
368367
dashboard.withTimezone('utc') +
@@ -371,13 +370,13 @@ local tbOverride = tbStandardOptions.override;
371370
dashboard.time.withTo('now') +
372371
dashboard.withVariables(variables) +
373372
dashboard.withLinks(
374-
dashboardUtil.dashboardLinks($._config)
373+
mixinUtils.dashboards.dashboardLinks('Celery', $._config)
375374
) +
376375
dashboard.withPanels(
377376
rows
378377
) +
379378
dashboard.withAnnotations(
380-
dashboardUtil.annotations($._config, defaultFilters)
379+
mixinUtils.dashboards.annotations($._config, defaultFilters)
381380
),
382381
},
383382
}

celery-mixin/dashboards/celery-tasks-overview.libsonnet

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
local mixinUtils = import 'github.com/adinhodovic/mixin-utils/utils.libsonnet';
12
local g = import 'github.com/grafana/grafonnet/gen/grafonnet-latest/main.libsonnet';
23
local dashboardUtil = import 'util.libsonnet';
34

@@ -205,31 +206,31 @@ local tbOverride = tbStandardOptions.override;
205206
local panels = {
206207

207208
celeryWorkersStat:
208-
dashboardUtil.statPanel(
209+
mixinUtils.dashboards.statPanel(
209210
'Workers',
210211
'short',
211212
queries.celeryWorkers,
212213
description='Number of active Celery Workers',
213214
),
214215

215216
celeryWorkersActiveStat:
216-
dashboardUtil.statPanel(
217+
mixinUtils.dashboards.statPanel(
217218
'Workers Active Tasks',
218219
'short',
219220
queries.celeryWorkersActive,
220221
description='Number of active tasks across all workers',
221222
),
222223

223224
tasksReceivedByWorkers24hStat:
224-
dashboardUtil.statPanel(
225+
mixinUtils.dashboards.statPanel(
225226
'Tasks received by workers [1w]',
226227
'short',
227228
queries.tasksReceived1w,
228229
description='Number of tasks received by workers in the last week',
229230
),
230231

231232
taskSuccessRate1wStat:
232-
dashboardUtil.statPanel(
233+
mixinUtils.dashboards.statPanel(
233234
'Tasks Success Rate [1w]',
234235
'percentunit',
235236
queries.taskSuccessRate1w,
@@ -245,15 +246,15 @@ local tbOverride = tbStandardOptions.override;
245246
),
246247

247248
taskRuntime1wStat:
248-
dashboardUtil.statPanel(
249+
mixinUtils.dashboards.statPanel(
249250
'Average Runtime for Tasks [1w]',
250251
's',
251252
queries.taskRuntime1w,
252253
description='Average runtime for tasks in the last week',
253254
),
254255

255256
tasksFailed1wTable:
256-
dashboardUtil.tablePanel(
257+
mixinUtils.dashboards.tablePanel(
257258
'Top Failed Tasks [1w]',
258259
'short',
259260
queries.tasksFailed1w,
@@ -298,7 +299,7 @@ local tbOverride = tbStandardOptions.override;
298299
),
299300

300301
taskExceptions1wTable:
301-
dashboardUtil.tablePanel(
302+
mixinUtils.dashboards.tablePanel(
302303
'Top Task Exceptions [1w]',
303304
'short',
304305
queries.topTaskExceptions1w,
@@ -330,7 +331,7 @@ local tbOverride = tbStandardOptions.override;
330331
),
331332

332333
tasksRuntime1wTable:
333-
dashboardUtil.tablePanel(
334+
mixinUtils.dashboards.tablePanel(
334335
'Top Average Task Runtime [1w]',
335336
's',
336337
queries.topTaskRuntime1w,
@@ -375,7 +376,7 @@ local tbOverride = tbStandardOptions.override;
375376
),
376377

377378
celeryQueueLengthTimeSeries:
378-
dashboardUtil.timeSeriesPanel(
379+
mixinUtils.dashboards.timeSeriesPanel(
379380
'Queue Length',
380381
'short',
381382
queries.celeryQueueLength,
@@ -385,7 +386,7 @@ local tbOverride = tbStandardOptions.override;
385386
),
386387

387388
tasksStatsTable:
388-
dashboardUtil.tablePanel(
389+
mixinUtils.dashboards.tablePanel(
389390
'Task Stats',
390391
'short',
391392
[
@@ -466,7 +467,7 @@ local tbOverride = tbStandardOptions.override;
466467
tbStandardOptions.withNoValue(0),
467468

468469
tasksCompletedTimeSeries:
469-
dashboardUtil.timeSeriesPanel(
470+
mixinUtils.dashboards.timeSeriesPanel(
470471
'Tasks Completed',
471472
'short',
472473
[
@@ -504,7 +505,7 @@ local tbOverride = tbStandardOptions.override;
504505
),
505506

506507
tasksRuntimeTimeSeries:
507-
dashboardUtil.timeSeriesPanel(
508+
mixinUtils.dashboards.timeSeriesPanel(
508509
'Tasks Runtime',
509510
's',
510511
[
@@ -619,13 +620,11 @@ local tbOverride = tbStandardOptions.override;
619620
timeSeriesPanel.gridPos.withH(10),
620621
];
621622

622-
dashboardUtil.bypassDashboardValidation +
623+
mixinUtils.dashboards.bypassDashboardValidation +
623624
dashboard.new(
624625
'Celery / Tasks / Overview',
625626
) +
626-
dashboard.withDescription(
627-
'A dashboard that monitors Celery. %s' % dashboardUtil.dashboardDescriptionLink
628-
) +
627+
dashboard.withDescription('A dashboard that gives an overview of Celery. %s' % mixinUtils.dashboards.dashboardDescriptionLink('celery-exporter', 'https://github.com/danihodovic/celery-exporter')) +
629628
dashboard.withUid($._config.dashboardIds[dashboardName]) +
630629
dashboard.withTags($._config.tags) +
631630
dashboard.withTimezone('utc') +
@@ -634,13 +633,13 @@ local tbOverride = tbStandardOptions.override;
634633
dashboard.time.withTo('now') +
635634
dashboard.withVariables(variables) +
636635
dashboard.withLinks(
637-
dashboardUtil.dashboardLinks($._config)
636+
mixinUtils.dashboards.dashboardLinks('Celery', $._config)
638637
) +
639638
dashboard.withPanels(
640639
rows
641640
) +
642641
dashboard.withAnnotations(
643-
dashboardUtil.annotations($._config, defaultFilters)
642+
mixinUtils.dashboards.annotations($._config, defaultFilters)
644643
),
645644
},
646645
}

0 commit comments

Comments
 (0)