chore: refactor shutdown config, to prevent setting zero values (#4533)

Signed-off-by: kevin <wanjunfeng@gmail.com>
This commit is contained in:
Kevin Wan
2025-01-01 20:46:51 +08:00
committed by GitHub
parent 22a41cacc7
commit 28a001c5f9
3 changed files with 83 additions and 23 deletions

View File

@@ -37,7 +37,7 @@ type (
Prometheus prometheus.Config `json:",optional"`
Telemetry trace.Config `json:",optional"`
DevServer DevServerConfig `json:",optional"`
Proc proc.ProcConf `json:",optional"`
Shutdown proc.ShutdownConf `json:",optional"`
}
)
@@ -62,7 +62,7 @@ func (sc ServiceConf) SetUp() error {
sc.Telemetry.Name = sc.Name
}
trace.StartAgent(sc.Telemetry)
proc.Setup(sc.Proc)
proc.Setup(sc.Shutdown)
proc.AddShutdownListener(func() {
trace.StopAgent()
})