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

724 bi collection improvments #770

Merged
merged 15 commits into from
Oct 6, 2020
Merged

Conversation

johnnyaug
Copy link
Contributor

No description provided.

@johnnyaug johnnyaug requested a review from ozkatz October 6, 2020 08:41
Copy link
Collaborator

@ozkatz ozkatz left a comment

Choose a reason for hiding this comment

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

Overall looks great, just worried about a single null dereference and log severity in a couple of places :)

InstallationID: s.getInstallationID(),
Entries: entries,
})
err := s.sender.UpdateMetadata(ctx, *accountMetadata)
Copy link
Collaborator

Choose a reason for hiding this comment

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

couldn't this lead to a null dereference if the account metadata is null? this can happen if reading the account id fails no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, if reading the account id fails, the cloudMetadataProvider.GetMetadata() returns nil, and then it will be ignored when creating the unified metadata object (serach for cloudMetadataProvider.GetMetadata())

func (m *MetadataProvider) GetMetadata() map[string]string {
projectID, err := metadata.NumericProjectID()
if err != nil {
m.logger.Errorf("%v: failed to get Google numeric project ID from instance metadata", err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should be a warning - it doesn't affect the health or correctness of lakeFS in any way (nor do we ever request explicit permissions to do this operation (also true for the AWS metadata provider))

Copy link
Collaborator

@ozkatz ozkatz left a comment

Choose a reason for hiding this comment

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

sorry for iterating on this again, had a few more comments 🤭

@@ -12,7 +12,7 @@ import (
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3iface"
"github.com/treeverse/lakefs/block"
inventorys3 "github.com/treeverse/lakefs/inventory/s3"
inventorys3 "github.com/treeverse/lakefs/cloud/aws/s3inventory"
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is the import named in reverse? what's wrong with s3inventory?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it was like this before and I didn't want to bloat the diff. But now that you've noticed it I must

m.logger.Warnf("%v: failed to get Google numeric project ID from instance metadata", err)
return nil
}
return map[string]string{"google_numeric_project_id": projectID}
Copy link
Collaborator

Choose a reason for hiding this comment

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

another thing that's missing (sorry for not catching this earlier) is one way hashing: we never want to send the actual account id, just to know that different installations come from the same one. I suggest hashing the received id here and in the aws provider as well.

in terms of metadata fields, i would seperate it into 2 fields: account_type ("aws", "gcp", etc) and "account_id" which is the hash. would make it easier downstream to consume.

Copy link
Collaborator

@ozkatz ozkatz left a comment

Choose a reason for hiding this comment

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

Nice work!

@johnnyaug johnnyaug merged commit ab0332a into master Oct 6, 2020
@johnnyaug johnnyaug deleted the 724_bi_collection_improvments branch October 6, 2020 13:03
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