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

Fix github label trace #776

Merged
merged 1 commit into from
Jan 17, 2023
Merged

Fix github label trace #776

merged 1 commit into from
Jan 17, 2023

Conversation

weshayutin
Copy link
Contributor

Signed-off-by: Wesley Hayutin weshayutin@gmail.com

Describe the behavior changes introduced in this PR

#775

resolves #775

Testing Instructions

label a github issue w/o an "="

@redhat-cop/mdt

Signed-off-by: Wesley Hayutin <weshayutin@gmail.com>
@weshayutin
Copy link
Contributor Author

Seems to work to prevent the trace and the pod crashing..

reproduce w/o fix:

(.venv) [whayutin@thinkdoe pelorus]$ python exporters/failure/app.py 
Running failure exporter. No version information found.
Initializing Logger with LogLevel: INFO
01-16-2023 13:11:41 INFO     Loading FailureCollectorConfig, inputs below:
01-16-2023 13:11:41 INFO     tracker_provider='github', from env var PROVIDER
01-16-2023 13:11:41 INFO     Loading GithubFailureCollector, inputs below:
01-16-2023 13:11:41 INFO     app_label='production_issue/name', from env var APP_LABEL
01-16-2023 13:11:41 INFO     token=REDACTED, from env var TOKEN
01-16-2023 13:11:41 INFO     tracker_api='api.github.com', default value; SERVER was not set
01-16-2023 13:11:41 INFO     projects='weshayutin/pelorus', from env var PROJECTS
01-16-2023 13:11:41 INFO     tls_verify=True, default value; TLS_VERIFY was not set
01-16-2023 13:11:41 INFO     issue_label='bug', from env var GITHUB_ISSUE_LABEL
01-16-2023 13:11:41 INFO     Getting issues from: weshayutin/pelorus
Traceback (most recent call last):
  File "/home/whayutin/OPENSHIFT/git/KONVEYOR/PELORUS/upstream/pelorus/exporters/failure/app.py", line 61, in <module>
    REGISTRY.register(collector)
  File "/home/whayutin/OPENSHIFT/git/KONVEYOR/PELORUS/upstream/pelorus/.venv/lib64/python3.11/site-packages/prometheus_client/registry.py", line 40, in register
    names = self._get_names(collector)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/whayutin/OPENSHIFT/git/KONVEYOR/PELORUS/upstream/pelorus/.venv/lib64/python3.11/site-packages/prometheus_client/registry.py", line 80, in _get_names
    for metric in desc_func():
  File "/home/whayutin/OPENSHIFT/git/KONVEYOR/PELORUS/upstream/pelorus/exporters/failure/collector_base.py", line 30, in collect
    critical_issues = self.search_issues()
                      ^^^^^^^^^^^^^^^^^^^^
  File "/home/whayutin/OPENSHIFT/git/KONVEYOR/PELORUS/upstream/pelorus/exporters/failure/collector_github.py", line 175, in search_issues
    self.get_app_name(issue, label),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/whayutin/OPENSHIFT/git/KONVEYOR/PELORUS/upstream/pelorus/exporters/failure/collector_github.py", line 183, in get_app_name
    return label["name"].split("=")[1]
           ~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

pull the change

(.venv) [whayutin@thinkdoe pelorus]$ gh pr checkout 776
branch 'github_issue_label' set up to track 'origin/github_issue_label'.
Switched to a new branch 'github_issue_label'

retest

(.venv) [whayutin@thinkdoe pelorus]$ python exporters/failure/app.py 
Running failure exporter. No version information found.
Initializing Logger with LogLevel: INFO
01-16-2023 13:11:54 INFO     Loading FailureCollectorConfig, inputs below:
01-16-2023 13:11:54 INFO     tracker_provider='github', from env var PROVIDER
01-16-2023 13:11:54 INFO     Loading GithubFailureCollector, inputs below:
01-16-2023 13:11:54 INFO     app_label='production_issue/name', from env var APP_LABEL
01-16-2023 13:11:54 INFO     token=REDACTED, from env var TOKEN
01-16-2023 13:11:54 INFO     tracker_api='api.github.com', default value; SERVER was not set
01-16-2023 13:11:54 INFO     projects='weshayutin/pelorus', from env var PROJECTS
01-16-2023 13:11:54 INFO     tls_verify=True, default value; TLS_VERIFY was not set
01-16-2023 13:11:54 INFO     issue_label='bug', from env var GITHUB_ISSUE_LABEL
01-16-2023 13:11:55 INFO     Getting issues from: weshayutin/pelorus
01-16-2023 13:11:55 INFO     Collected failure_creation_timestamp{ app=pelorus, issue_number=13 } 1673486435.0
01-16-2023 13:11:55 INFO     Collected failure_resolution_timestamp{ app=pelorus, issue_number=13 } 1673486460.0
01-16-2023 13:11:55 INFO     Collected failure_creation_timestamp{ app=pelorus, issue_number=12 } 1673477565.0
01-16-2023 13:11:55 INFO     Collected failure_creation_timestamp{ app=demoapp2, issue_number=11 } 1664387074.0
01-16-2023 13:11:55 INFO     Collected failure_resolution_timestamp{ app=demoapp2, issue_number=11 } 1664387297.0
(.venv) [whayutin@thinkdoe pelorus]$ python exporters/failure/app.py 
Running failure exporter. No version information found.
Initializing Logger with LogLevel: INFO
01-16-2023 13:13:07 INFO     Loading FailureCollectorConfig, inputs below:
01-16-2023 13:13:07 INFO     tracker_provider='github', from env var PROVIDER
01-16-2023 13:13:07 INFO     Loading GithubFailureCollector, inputs below:
01-16-2023 13:13:07 INFO     app_label='production_issue/name', from env var APP_LABEL
01-16-2023 13:13:07 INFO     token=REDACTED, from env var TOKEN
01-16-2023 13:13:07 INFO     tracker_api='api.github.com', default value; SERVER was not set
01-16-2023 13:13:07 INFO     projects='weshayutin/pelorus', from env var PROJECTS
01-16-2023 13:13:07 INFO     tls_verify=True, default value; TLS_VERIFY was not set
01-16-2023 13:13:07 INFO     issue_label='bug', from env var GITHUB_ISSUE_LABEL
01-16-2023 13:13:07 INFO     Getting issues from: weshayutin/pelorus
01-16-2023 13:13:08 INFO     Collected failure_creation_timestamp{ app=pelorus, issue_number=13 } 1673486435.0
01-16-2023 13:13:08 INFO     Collected failure_resolution_timestamp{ app=pelorus, issue_number=13 } 1673486460.0
01-16-2023 13:13:08 INFO     Collected failure_creation_timestamp{ app=pelorus, issue_number=12 } 1673477565.0

@weshayutin weshayutin changed the title DRAFT, DNM Fix github label trace Fix github label trace Jan 16, 2023
@weshayutin
Copy link
Contributor Author

/retest

@openshift-ci
Copy link

openshift-ci bot commented Jan 16, 2023

@weshayutin: 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.10-e2e-openshift 150cac5 link false /test 4.10-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/test-infra repository. I understand the commands that are listed here.

@openshift-ci
Copy link

openshift-ci bot commented Jan 17, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mateusoliveira43
Once this PR has been reviewed and has the lgtm label, please ask for approval from weshayutin by writing /assign @weshayutin in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@mpryc
Copy link
Collaborator

mpryc commented Jan 17, 2023

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 17, 2023
@mpryc mpryc merged commit c76bed4 into master Jan 17, 2023
@mpryc mpryc deleted the github_issue_label branch January 17, 2023 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

failure exporter crashes with malformed label
3 participants