Skip to content

Commit

Permalink
[chore][aws] Reduce logging level error->warning (#1904)
Browse files Browse the repository at this point in the history
  • Loading branch information
aquamatthias committed Feb 6, 2024
1 parent 624af19 commit ec4849a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions plugins/aws/resoto_plugin_aws/__init__.py
Expand Up @@ -81,7 +81,7 @@ def collect(self) -> None:
if self.core_feedback:
self.core_feedback.error(f"Unhandled exception in AWS Plugin: {ex}", log)
else:
log.error(f"No CoreFeedback available! Unhandled exception in AWS Plugin: {ex}")
log.warning(f"No CoreFeedback available! Unhandled exception in AWS Plugin: {ex}")
raise

def collect_aws(self) -> None:
Expand All @@ -91,7 +91,7 @@ def collect_aws(self) -> None:

accounts = get_accounts(self.core_feedback.with_context(self.root.id))
if len(accounts) == 0:
log.error("No accounts found")
log.warning("No accounts found")
return

progress = ProgressTree(self.cloud)
Expand Down Expand Up @@ -262,12 +262,12 @@ def pre_cleanup(config: Config, resource: BaseResource, graph: Graph) -> bool:
graph = resource._graph

if resource.protected:
log.error(f"Resource {resource.rtdname} is protected - refusing modification")
log.warning(f"Resource {resource.rtdname} is protected - refusing modification")
resource.log("Modification was requested even though resource is protected" " - refusing")
return False

if resource.phantom:
log.error(f"Can't cleanup phantom resource {resource.rtdname}")
log.warning(f"Can't cleanup phantom resource {resource.rtdname}")
return False

if resource.cleaned:
Expand All @@ -277,7 +277,7 @@ def pre_cleanup(config: Config, resource: BaseResource, graph: Graph) -> bool:
account = resource.account(graph)
region = resource.region(graph)
if not isinstance(account, BaseAccount) or not isinstance(region, BaseRegion):
log.error(f"Could not determine account or region for pre cleanup of {resource.rtdname}")
log.warning(f"Could not determine account or region for pre cleanup of {resource.rtdname}")
return False

log_suffix = f" in account {account.dname} region {region.name}"
Expand All @@ -286,13 +286,13 @@ def pre_cleanup(config: Config, resource: BaseResource, graph: Graph) -> bool:
try:
if not getattr(resource, "pre_delete_resource")(client, graph):
resource.log("Failed to run pre clean up")
log.error(f"Failed to run pre clean up {resource.rtdname}{log_suffix}")
log.warning(f"Failed to run pre clean up {resource.rtdname}{log_suffix}")
return False
resource.log("Successfully ran pre clean up")
log.info(f"Successfully ran pre clean up {resource.rtdname}{log_suffix}")
except Exception as e:
resource.log("An error occurred during pre clean up", exception=e)
log.exception(f"An error occurred during pre clean up {resource.rtdname}{log_suffix}")
log.warning(f"An error occurred during pre clean up {resource.rtdname}{log_suffix}")
cloud = resource.cloud(graph)
metrics_resource_pre_cleanup_exceptions.labels(
cloud=cloud.name,
Expand All @@ -316,7 +316,7 @@ def cleanup(config: Config, resource: BaseResource, graph: Graph) -> bool:
return True

if resource.protected:
log.error(f"Resource {resource.rtdname} is protected - refusing modification")
log.warning(f"Resource {resource.rtdname} is protected - refusing modification")
resource.log(("Modification was requested even though resource is protected" " - refusing"))
return False

Expand Down
4 changes: 2 additions & 2 deletions plugins/aws/resoto_plugin_aws/aws_client.py
Expand Up @@ -185,7 +185,7 @@ def with_resource(self, aws_service: str, fn: Callable[[Any], T]) -> Optional[T]
log.debug(f"The Aws endpoint does not exist in this region. Skipping. {e}")
return None
except Exception as e:
log.error(f"[Aws] called service={aws_service} with resource: hit unexpected error: {e}")
log.warning(f"[Aws] called service={aws_service} with resource: hit unexpected error: {e}")
raise

def call_single(
Expand Down Expand Up @@ -258,7 +258,7 @@ def get_with_retry(
log.debug(f"The Aws endpoint does not exist in this region. Skipping. {e}")
return None
except Exception as e:
log.error(f"[Aws] called service={aws_service} action={action}: hit unexpected error: {e}", exc_info=e)
log.warning(f"[Aws] called service={aws_service} action={action}: hit unexpected error: {e}", exc_info=e)
if self.config.discard_account_on_resource_error:
raise
return None
Expand Down
2 changes: 1 addition & 1 deletion plugins/aws/resoto_plugin_aws/collector.py
Expand Up @@ -233,7 +233,7 @@ def get_last_run() -> Optional[datetime]:
global_builder.add_edge(self.account, EdgeType.default, node=node)
node.connect_in_graph(global_builder, data.get("source", {}))
else:
log.error(f"Unexpected node type {node} in graph")
log.warning(f"Unexpected node type {node} in graph")
raise Exception("Only AWS resources expected")

# wait for all futures to finish
Expand Down

0 comments on commit ec4849a

Please sign in to comment.