-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
tekton_pipelines_controller_running_taskruns should only count TaskRuns whose Succeeded condition is Unknown, matching the behavior of the equivalent PipelineRun metric.
Actual Behavior
observeRunningTaskRuns uses !tr.IsDone() as the running predicate. Since IsDone() returns false when no Succeeded condition exists, newly created TaskRuns (before their first reconcile) are
incorrectly counted as running. This also creates an internal inconsistency: the throttle/task-resolution sub-metrics in the same loop are gated on succeedCondition != nil &&
succeedCondition.Status == corev1.ConditionUnknown, so a no-condition TaskRun increments runningTrs but none of the sub-metrics.
Root Cause
pkg/taskrunmetrics/metrics.go, observeRunningTaskRuns:
// Current (incorrect) — counts TaskRuns with no condition set
if !tr.IsDone() {
// Fix — aligns with pipelinerunmetrics; nil.IsUnknown() returns false
if tr.Status.GetCondition(apis.ConditionSucceeded).IsUnknown() {