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 count chains attestation for issue#1028 #1034

Merged
merged 2 commits into from
Jan 30, 2024

Conversation

sudhishmk
Copy link
Contributor

Changes -: Work In Progress

Submitter Checklist

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

  • Has Docs included if any changes are user facing
  • Has Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • 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 do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 18, 2024
Copy link

linux-foundation-easycla bot commented Jan 18, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@tekton-robot tekton-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 18, 2024
@tekton-robot
Copy link

Hi @sudhishmk. 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 removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 18, 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 Jan 18, 2024
@khrm
Copy link
Contributor

khrm commented Jan 18, 2024

@sudhishmk Please sign he cla.

@khrm
Copy link
Contributor

khrm commented Jan 18, 2024

You can call metrics counter here:

if err != nil {

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/pipelinerunmetrics/injection.go Do not exist 10.0%
pkg/pipelinerunmetrics/metrics.go Do not exist 0.0%
pkg/taskrunmetrics/injection.go Do not exist 10.0%
pkg/taskrunmetrics/metrics.go Do not exist 0.0%

@khrm
Copy link
Contributor

khrm commented Jan 18, 2024

Please import fake metrics like this:
_ "github.com/tektoncd/chains/pkg/pipelinerunmetrics/fake" // Make sure the pipelinerunmetrics are setup

This will ensure that unit tests are passed.

@khrm
Copy link
Contributor

khrm commented Jan 19, 2024

Add the above line in the import of following files:

  1. pkg/reconciler/pipelinerun/pipelinerun_test.go
  2. pkg/reconciler/taskrun/taskrun_test.go

@tekton-robot tekton-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 22, 2024
@sudhishmk sudhishmk force-pushed the chainmetrics-1028 branch 2 times, most recently from 4bce52b to c957c8d Compare January 23, 2024 08:40
pkg/taskrunmetrics/metrics.go Outdated Show resolved Hide resolved
pkg/chains/signing.go Outdated Show resolved Hide resolved
pkg/chains/signing.go Outdated Show resolved Hide resolved
pkg/taskrunmetrics/metrics.go Outdated Show resolved Hide resolved
pkg/taskrunmetrics/metrics.go Outdated Show resolved Hide resolved
@khrm
Copy link
Contributor

khrm commented Jan 25, 2024

/test pull-tekton-chains-integration-tests

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/chains/signing.go 73.7% 75.7% 1.9
pkg/pipelinerunmetrics/injection.go Do not exist 70.0%
pkg/pipelinerunmetrics/metrics.go Do not exist 55.2%
pkg/taskrunmetrics/injection.go Do not exist 70.0%
pkg/taskrunmetrics/metrics.go Do not exist 55.6%

Copy link
Contributor

@lcarva lcarva left a comment

Choose a reason for hiding this comment

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

Overall, this seems reasonable. My main concern here is the amount of log messages being produced when each metric is recorded.

I left various comments on the pipelinerunmetrics which also apply to the taskrunmetrics.

pkg/chains/constants.go Outdated Show resolved Hide resolved
pkg/chains/signing.go Outdated Show resolved Hide resolved
pkg/chains/signing.go Outdated Show resolved Hide resolved
pkg/chains/signing.go Outdated Show resolved Hide resolved
pkg/chains/signing.go Outdated Show resolved Hide resolved
pkg/pipelinerunmetrics/metrics.go Outdated Show resolved Hide resolved
pkg/pipelinerunmetrics/metrics.go Outdated Show resolved Hide resolved
pkg/pipelinerunmetrics/metrics.go Outdated Show resolved Hide resolved
pkg/pipelinerunmetrics/metrics.go Outdated Show resolved Hide resolved
pkg/pipelinerunmetrics/metrics.go Outdated Show resolved Hide resolved
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/chains/signing.go 73.7% 75.7% 1.9
pkg/pipelinerunmetrics/injection.go Do not exist 70.0%
pkg/pipelinerunmetrics/metrics.go Do not exist 84.0%
pkg/taskrunmetrics/injection.go Do not exist 70.0%
pkg/taskrunmetrics/metrics.go Do not exist 86.4%

@lcarva
Copy link
Contributor

lcarva commented Jan 26, 2024

@khrm, I see some comments have not yet been addressed. (GitHub collapsed some of them. You'll have to click on "Load more")

pkg/chains/signing.go Outdated Show resolved Hide resolved
pkg/chains/signing.go Outdated Show resolved Hide resolved
pkg/chains/signing.go Outdated Show resolved Hide resolved
pkg/chains/signing.go Outdated Show resolved Hide resolved
pkg/chains/signing.go Outdated Show resolved Hide resolved
pkg/pipelinerunmetrics/metrics.go Outdated Show resolved Hide resolved
pkg/pipelinerunmetrics/metrics.go Outdated Show resolved Hide resolved
@khrm
Copy link
Contributor

khrm commented Jan 26, 2024

It was Holiday in India today. That's why @sudhishmk didn't get time I think.

Sudhish, please address them.

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/chains/signing.go 73.7% 75.2% 1.5
pkg/pipelinerunmetrics/injection.go Do not exist 70.0%
pkg/pipelinerunmetrics/metrics.go Do not exist 84.0%
pkg/taskrunmetrics/injection.go Do not exist 70.0%
pkg/taskrunmetrics/metrics.go Do not exist 86.4%

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/chains/signing.go 73.7% 74.3% 0.5
pkg/pipelinerunmetrics/injection.go Do not exist 70.0%
pkg/pipelinerunmetrics/metrics.go Do not exist 84.0%
pkg/taskrunmetrics/injection.go Do not exist 70.0%
pkg/taskrunmetrics/metrics.go Do not exist 86.4%

pkg/pipelinerunmetrics/metrics.go Outdated Show resolved Hide resolved
pkg/pipelinerunmetrics/metrics.go Show resolved Hide resolved
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/chains/signing.go 73.7% 74.3% 0.5
pkg/pipelinerunmetrics/injection.go Do not exist 70.0%
pkg/pipelinerunmetrics/metrics.go Do not exist 84.6%
pkg/taskrunmetrics/injection.go Do not exist 70.0%
pkg/taskrunmetrics/metrics.go Do not exist 84.0%

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lcarva

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 Jan 30, 2024
@lcarva
Copy link
Contributor

lcarva commented Jan 30, 2024

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 30, 2024
@tekton-robot tekton-robot merged commit d5a5659 into tektoncd:main Jan 30, 2024
17 checks passed
@savitaashture
Copy link

Hi @sudhishmk 👋

Is it possible to update metrics doc https://github.com/tektoncd/chains/blob/main/docs/metrics.md so that we will have all the details of the metrics which chains support today
I reviewed PR yesterday but forgot to add comments

@sudhishmk
Copy link
Contributor Author

Hi @sudhishmk 👋

Is it possible to update metrics doc https://github.com/tektoncd/chains/blob/main/docs/metrics.md so that we will have all the details of the metrics which chains support today I reviewed PR yesterday but forgot to add comments

Sure, will do that.

@sudhishmk
Copy link
Contributor Author

Hi @sudhishmk 👋

Is it possible to update metrics doc https://github.com/tektoncd/chains/blob/main/docs/metrics.md so that we will have all the details of the metrics which chains support today I reviewed PR yesterday but forgot to add comments

Created PR for docs.

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. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants