mirror of
https://github.com/LamGC/ScalaBot.git
synced 2025-04-29 22:27:31 +00:00
refactor(metrics): 为指标增加 namespace 名称.
遵循 OpenMetrics 规范指南, 为运行指标添加 namespace 名称, 防止指标混乱. BREAKING CHANGE: 运行指标名称变更, 如果用户启用了运行指标功能, 请注意修改使用指标的名称.
This commit is contained in:
parent
6e5cd07c51
commit
c94e0476b5
@ -250,6 +250,7 @@ internal class LogDirectorySupplier : PropertyDefinerBase() {
|
||||
|
||||
internal object Const {
|
||||
val config = loadAppConfig()
|
||||
const val METRICS_NAMESPACE = "scalabot"
|
||||
}
|
||||
|
||||
private fun AppPaths.defaultInitializer() {
|
||||
|
@ -135,6 +135,7 @@ internal class ScalaBot(
|
||||
.name("updates_total")
|
||||
.help("Total number of updates received by all bots.")
|
||||
.labelNames("bot_name")
|
||||
.namespace(Const.METRICS_NAMESPACE)
|
||||
.subsystem("telegrambots")
|
||||
.register()
|
||||
|
||||
@ -143,6 +144,7 @@ internal class ScalaBot(
|
||||
.name("updates_in_progress")
|
||||
.help("Number of updates in process by all bots.")
|
||||
.labelNames("bot_name")
|
||||
.namespace(Const.METRICS_NAMESPACE)
|
||||
.subsystem("telegrambots")
|
||||
.register()
|
||||
|
||||
@ -150,6 +152,7 @@ internal class ScalaBot(
|
||||
private val onlineBotGauge = Gauge.build()
|
||||
.name("bots_online")
|
||||
.help("Number of bots Online.")
|
||||
.namespace(Const.METRICS_NAMESPACE)
|
||||
.subsystem("telegrambots")
|
||||
.register()
|
||||
|
||||
@ -162,6 +165,7 @@ internal class ScalaBot(
|
||||
"It is not recommended to use it as the accurate execution time of ability)"
|
||||
)
|
||||
.labelNames("bot_name")
|
||||
.namespace(Const.METRICS_NAMESPACE)
|
||||
.subsystem("telegrambots")
|
||||
.register()
|
||||
|
||||
@ -170,6 +174,7 @@ internal class ScalaBot(
|
||||
.name("updates_exception_handling")
|
||||
.help("Number of exceptions during processing.")
|
||||
.labelNames("bot_name")
|
||||
.namespace(Const.METRICS_NAMESPACE)
|
||||
.subsystem("telegrambots")
|
||||
.register()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user