Add metrics to Reaper (#2019)
* Add metrics to Reaper Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com> * Change duration to seconds and fix labels Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com>
This commit is contained in:
@@ -37,6 +37,22 @@ var (
|
||||
},
|
||||
[]string{"funcname", "funcuid"},
|
||||
)
|
||||
funcReapTime = prometheus.NewSummaryVec(
|
||||
prometheus.SummaryOpts{
|
||||
Name: "fission_pod_reaptime_seconds",
|
||||
Help: "Amount of seconds to reap a pod",
|
||||
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
|
||||
},
|
||||
[]string{"funcname", "funcaddress"},
|
||||
)
|
||||
idleTime = prometheus.NewSummaryVec(
|
||||
prometheus.SummaryOpts{
|
||||
Name: "fission_idle_pod_time",
|
||||
Help: "Number of seconds it took for Reaper to detect the pod was idle",
|
||||
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
|
||||
},
|
||||
[]string{"funcname", "funcaddress"},
|
||||
)
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -45,6 +61,8 @@ func init() {
|
||||
prometheus.MustRegister(funcRunningSummary)
|
||||
prometheus.MustRegister(funcAliveSummary)
|
||||
prometheus.MustRegister(funcIsAlive)
|
||||
prometheus.MustRegister(funcReapTime)
|
||||
prometheus.MustRegister(idleTime)
|
||||
}
|
||||
|
||||
// IncreaseColdStarts increments the counter by 1.
|
||||
@@ -67,3 +85,13 @@ func (fsc *FunctionServiceCache) setFuncAlive(funcname, funcuid string, isAlive
|
||||
}
|
||||
funcIsAlive.WithLabelValues(funcname, funcuid).Set(float64(count))
|
||||
}
|
||||
|
||||
// ReapTime is the amount of time taken to reap a pod
|
||||
func (fsc *FunctionServiceCache) ReapTime(funcName, funcAddress string, time float64) {
|
||||
funcReapTime.WithLabelValues(funcName, funcAddress).Observe(float64(time))
|
||||
}
|
||||
|
||||
// IdleTime is the amount of time it took Reaper to find out the pod was idle
|
||||
func (fsc *FunctionServiceCache) IdleTime(funcName, funcAddress string, time float64) {
|
||||
idleTime.WithLabelValues(funcName, funcAddress).Observe(time)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user