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

Add Metrics for Running PipelinesRuns at Pipeline and Namespace level #8280

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pramodbindal
Copy link

@pramodbindal pramodbindal commented Sep 19, 2024

Changes

  • Currently metrics shown for Running Pipeline Count is at cluster level.
  • There is no way we can get that metric at namespace or pipeline level.
  • We have added the PipelineRun metric at pipeline and namespace level.
  • Level of PipelineRun Can be configured via ConfigMap. Default is "" . but it can be set to namespace or Pipelinerun.

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

@tekton-robot tekton-robot added the release-note-none Denotes a PR that doesnt merit a release note. label Sep 19, 2024
@tekton-robot
Copy link
Collaborator

Hi @pramodbindal. Thanks for your PR.

I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 19, 2024
Copy link
Contributor

@khrm khrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ok-to-test

@tekton-robot tekton-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 19, 2024
@khrm
Copy link
Contributor

khrm commented Sep 19, 2024

/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 19, 2024
@khrm
Copy link
Contributor

khrm commented Sep 19, 2024

/test check-pr-has-kind-label

@tekton-robot
Copy link
Collaborator

@khrm: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test pull-tekton-pipeline-alpha-integration-tests
  • /test pull-tekton-pipeline-beta-integration-tests
  • /test pull-tekton-pipeline-build-tests
  • /test pull-tekton-pipeline-integration-tests
  • /test pull-tekton-pipeline-unit-tests

The following commands are available to trigger optional jobs:

  • /test pull-tekton-pipeline-go-coverage

Use /test all to run all jobs.

In response to this:

/test check-pr-has-kind-label

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 83.7% -1.7

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 83.7% -1.7

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 83.7% -1.7

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 83.7% -1.7

@pramodbindal
Copy link
Author

/test pull-tekton-pipeline-build-tests
/test pull-tekton-pipeline-integration-tests

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pramodbindal can you squash your commits ? Otherwise LGTM.

@pramodbindal
Copy link
Author

@pramodbindal can you squash your commits ? Otherwise LGTM.

Done

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 83.7% -1.7

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 83.7% -1.7

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • We might want to add a release note entry
  • It seems it needs to be rebased ?

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 25, 2024
@pramodbindal
Copy link
Author

@pritidesai @abayer
This PR is Approved by @vdemeester .
Please provide /lgtm tag so I can merge this.

@pramodbindal pramodbindal force-pushed the SRVKP-6184 branch 2 times, most recently from 5c2ef54 to 4a05727 Compare September 26, 2024 11:01
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 83.7% -1.7

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 83.7% -1.7

@pramodbindal pramodbindal changed the title SRVKP-6184 - Adding running PR metrics Add Metrics for Running PipelinesRuns t Pipeline and Namespace level Sep 26, 2024
@pramodbindal pramodbindal changed the title Add Metrics for Running PipelinesRuns t Pipeline and Namespace level Add Metrics for Running PipelinesRuns at Pipeline and Namespace level Sep 26, 2024
@tekton-robot tekton-robot added this to the Pipeline v0.64 milestone Sep 26, 2024
Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR. I left some comments, we definitely need some docs about new metrics and I would like to understand if the change is backwards compatible.

pkg/pipelinerunmetrics/metrics_test.go Outdated Show resolved Hide resolved
config/config-observability.yaml Outdated Show resolved Hide resolved
pkg/apis/config/metrics.go Outdated Show resolved Hide resolved
Comment on lines 166 to 176
runningPRTag, err := getRunningPipelineRunTags(cfg)
if err != nil {
return err
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: It looks a bit strange to have some of the config processing logic directly in the viewRegister and some in a separate getRunningPipelineRunTags function.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Earlier logic is to get tags for PipelineRuns and new logic is to get RunningPipelineRun tags.

Now we have 2 options here.
extract older logic to new function just like we did it for running PRs or keep the new logic in view register only.
I will prefer former as that offers more clean code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the function is used in more than one place or if you write unit tests for it I see how it helps, otherwise I think we don't need a separate function

Comment on lines 483 to 496
case config.PipelinerunLevelAtPipelinerun:
tags = []tag.Key{pipelinerunTag, pipelineTag, namespaceTag}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I read this right this counts how many PipelineRuns are running for a certain PipelineRun, i.e. 0 or 1?
I'm not sure I understand the value of this metric, it would be completely non-aggregated - is the intention to use this to build a graph of which pipeline is running at a certain point in time?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aggregation is being done in RunningPipelineRuns function.
intention is get count of running PRs in current time only. There is no intention of getting the historical data on the same.

pkg/pipelinerunmetrics/metrics.go Show resolved Hide resolved
@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 27, 2024
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 82.7% -2.7

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 82.7% -2.7

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 82.5% -2.9

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 82.5% -2.9

@pramodbindal
Copy link
Author

/retest

1 similar comment
@pramodbindal
Copy link
Author

/retest

@pramodbindal pramodbindal force-pushed the SRVKP-6184 branch 2 times, most recently from aa38559 to b0679b0 Compare September 27, 2024 10:39
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 82.5% -2.9

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 82.5% -2.9

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 82.5% -2.9

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 82.5% -2.9

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 82.5% -2.9

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 82.5% -2.9

Currently metrices shown for Running Pipeline Count is at cluster level. There is no way we can get that metric at namespace or pipeline level.
We have enhanced the running pipelinerun metric at pipelinerun, pipeline and namespace level (Can be configured via ConfigMap, Default behaviour is same as earlier).
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 81.8% -3.6

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 81.8% -3.6

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/metrics.go 76.2% 78.3% 2.1
pkg/pipelinerunmetrics/metrics.go 85.4% 81.8% -3.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesnt merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants