Skip to content

Commit

Permalink
Improve error logging for Sentry errors reduction (#2553)
Browse files Browse the repository at this point in the history
Improve error logging for Sentry errors reduction

See commit messages.
I wanted to remove the TaskResults completely, but in the end I think it can be useful for testing.
Related to #2526
RELEASE NOTES BEGIN
N/A
RELEASE NOTES END

Reviewed-by: Matej Focko
  • Loading branch information
2 parents b58b3b7 + 11cdc02 commit eac0440
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packit_service/worker/allowlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def check_and_report(
return callback(event, project, job_configs)

msg = f"Failed to validate account: Unrecognized event type {type(event)!r}."
logger.error(msg)
logger.debug(msg)
raise PackitException(msg)

def get_approval_issue(self, namespace) -> Optional[str]:
Expand Down
5 changes: 0 additions & 5 deletions packit_service/worker/handlers/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,6 @@ def run_job(self):
job_results[result_key] = self.run_n_clean()
logger.debug("Job finished!")

for result in job_results.values():
if not (result and result["success"]):
if msg := result["details"].get("msg"):
logger.error(msg)

# push the metrics from job
self.pushgateway.push()

Expand Down
8 changes: 4 additions & 4 deletions packit_service/worker/helpers/build/babysit.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ def update_vm_image_build(build_id: int, build: "VMImageBuildTargetModel"):
status = body["image_status"]["status"]
except HTTPError as ex:
message = f"No response for VM Image Build {build_id}: {ex}"
logger.error(message)
logger.debug(message)
status = VMImageBuildStatus.error
except Exception as ex:
message = (
Expand All @@ -503,7 +503,7 @@ def update_vm_image_build(build_id: int, build: "VMImageBuildTargetModel"):
if status == VMImageBuildStatus.failure:
error = body["image_status"]["error"]
message = f"VM image build {build.build_id} failed: {error}"
logger.error(message)
logger.debug(message)

if status == VMImageBuildStatus.success:
message = get_message_for_successful_build(body["image_status"])
Expand All @@ -524,7 +524,7 @@ def update_vm_image_build(build_id: int, build: "VMImageBuildTargetModel"):
packages_config = event.get_packages_config()
if not packages_config:
build.set_status(status)
logger.error(
logger.debug(
f"No package config found for {build.build_id}. "
"No feedback can be given to the user."
)
Expand Down Expand Up @@ -555,7 +555,7 @@ def update_vm_image_build(build_id: int, build: "VMImageBuildTargetModel"):
return True

build.set_status(status)
logger.error(
logger.debug(
f"Something went wrong retrieving job configs for {build.build_id}. "
"No feedback can be given to the user."
)
Expand Down
6 changes: 3 additions & 3 deletions packit_service/worker/helpers/testing_farm.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ def distro2compose(self, target: str) -> Optional[str]:
f"The compose {compose} (from target {distro}) does not match any compose"
f" in the list of available composes:\n{composes}. "
)
logger.error(msg)
logger.debug(msg)
msg += (
"Please, check the targets defined in your test job configuration. If you think"
f" your configuration is correct, get in touch with [us]({CONTACTS_URL})."
Expand Down Expand Up @@ -762,7 +762,7 @@ def _is_supported_architecture(self, target: str):
f"The architecture {arch} is not in the list of "
f"available architectures:\n{supported_architectures}. "
)
logger.error(msg)
logger.debug(msg)
msg += (
"Please, check the targets defined in your test job configuration. If you think"
f" your configuration is correct, get in touch with [us]({CONTACTS_URL})."
Expand Down Expand Up @@ -841,7 +841,7 @@ def run_testing_farm(
# Leaving here just to be sure that we will discover this situation if it occurs.
# Currently not possible to trigger this situation.
msg = f"Target '{test_run.target}' not defined for tests but triggered."
logger.error(msg)
logger.debug(msg)
send_to_sentry(PackitConfigException(msg))
return TaskResults(
success=False,
Expand Down

0 comments on commit eac0440

Please sign in to comment.