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

feat: [AAP-33453] - Collect the stats data of jobs which launched by the EDA #1102

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

Conversation

hsong-rh
Copy link
Contributor

https://issues.redhat.com/browse/AAP-33453

The job stats data is collected and saved in the file jobs_stats.json. It looks like:

{
  "8018": [
    {
      "job_id": "8018",
      "type": "run_job_template",
      "created_at": "2023-12-14T15:19:02.319506Z",
      "status": "successful",
      "url": "https://controller_1/#/jobs/playbook/8018/details/",
      "install_uuid": "9509fade-acf8-4ff8-b5d1-6e58e01dceb9"
    },
    {
      "job_id": "8018",
      "type": "run_workflow_template",
      "created_at": "2023-12-14T15:19:02.326503Z",
      "status": "successful",
      "url": "https://controller_2/#/jobs/workflow/8018/details/",
      "install_uuid": "6e78176d-87ba-4837-9316-bf84660ca77d"
    }
  ],
  "8020": [
    {
      "job_id": "8020",
      "type": "run_workflow_template",
      "created_at": "2023-12-14T15:19:02.327547Z",
      "status": "successful",
      "url": "https://controller_1/#/jobs/workflow/8020/details/",
      "install_uuid": "9509fade-acf8-4ff8-b5d1-6e58e01dceb9"
    }
  ]
}

@hsong-rh hsong-rh requested a review from a team as a code owner October 15, 2024 21:06
controller_info["install_uuid"] = resp_json["install_uuid"]

info[host] = controller_info
except requests.exceptions.RequestException as e:
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we certain an invalid credential is the only cause for RequestException?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We catch all kinds of exceptions raised by request based on its doc
All exceptions that Requests explicitly raises inherit from requests.exceptions.RequestException

src/aap_eda/analytics/utils.py Outdated Show resolved Hide resolved
return stats

for action in audit_actions.all():
job_type, job_id, install_uuid = extract_job_details(action.url)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can action.url be empty? If the action is not a controller job, it does not have an url.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the action.url can only be an empty string in its model definition, which is handled properly.

Copy link

sonarcloud bot commented Oct 16, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants