Skip to content

Conversation

@rafaelwestphal
Copy link
Contributor

Description

Removing the result from metadata query from being added to health-checks.log

Related issue

b/279212943

How has this been tested?

Checklist:

  • Unit tests
    • Unit tests do not apply.
    • Unit tests have been added/modified and passed for this PR.
  • Integration tests
    • Integration tests do not apply.
    • Integration tests have been added/modified and passed for this PR.
  • Documentation
    • This PR introduces no user visible changes.
    • This PR introduces user visible changes and the corresponding documentation change has been made.
  • Minor version bump
    • This PR introduces no new features.
    • This PR introduces new features, and there is a separate PR to bump the minor version since the last release already.
    • This PR bumps the version.

@rafaelwestphal rafaelwestphal changed the title Removing exposure of metadata query result Removing logging of metadata query result May 1, 2023
ctx := context.Background()
gceMetadata, err := getGCEMetadata()
if err != nil {
return fmt.Errorf("can't get GCE metadata: %w", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

After thinking this after a couple of days. I think removing the err here is a good idea. We already have a Network Check that queries the metadata server and the error here might (in a super rare case) could expose PII details (e.g. can't find attribute x). The API Check responsibility is not to verify the metadata server.

Just leaving (or improving a little) the message should be enough.

fmt.Errorf("can't get GCE metadata`)

Synced with @LujieDuan about this before. CC if he has more opinions about this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SGTM

@rafaelwestphal rafaelwestphal requested a review from LujieDuan May 1, 2023 18:40
@rafaelwestphal rafaelwestphal marked this pull request as ready for review May 1, 2023 18:46
Copy link
Contributor

@franciscovalentecastro franciscovalentecastro left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@LujieDuan LujieDuan left a comment

Choose a reason for hiding this comment

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

LGTM!

Nit: (no need to change in this PR): those two places seem to have the exact same code now - later maybe we can extract this to RunCheck() to get the gceMetadata once and share that instance between the logging and monitoring checks.

@rafaelwestphal rafaelwestphal merged commit ae5b102 into master May 1, 2023
rafaelwestphal added a commit that referenced this pull request May 2, 2023
* Removing exposure of metadata query result

* Also removing print on error path
@igorpeshansky igorpeshansky deleted the westphalrafael-dont-print-metadata branch July 10, 2023 22:26
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.

4 participants