mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-14 06:15:45 +00:00
Bug Fix for process_start_time_metric initialization
This commit is contained in:
parent
09f4baed35
commit
edf9e03660
@ -44,13 +44,13 @@ func RegisterProcessStartTime(registrationFunc func(Registerable) error) error {
|
|||||||
start = float64(time.Now().Unix())
|
start = float64(time.Now().Unix())
|
||||||
}
|
}
|
||||||
// processStartTime is a lazy metric which only get initialized after registered.
|
// processStartTime is a lazy metric which only get initialized after registered.
|
||||||
// so we have to explicitly create it before setting the label value. Otherwise
|
// so we need to register the metric first and then set the value for it
|
||||||
// it is a noop.
|
if err = registrationFunc(processStartTime); err != nil {
|
||||||
if !processStartTime.IsCreated() {
|
return err
|
||||||
processStartTime.initializeMetric()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processStartTime.WithLabelValues().Set(start)
|
processStartTime.WithLabelValues().Set(start)
|
||||||
return registrationFunc(processStartTime)
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getProcessStart() (float64, error) {
|
func getProcessStart() (float64, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user