Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tekton_pipelines_controller_pipelinerun_count metric counter increases without having any pipeline executed #4397

Closed
gmeghnag opened this issue Nov 26, 2021 · 5 comments · Fixed by #4468
Assignees
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.

Comments

@gmeghnag
Copy link

Expected Behavior

To have the tekton_pipelines_controller_pipelinerun_count metric counter increased only when new pipelines are executed.

Actual Behavior

After a few hours the counter is increased without having any pipelines executed.

Steps to Reproduce the Problem on OpenShift

  1. Run at least one pipeline in the cluster
  2. Expose the metrics endpoint:
$ oc expose -n openshift-pipelines svc/tekton-pipelines-controller --port=9090 --path="/metrics"
  1. Check the counter value:
$ METRICS_ENDPOINT=$(oc get route tekton-pipelines-controller -n openshift-pipelines -o jsonpath="{.spec.host}")/metrics
$ curl -s -k $METRICS_ENDPOINT | grep -v "#" | grep tekton_pipelines_controller_pipelinerun_count
  1. Wait a few hours (4/5) without executing any pipelines, and after re-checking the counter value, you will see it increased

Additional Info

  • Kubernetes version:
Kubernetes Version: v1.20.0+9689d22
  • Tekton Pipeline version:
$ tkn version
Client version: 0.13.1
Pipeline version: v0.22.0
Triggers version: v0.12.1
@gmeghnag gmeghnag added the kind/bug Categorizes issue or PR as related to a bug. label Nov 26, 2021
@gmeghnag gmeghnag changed the title tekton_pipelines_controller_pipelinerun_count metric counter increases without having any pipeline executed tekton_pipelines_controller_pipelinerun_count metric counter increases without having any pipeline executed Nov 26, 2021
@guillaumerose
Copy link
Contributor

Yes I confirm this behaviour.

If I install Tekton with a resyncPeriod of the controller = 10 seconds, then when I create a single pipeline, every 10s, the counter tekton_pipelines_controller_pipelinerun_count{status="success"} is increased by 1.

Looking at the code, it shows also the duration histogram is incorrect. Older pipelines are counted many more times than younger pipelines.

The bug is by design and I think, the only way to remove it is to refactor the code to create this counter only using the lister and not using the controller loop.
If we use the controller loop, we need to use the beforeCondition/afterCondition check to find out if the pipeline was already counted or not. .. But it's not possible: if the controller restarts, we loose this information and the counter will start again at 0.

@dibyom dibyom added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Nov 29, 2021
@lbernick lbernick moved this to Todo in Pipelines V1 Jan 11, 2022
@khrm
Copy link
Contributor

khrm commented Jan 12, 2022

@wlynch I fixed this in a pr #4468.

@guillaumerose We generally use the rate function of Prometheus query to avoid instance restart related issues. Even with lister loop, information will be lost during restart because pipelinerun will be deleted by the end-user. So I think before and after condition check is sufficient to resolve this.

@lbernick lbernick moved this from Todo to In Progress in Pipelines V1 Feb 22, 2022
@tekton-robot
Copy link
Collaborator

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale with a justification.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 8, 2022
@lbernick
Copy link
Member

lbernick commented May 9, 2022

/remove-lifecycle stale

@tekton-robot tekton-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 9, 2022
Repository owner moved this from In Progress to Done in Pipelines V1 May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

7 participants