diff --git a/.changeset/legal-loops-push.md b/.changeset/legal-loops-push.md new file mode 100644 index 0000000000..b21e1c146c --- /dev/null +++ b/.changeset/legal-loops-push.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder-backend': patch +--- + +Added `template` and `step` labels for scaffolder histogram metrics: `scaffolder_task_duration` and `scaffolder_step_duration` diff --git a/plugins/scaffolder-backend/src/scaffolder/tasks/NunjucksWorkflowRunner.ts b/plugins/scaffolder-backend/src/scaffolder/tasks/NunjucksWorkflowRunner.ts index c352714d9d..80e9517fd6 100644 --- a/plugins/scaffolder-backend/src/scaffolder/tasks/NunjucksWorkflowRunner.ts +++ b/plugins/scaffolder-backend/src/scaffolder/tasks/NunjucksWorkflowRunner.ts @@ -634,6 +634,7 @@ function scaffoldingTracker() { taskCount.add(1, { template, user, result: 'ok' }); taskDuration.record(endTime(), { + template, result: 'ok', }); } @@ -652,6 +653,7 @@ function scaffoldingTracker() { taskCount.add(1, { template, user, result: 'failed' }); taskDuration.record(endTime(), { + template, result: 'failed', }); } @@ -670,6 +672,7 @@ function scaffoldingTracker() { taskCount.add(1, { template, user, result: 'cancelled' }); taskDuration.record(endTime(), { + template, result: 'cancelled', }); } @@ -714,6 +717,8 @@ function scaffoldingTracker() { stepCount.add(1, { template, step: step.name, result: 'ok' }); stepDuration.record(endTime(), { + template, + step: step.name, result: 'ok', }); } @@ -728,6 +733,8 @@ function scaffoldingTracker() { stepCount.add(1, { template, step: step.name, result: 'cancelled' }); stepDuration.record(endTime(), { + template, + step: step.name, result: 'cancelled', }); } @@ -742,6 +749,8 @@ function scaffoldingTracker() { stepCount.add(1, { template, step: step.name, result: 'failed' }); stepDuration.record(endTime(), { + template, + step: step.name, result: 'failed', }); } @@ -755,6 +764,8 @@ function scaffoldingTracker() { stepCount.add(1, { template, step: step.name, result: 'skipped' }); stepDuration.record(endTime(), { + template, + step: step.name, result: 'skipped', }); }