feat: expose effective runtime settings in metrics
This commit is contained in:
@@ -10,6 +10,26 @@ import (
|
||||
"git.yuntuo.hk/k2safe/orbit/internal/buildinfo"
|
||||
)
|
||||
|
||||
// RuntimeConfig 是节点启动后实际生效的后台控制参数。
|
||||
// 它只用于固定基数观测,不参与业务授权或持久化状态判断。
|
||||
type RuntimeConfig struct {
|
||||
WorkflowTickInterval time.Duration
|
||||
ScheduleTickInterval time.Duration
|
||||
RecoveryTickInterval time.Duration
|
||||
BatchLimit int
|
||||
}
|
||||
|
||||
// RecordRuntimeConfig records the effective bounded controller settings.
|
||||
func (r *Registry) RecordRuntimeConfig(config RuntimeConfig) {
|
||||
if r == nil || config.WorkflowTickInterval <= 0 || config.ScheduleTickInterval <= 0 || config.RecoveryTickInterval <= 0 || config.BatchLimit <= 0 {
|
||||
return
|
||||
}
|
||||
r.SetGauge("orbit_runtime_tick_interval_seconds", config.WorkflowTickInterval.Seconds(), Labels{"component": "workflow"})
|
||||
r.SetGauge("orbit_runtime_tick_interval_seconds", config.ScheduleTickInterval.Seconds(), Labels{"component": "schedule"})
|
||||
r.SetGauge("orbit_runtime_tick_interval_seconds", config.RecoveryTickInterval.Seconds(), Labels{"component": "execution_recovery"})
|
||||
r.SetGauge("orbit_runtime_batch_limit", float64(config.BatchLimit), nil)
|
||||
}
|
||||
|
||||
// initializeProcess is called once by the registry constructor.
|
||||
func (r *Registry) initializeProcess() {
|
||||
if r == nil {
|
||||
|
||||
Reference in New Issue
Block a user