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

Log error when parsing GCP disk with non-JSON description #43

Merged
merged 4 commits into from
Jan 3, 2023

Conversation

inkel
Copy link
Collaborator

@inkel inkel commented Jan 3, 2023

As reported in #41 when trying to parse the Description field as JSON it was returning an error if it failed, blocking the programs to continue listing the unused disks. This PR pass down a logger (logfmt.Logger more specifically) and emits a log line instead of returning an error.

inkel added 3 commits January 3, 2023 14:58
This has been reported in #41.

Signed-off-by: Leandro López (inkel) <[email protected]>
Signed-off-by: Leandro López (inkel) <[email protected]>
@inkel inkel requested a review from Pokom January 3, 2023 18:24
@inkel inkel self-assigned this Jan 3, 2023
Copy link
Contributor

@Pokom Pokom left a comment

Choose a reason for hiding this comment

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

Looks good to me! The error message is pretty helpful as well:

./unused -gcp.project $(gcloud config get project)
ts=2023-01-03T20:03:28Z msg="cannot parse disk metadata" disk="cortex-prod-04-corrupt-wal-2022-10-09" err="cannot decode JSON description for disk cortex-prod-04-corrupt-wal-2022-10-09: invalid character 'S' looking for beginning of value" project="grafanalabs-global"

@inkel inkel merged commit 48ea6d6 into main Jan 3, 2023
@inkel inkel deleted the gcp/log-error-disk-parsing branch January 3, 2023 20:45
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.

2 participants