Skip to content

Commit

Permalink
vdk-core: Improve ingestion error logging (#930)
Browse files Browse the repository at this point in the history
Currently, after ingestion completes, a user is presented
with the following message:
```
Successful uploads:1
Failed uploads:0
ingesting plugin errors:defaultdict(<class 'vdk.internal.builtin_plugins.ingestion.ingester_utils.AtomicCounter'>, {})
```

This is not ideal, as printing internal Python representations
in user logs might be misleading, as a user might believe
some error has occured when none did.

This change fixes this by printing `None` instead when no
errors occur, and printing the dictionary result instead of
the defaultdict representation when errors did occur.
```
Successful uploads: 1
Failed uploads: 0
Ingesting plugin errors: None
```

Testing done: tested locally

Signed-off-by: Gabriel Georgiev <gageorgiev@vmware.com>
  • Loading branch information
gageorgiev authored and duyguHsnHsn committed Aug 4, 2022
1 parent 7e10568 commit 27d9ae6
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -543,9 +543,9 @@ def close_now(self):

log.info(
"Ingester statistics: \n\t\t"
f"Successful uploads:{self._success_count}\n\t\t"
f"Failed uploads:{self._fail_count}\n\t\t"
f"ingesting plugin errors:{self._plugin_errors}\n\t\t"
f"Successful uploads: {self._success_count}\n\t\t"
f"Failed uploads: {self._fail_count}\n\t\t"
f"Ingesting plugin errors: {'None' if not self._plugin_errors else dict(self._plugin_errors)}\n\t\t"
)

def _pre_process_payload(
Expand Down

0 comments on commit 27d9ae6

Please sign in to comment.