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

Include repo url in committime #1146

Merged
merged 17 commits into from
Aug 22, 2024

Conversation

etsauer
Copy link
Collaborator

@etsauer etsauer commented Jul 25, 2024

Linked Issues

resolves #1089

Description

This change adds a new repo_url label to the committime metric across all providers. It ensures that when we capture a commit time, we also capture the source code repo URL for that commit. This will help us to show users where their metrics are coming from and help users validate the metrics we collect when there are questions about how we're getting our data.

Testing Instructions

Deploy the operator from the PR builds above.

Set up a pelorus instance with the following comittime exporter types:

      - enabled: true
        app_name: committime-image
        exporter_type: committime
        extraEnv:
        - name: PROVIDER
          value: containerimage
      - enabled: true
        app_name: committime-git
        exporter_type: committime
        extraEnv:
        - name: PROVIDER
          value: git

Generate data by running through the examples here: https://pelorus.readthedocs.io/en/v2.0.12/GettingStarted/configuration/ExporterCommittime/#example-workflow-for-an-openshift-binary-build

Check in Prometheus for commit_timestamp entries. You should now see metrics that look like this:

commit_timestamp{app="/pelorus-api/", commit="fefa7416e2c3ee424f53dbdbd46b7b758da4eb3d", container="committime-exporter", endpoint="http", exported_namespace="pelorus-api", image_sha="sha256:90f5978f8aa4303aacb4eb997a7e15371222515bc67300db1d5ab13b1296b335", instance="10.128.1.56:8080", job="committime-exporter", namespace="test-pelorus-operator", pod="committime-exporter-1-v2ktw", repo_url="https://github.com/etsauer/pelorus-api", service="committime-exporter"} | 1717780394
-- | --
commit_timestamp{app="/python-binary-build/", commit="7810f2a85d5c89cb4b17e9a3208a311af65338d8", container="committime-exporter-git", endpoint="http", exported_namespace="binary-build", image_sha="sha256:71a1f49ff412b13ef2d3e4663d890892ff99b66fe841679e26c2350ccd2bd5f5", instance="10.128.1.68:8080", job="committime-exporter-git", namespace="test-pelorus-operator", pod="committime-exporter-git-1-9jjhw", repo_url="http://github.com/dora-metrics/pelorus", service="committime-exporter-git"} | 1654810223

Copy link

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1146-70b9055 \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

@etsauer etsauer force-pushed the include-repo-url-in-committime branch from 0664f95 to cc4c8b2 Compare July 25, 2024 19:16
Copy link

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1146-485fc7d \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

Copy link

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1146-725ea16 \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

@etsauer etsauer force-pushed the include-repo-url-in-committime branch from cc4c8b2 to c228caf Compare July 25, 2024 20:07
Copy link

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1146-1d2923a \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

Copy link

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1146-28a55ca \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

Signed-off-by: Eric Sauer <[email protected]>
@etsauer etsauer force-pushed the include-repo-url-in-committime branch from e56f8c6 to be1d041 Compare July 25, 2024 20:25
Copy link

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1146-e97faa7 \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

Copy link

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1146-6a5d769 \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

@etsauer
Copy link
Collaborator Author

etsauer commented Jul 26, 2024

@mpryc @weshayutin @mateusoliveira43 @KevinMGranger thinking about this a bit more... I think what would be more useful than just the repo url would be the direct link to the commit (e.g. 7810f2a). This information looks to be provided in the api response we get back from the git providers already, so it would be easy to extract. The question is, where do "store" it. Do we add a new field to CommitMetric for a "commit_link"? do we overload "repo_url" in some way? Thoughts?

@etsauer
Copy link
Collaborator Author

etsauer commented Jul 26, 2024

I started going down this path today, and hit a little snag. https://github.com/dora-metrics/pelorus/blob/master/exporters/committime/collector_base.py#L396-L398

It looks as if today, we ONLY cache the commit_timestamp rather than the entire metric. As a result, on exporter start, we get the correct metric the first time, as it is not yet cached, and calls out to github, but on scrape, the metric appears cached, but information is missing.

Are we open to changing this?

Copy link

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1146-191508d \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

Copy link

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1146-cf4b321 \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

Copy link

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1146-f46e9f5 \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

Copy link

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1146-e4cb97e \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

Copy link

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1146-a771a3a \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

Signed-off-by: Eric Sauer <[email protected]>
Copy link

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1146-408eaaf \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

Copy link

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1146-78186c3 \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

@etsauer etsauer force-pushed the include-repo-url-in-committime branch from 5cb5045 to 3d34813 Compare August 16, 2024 13:49
Copy link

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1146-ab3a6a8 \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

Copy link

openshift-ci bot commented Aug 16, 2024

@etsauer: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/4.13-e2e-openshift 3d34813 link true /test 4.13-e2e-openshift

Full PR test history. Your PR dashboard.

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-sigs/prow repository. I understand the commands that are listed here.

@cgruver cgruver requested review from cgruver and removed request for mateusoliveira43 August 22, 2024 13:00
@cgruver
Copy link
Collaborator

cgruver commented Aug 22, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 22, 2024
@cgruver
Copy link
Collaborator

cgruver commented Aug 22, 2024

/approve

@cgruver
Copy link
Collaborator

cgruver commented Aug 22, 2024

/lgtm

@cgruver
Copy link
Collaborator

cgruver commented Aug 22, 2024

/approve

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 22, 2024
Copy link

openshift-ci bot commented Aug 22, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cgruver

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

@etsauer etsauer merged commit 6adacea into dora-metrics:master Aug 22, 2024
24 of 25 checks passed
@etsauer etsauer deleted the include-repo-url-in-committime branch August 22, 2024 13:32
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. dco-signoff: yes lgtm Indicates that a PR is ready to be merged.
Projects
None yet
3 participants