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

RDISCROWD-7993: Add logs. file load duration. crud activity #1047

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dchhabda
Copy link

@dchhabda dchhabda commented Feb 22, 2025

  • Added logs to create, update and delete operations
  • Added logs to record time it take to load file from storage and perform decryption(if any)
  • Example of logs that would be generated with this PR

File load duration

pybossa:INFO:[2025-02-23 04:22:40,860] Calling CustomConnectionV2 [in /home/pybossa/pybossa/pybossa/cloud_store_api/connection.py:54]
pybossa:INFO:[2025-02-23 04:22:41,609] get_content_and_key_from_s3. Load file contents gigwork-eng-bcos-dev//9/task_data1.txt duration 0.748837 seconds [in /home/pybossa/pybossa/pybossa/cloud_store_api/s3.py:208]
pybossa:INFO:[2025-02-23 04:22:41,609] get_content_and_key_from_s3. file gigwork-eng-bcos-dev//9/task_data1.txt decryption duration 0.000269 seconds [in /home/pybossa/pybossa/pybossa/cloud_store_api/s3.py:216]

Project API operation logs

pybossa:INFO:[2025-02-24 18:43:30,012] Created Project id 16, name testprojdeep, short_name testprojdeep, owner_id 1 [in /home/pybossa/pybossa/pybossa/api/api_base.py:656]
pybossa:INFO:[2025-02-24 18:35:25,306] Updated Project id 8, name testprojdeep, short_name testprojdeep, owner_id 1 [in /home/pybossa/pybossa/pybossa/api/api_base.py:656]
pybossa:INFO:[2025-02-24 18:37:30,393] Deleted Project id 8 [in /home/pybossa/pybossa/pybossa/api/api_base.py:647]

Task API operation logs

pybossa:INFO:[2025-02-24 18:44:33,847] Created Task id 781, project_id 16 [in /home/pybossa/pybossa/pybossa/api/api_base.py:656]
pybossa:INFO:[2025-02-24 18:11:04,473] Updated Task id 774, project_id 13 [in /home/pybossa/pybossa/pybossa/api/api_base.py:654]
pybossa:INFO:[2025-02-24 18:44:57,711] Deleted Task id 781 [in /home/pybossa/pybossa/pybossa/api/api_base.py:647]

@coveralls
Copy link

coveralls commented Feb 22, 2025

Pull Request Test Coverage Report for Build 13505550820

Details

  • 28 of 29 (96.55%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.008%) to 94.164%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pybossa/cloud_store_api/s3.py 9 10 90.0%
Files with Coverage Reduction New Missed Lines %
pybossa/cloud_store_api/s3.py 1 94.16%
Totals Coverage Status
Change from base Build 13437683915: 0.008%
Covered Lines: 17619
Relevant Lines: 18711

💛 - Coveralls

@dchhabda dchhabda changed the title No Jira: Add logs. file load duration. crud activity RDISCROWD-7993: Add logs. file load duration. crud activity Feb 24, 2025
@dchhabda dchhabda requested a review from n00rsy February 24, 2025 19:22
Copy link

@n00rsy n00rsy left a comment

Choose a reason for hiding this comment

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

lgtm!

log_info += [f"short_name {info['short_name']}"] if "short_name" in info else []
log_info += [f"owner_id {info['owner_id']}"] if "owner_id" in info else []
log_info += [f"project_id {info['project_id']}"] if "project_id" in info else []
current_app.logger.info("%s%s", messsage, ", ".join(log_info))
Copy link

Choose a reason for hiding this comment

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

potential refactor for improved style (same functionality)

log_info = [f"{key} {info[key]}" for key in ["id", "name", "short_name", "owner_id", "project_id"] if key in info]
current_app.logger.info("%s %s", message, ", ".join(log_info))

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

Successfully merging this pull request may close these issues.

3 participants