forked from TencentBlueKing/bk-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
44881c5
commit d6d2bbf
Showing
5 changed files
with
59 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...ess/biz-base/src/main/kotlin/com/tencent/devops/process/actuate/ProcessHealthIndicator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.tencent.devops.process.actuate | ||
|
||
import com.tencent.devops.process.dao.PipelineFavorDao | ||
import org.jooq.DSLContext | ||
import org.slf4j.LoggerFactory | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.boot.actuate.health.AbstractHealthIndicator | ||
import org.springframework.boot.actuate.health.Health | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class ProcessHealthIndicator @Autowired constructor( | ||
private val pipelineFavorDao: PipelineFavorDao, | ||
private val dslContext: DSLContext | ||
) : AbstractHealthIndicator() { | ||
@SuppressWarnings("SwallowedException", "TooGenericExceptionCaught") | ||
override fun doHealthCheck(builder: Health.Builder) { | ||
try { | ||
val maxId = pipelineFavorDao.getMaxId(dslContext) | ||
builder.up().withDetail("MaxId", maxId) | ||
} catch (e: Exception) { | ||
logger.error("Get max id failed") | ||
builder.down() | ||
} | ||
} | ||
|
||
companion object { | ||
private val logger = LoggerFactory.getLogger(ProcessHealthIndicator::class.java) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters