From 4baa8dcca08f5d5f64e2be0a49245f463ca06f89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?yongyiduan=28=E6=AE=B5=E6=B0=B8=E5=84=84=29?= Date: Fri, 25 Oct 2024 11:33:21 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E6=B5=81=E6=B0=B4=E7=BA=BF/Job?= =?UTF-8?q?=E5=B9=B6=E5=8F=91=E5=92=8C=E6=8E=92=E9=98=9F=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=90=BD=E5=9C=B0=20#10997?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metrics/service/builds/MetricsUserService.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/backend/ci/core/metrics/biz-metrics/src/main/kotlin/com/tencent/devops/metrics/service/builds/MetricsUserService.kt b/src/backend/ci/core/metrics/biz-metrics/src/main/kotlin/com/tencent/devops/metrics/service/builds/MetricsUserService.kt index 6b1e5de6c65..20a2bfd62ab 100644 --- a/src/backend/ci/core/metrics/biz-metrics/src/main/kotlin/com/tencent/devops/metrics/service/builds/MetricsUserService.kt +++ b/src/backend/ci/core/metrics/biz-metrics/src/main/kotlin/com/tencent/devops/metrics/service/builds/MetricsUserService.kt @@ -331,6 +331,15 @@ class MetricsUserService @Autowired constructor( labels = labels ) local[key]?.meters?.add(buildGauge) + val buildStatusGauge = registerBuildStatusGauge( + projectId = projectId, + pipelineId = pipelineId, + buildId = buildId, + status = status, + description = "build status metrics for $buildId", + labels = labels + ) + local[key]?.meters?.add(buildStatusGauge) } CallBackEvent.BUILD_START -> { @@ -353,6 +362,7 @@ class MetricsUserService @Autowired constructor( ) local[key]?.meters?.add(buildStatusGauge) } + CallBackEvent.BUILD_JOB_QUEUE -> { val buildJobGauge = registerBuildJobQueueGauge( key = key, @@ -450,6 +460,9 @@ class MetricsUserService @Autowired constructor( metrics.meters.find { it.id.name == MetricsUserConfig.gaugeBuildQueueKey }?.run { metricsCacheService.removeCache(key) } + metrics.meters.find { it.id.name == MetricsUserConfig.gaugeBuildStatusKey }?.run { + metricsCacheService.removeCache(key) + } } CallBackEvent.BUILD_END -> {