Skip to content

Commit

Permalink
updated interfacte type handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathis Marcotte committed Aug 13, 2024
1 parent aae56a9 commit 7c76574
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,12 @@ func updateTimestampFromKernelsActivity(meta *metav1.ObjectMeta, kernels []Kerne
func updateTimestampFromMetrics(meta *metav1.ObjectMeta, metricsName string, metrics NotebookMetrics, threshold float64, log logr.Logger) {
// Metrics Data Result should always be only one value.
// Result Value should always be 2 values, first value is unix_time, second value is the result

if !(metrics.Data.Result[0].Value[1].(float64) > threshold) {
parseValue, err := strconv.ParseFloat(metrics.Data.Result[0].Value[1].(string), 64)
if err != nil {
log.Error(err, fmt.Sprintf("Error parsing the value from the %s metrics results", metricsName))
return
}
if !(parseValue > threshold) {
// if metrics don't pass the threshold, don't update the recent activity
log.Info(fmt.Sprintf("%s of %s doesn't exceed the threshold %s. Not updating the last-activity", metricsName, metrics.Data.Result[0].Value[1], threshold))
return
Expand Down

0 comments on commit 7c76574

Please sign in to comment.