Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tasktime to workloadInstance TaskStatuses
Browse files Browse the repository at this point in the history
Signed-off-by: odubajDT <ondrej.dubaj@dynatrace.com>
odubajDT committed Oct 5, 2022

Verified

This commit was signed with the committer’s verified signature.
thaJeztah Sebastiaan van Stijn
1 parent f2c101b commit 0ac082b
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions operator/controllers/keptnworkloadinstance/controller.go
Original file line number Diff line number Diff line change
@@ -238,14 +238,14 @@ func (r *KeptnWorkloadInstanceReconciler) createKeptnTask(ctx context.Context, n
r.Recorder.Event(workloadInstance, "Normal", "KeptnTaskCreated", fmt.Sprintf("Created KeptnTask / Namespace: %s, Name: %s ", newTask.Namespace, newTask.Name))

// metrics: increment task counter
attrs := []attribute.KeyValue{
attribute.Key("KeptnApp").String(newTask.Spec.AppName),
attribute.Key("KeptnWorkload").String(newTask.Spec.Workload),
attribute.Key("KeptnVersion").String(newTask.Spec.WorkloadVersion),
attribute.Key("TaskName").String(newTask.Name),
attribute.Key("Type").String(string(newTask.Spec.Type)),
}
r.Meters.TaskCount.Add(ctx, 1, attrs...)
// attrs := []attribute.KeyValue{
// attribute.Key("KeptnApp").String(newTask.Spec.AppName),
// attribute.Key("KeptnWorkload").String(newTask.Spec.Workload),
// attribute.Key("KeptnVersion").String(newTask.Spec.WorkloadVersion),
// attribute.Key("TaskName").String(newTask.Name),
// attribute.Key("Type").String(string(newTask.Spec.Type)),
// }
// r.Meters.TaskCount.Add(ctx, 1, attrs...)

return newTask.Name, nil
}
@@ -289,9 +289,13 @@ func (r *KeptnWorkloadInstanceReconciler) reconcileChecks(ctx context.Context, c
return nil, summary, err
}
taskStatus.TaskName = taskName
taskStatus.SetStartTime()
} else {
// Update state of Task if it is already created
taskStatus.Status = task.Status.Status
if taskStatus.Status.IsCompleted() {
taskStatus.SetEndTime()
}
}
// Update state of the Check
newStatus = append(newStatus, taskStatus)

0 comments on commit 0ac082b

Please sign in to comment.