From 8fee9f132144eaab6a467b06e67114767ae84336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?yongyiduan=28=E6=AE=B5=E6=B0=B8=E5=84=84=29?= Date: Tue, 10 Sep 2024 10:44:08 +0800 Subject: [PATCH] =?UTF-8?q?[stream]=20=E4=BC=98=E5=8C=96=E5=A4=A7=E4=BB=93?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E8=80=97=E6=97=B6=20#10861?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tencent/devops/stream/trigger/StreamYamlBaseBuild.kt | 4 +++- .../com/tencent/devops/stream/trigger/StreamYamlTrigger.kt | 5 ++++- .../exception/handler/StreamTriggerExceptionHandler.kt | 2 +- .../exception/handler/StreamTriggerExceptionHandlerUtil.kt | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/backend/ci/core/stream/biz-stream/src/main/kotlin/com/tencent/devops/stream/trigger/StreamYamlBaseBuild.kt b/src/backend/ci/core/stream/biz-stream/src/main/kotlin/com/tencent/devops/stream/trigger/StreamYamlBaseBuild.kt index e45219ab496..6c9b3c0f850 100644 --- a/src/backend/ci/core/stream/biz-stream/src/main/kotlin/com/tencent/devops/stream/trigger/StreamYamlBaseBuild.kt +++ b/src/backend/ci/core/stream/biz-stream/src/main/kotlin/com/tencent/devops/stream/trigger/StreamYamlBaseBuild.kt @@ -341,7 +341,7 @@ class StreamYamlBaseBuild @Autowired constructor( gitRequestEventDao.updateChangeYamlList(dslContext, action.data.context.requestEventId!!, forkMrYamlList) } - action.data.watcherStart("streamYamlBaseBuild.startBuild.StreamBuildLock") + action.data.watcherStart("streamYamlBaseBuild.startBuild.StreamBuildLock.locked") // 修改流水线并启动构建,需要加锁保证事务性 val buildLock = StreamBuildLock( redisOperation = redisOperation, @@ -351,6 +351,7 @@ class StreamYamlBaseBuild @Autowired constructor( var buildId = "" try { buildLock.lock() + action.data.watcherStart("streamYamlBaseBuild.startBuild.StreamBuildLock") logger.info( "StreamYamlBaseBuild|startBuild|start|gitProjectId|${action.data.getGitProjectId()}|" + "pipelineId|${pipeline.pipelineId}|gitBuildId|$gitBuildId" @@ -434,6 +435,7 @@ class StreamYamlBaseBuild @Autowired constructor( ignore: Throwable, yamlTransferData: YamlTransferData? ) { + action.data.watcherStart("streamYamlBaseBuild.errorStartBuild") logger.warn( "StreamYamlBaseBuild|errorStartBuild|${action.data.getGitProjectId()}|" + "${pipeline.pipelineId}|$gitBuildId", diff --git a/src/backend/ci/core/stream/biz-stream/src/main/kotlin/com/tencent/devops/stream/trigger/StreamYamlTrigger.kt b/src/backend/ci/core/stream/biz-stream/src/main/kotlin/com/tencent/devops/stream/trigger/StreamYamlTrigger.kt index 4ca35b79585..deebfd40373 100644 --- a/src/backend/ci/core/stream/biz-stream/src/main/kotlin/com/tencent/devops/stream/trigger/StreamYamlTrigger.kt +++ b/src/backend/ci/core/stream/biz-stream/src/main/kotlin/com/tencent/devops/stream/trigger/StreamYamlTrigger.kt @@ -194,7 +194,7 @@ class StreamYamlTrigger @Autowired constructor( action: BaseAction, triggerEvent: Pair?, TriggerResult>? ): Boolean { - action.data.watcherStart("streamYamlTrigger.triggerBuild") + action.data.watcherStart("streamYamlTrigger.triggerBuild.start") logger.info( "StreamYamlTrigger|triggerBuild|requestEventId" + "|${action.data.context.requestEventId}|action|${action.format()}" @@ -253,6 +253,7 @@ class StreamYamlTrigger @Autowired constructor( )!! action.data.setting = action.data.setting.copy(gitHttpUrl = gitProjectInfo.gitHttpUrl) + action.data.watcherStart("streamYamlTrigger.triggerBuild.isMatch") // 前面使用缓存触发器判断过得就不用再判断了 // 同时使用缓存触发成功的肯定不用在重复注册各类事件了 val tr = if (triggerEvent?.second != null) { @@ -427,6 +428,7 @@ class StreamYamlTrigger @Autowired constructor( fun prepareCIBuildYaml( action: BaseAction ): YamlReplaceResult? { + action.data.watcherStart("streamYamlTrigger.prepareCIBuildYaml") logger.info( "StreamYamlTrigger|prepareCIBuildYaml" + "|requestEventId|${action.data.context.requestEventId}|action|${action.format()}" @@ -493,6 +495,7 @@ class StreamYamlTrigger @Autowired constructor( concurrency = concurrency ) } + action.data.watcherStart("streamYamlTrigger.prepareCIBuildYaml.end") return YamlReplaceResult( preYaml = newPreYamlObject, normalYaml = normalYaml, diff --git a/src/backend/ci/core/stream/biz-stream/src/main/kotlin/com/tencent/devops/stream/trigger/exception/handler/StreamTriggerExceptionHandler.kt b/src/backend/ci/core/stream/biz-stream/src/main/kotlin/com/tencent/devops/stream/trigger/exception/handler/StreamTriggerExceptionHandler.kt index 239407b7122..eb2ba5fa112 100644 --- a/src/backend/ci/core/stream/biz-stream/src/main/kotlin/com/tencent/devops/stream/trigger/exception/handler/StreamTriggerExceptionHandler.kt +++ b/src/backend/ci/core/stream/biz-stream/src/main/kotlin/com/tencent/devops/stream/trigger/exception/handler/StreamTriggerExceptionHandler.kt @@ -88,7 +88,7 @@ class StreamTriggerExceptionHandler @Autowired constructor( } finally { if (action.data.isWatcherInitialized) { action.data.watcher.stop() - LogUtils.printCostTimeWE(action.data.watcher, warnThreshold = 1000, errorThreshold = 5000) + LogUtils.printCostTimeWE(action.data.watcher, warnThreshold = 5000, errorThreshold = 10000) } } } diff --git a/src/backend/ci/core/stream/biz-stream/src/main/kotlin/com/tencent/devops/stream/trigger/exception/handler/StreamTriggerExceptionHandlerUtil.kt b/src/backend/ci/core/stream/biz-stream/src/main/kotlin/com/tencent/devops/stream/trigger/exception/handler/StreamTriggerExceptionHandlerUtil.kt index 1a5e8454426..4242671aedf 100644 --- a/src/backend/ci/core/stream/biz-stream/src/main/kotlin/com/tencent/devops/stream/trigger/exception/handler/StreamTriggerExceptionHandlerUtil.kt +++ b/src/backend/ci/core/stream/biz-stream/src/main/kotlin/com/tencent/devops/stream/trigger/exception/handler/StreamTriggerExceptionHandlerUtil.kt @@ -89,7 +89,7 @@ object StreamTriggerExceptionHandlerUtil { } finally { if (action.data.isWatcherInitialized) { action.data.watcher.stop() - LogUtils.printCostTimeWE(action.data.watcher, warnThreshold = 1000, errorThreshold = 5000) + LogUtils.printCostTimeWE(action.data.watcher, warnThreshold = 5000, errorThreshold = 10000) } } }