feat: 支持环境变量控制 Prometheus metrics
All checks were successful
itom-platform auto build image / build (push) Successful in 3m17s

This commit is contained in:
kim.dev.6789
2026-01-16 23:21:11 +08:00
parent 59aa8c4fce
commit e018f742ad
5 changed files with 73 additions and 0 deletions

View File

@@ -43,6 +43,7 @@ type API struct {
ListenIP string `mapstructure:"listenIP"`
Ports []int `mapstructure:"ports"`
} `mapstructure:"api"`
Prometheus Prometheus `mapstructure:"prometheus"` // 可选的 Prometheus 配置
}
type APIBot struct {
@@ -50,6 +51,7 @@ type APIBot struct {
ListenIP string `mapstructure:"listenIP"`
Ports []int `mapstructure:"ports"`
} `mapstructure:"api"`
Prometheus Prometheus `mapstructure:"prometheus"` // 可选的 Prometheus 配置
}
type Mongo struct {
@@ -104,6 +106,12 @@ type Discovery struct {
RpcService RpcService `mapstructure:"rpcService"`
}
// Prometheus 配置(可选,用于暴露 /metrics 端点)
type Prometheus struct {
Enable bool `mapstructure:"enable"` // 是否启用 Prometheus metrics默认 false
Path string `mapstructure:"path"` // metrics 路径,默认 /metrics
}
type Kubernetes struct {
Namespace string `mapstructure:"namespace"`
}