Skip to content

Metric tekton_pipelines_controller_running_pipelineruns includes non-running PipelineRuns #8949

@aThorp96

Description

@aThorp96

Expected Behavior

The metric tekton_pipelines_controller_running_pipelineruns reports the number of Pipelines which are in a Running state

Actual Behavior

The metric tekton_pipelines_controller_running_pipelineruns reports the number of Pipelines which have a Succeeded status of Unknown. This includes those in a Pending state and therefore not running

Steps to Reproduce the Problem

  1. Connect to a k8s cluster with Tekton installed and no PipelineRuns
  2. Observe the metric tekton_pipelines_controller_running_pipelineruns is 0 by port-forwarding with kubectl port-forward -n tekton-pipelines services/tekton-pipelines-controller 9090:9090 and fetching the metric with curl localhost:9090/metrics -s | grep '^tekton_pipelines_controller_running_pipelineruns \d+'
  3. Create the following PipelineRun:
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
  name: pipelinerun-is-pending
spec:
  status: "PipelineRunPending"
  pipelineSpec:
    tasks:
      - name: echo-good-morning
        taskSpec:
          metadata:
            labels:
              app: "example"
          steps:
            - name: echo
              image: mirror.gcr.io/ubuntu
              script: |
                #!/usr/bin/env bash
                echo "Good Morning!"
  1. Observe the PipelineRun is not running
  2. Observe the metric tekton_pipelines_controller_running_pipelineruns reports 1

Additional Info

  • Kubernetes version:

    Output of kubectl version:

 $ kubectl version
Client Version: v1.32.0
Kustomize Version: v5.5.0
Server Version: v1.32.0
  • Tekton Pipeline version:

    Output of tkn version or kubectl get pods -n tekton-pipelines -l app=tekton-pipelines-controller -o=jsonpath='{.items[0].metadata.labels.version}'

$ tkn version
Client version: 0.41.0
Pipeline version: v1.3.0
Triggers version: v0.32.0
Dashboard version: v0.59.0

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions