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

refactor: Stats metadata providers #8849

Merged
merged 14 commits into from
Mar 26, 2025
Merged

refactor: Stats metadata providers #8849

merged 14 commits into from
Mar 26, 2025

Conversation

nopcoder
Copy link
Contributor

@nopcoder nopcoder commented Mar 24, 2025

Cloud detect code was tested manually on different accounts.

Note that as long as we use AWS SDK, it will require environment where the SDK can be initialized to acquire the information.

Tested manually by building a binary that run cloud detect and used 3 cloud accounts that configured to run lakeFS to test it out.

Close #8850

@nopcoder nopcoder self-assigned this Mar 24, 2025
Copy link

github-actions bot commented Mar 24, 2025

E2E Test Results - DynamoDB Local - Local Block Adapter

14 passed

Copy link

github-actions bot commented Mar 24, 2025

E2E Test Results - Quickstart

12 passed

@nopcoder nopcoder added exclude-changelog PR description should not be included in next release changelog refactor Code refactoring that improves the code but does not affect functionality BI labels Mar 24, 2025
@nopcoder nopcoder requested a review from itaigilo March 24, 2025 13:07
@nopcoder nopcoder marked this pull request as ready for review March 24, 2025 13:29
@nopcoder nopcoder requested a review from guy-har March 24, 2025 13:29
Copy link
Contributor

@itaigilo itaigilo left a comment

Choose a reason for hiding this comment

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

Looking great -
Awesome initiative, thanks for handling this change.

Add some suggestions,
But the only reason that I'm blocking is because it's adelicate change in an important area, and I'd be happy to get some details about how was this tested.

And again, looks great.

const MetadataBlockstoreTypeKey = "blockstore_type"

// SingleTypeMetadataProvider is a metadata provider that reports a single blockstore type.
type SingleTypeMetadataProvider struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion, looking ahead at the MSB:
Create a BuildMetadataProvider(cfg config.StorageConfig) in modules/block/factory that will return this SingleTypeMetadataProvider, and have BuildMetadataProviders call this build function (instead of create the Provider instance directly).

It will save an extra PR later on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current code should handle both cases as it works with the configuration interface.
The "single" here is just to have a metadata provider for a single type - but used by multi storage.

let me know if I missed something.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, right. Missed the ids := cfg.GetStorageIDs() part, and was also confused by the name, I guess.
Maybe rename to BlockstoreTypeMetadataProvider, for example?

(But it's a matter of style and non-blocking.)

Copy link
Contributor

Choose a reason for hiding this comment

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

🔥

@nopcoder
Copy link
Contributor Author

Small refactor to the pkg/cloud to enable testing the detect execution.

@nopcoder nopcoder requested a review from itaigilo March 25, 2025 09:59
Copy link
Contributor

@guy-har guy-har left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +146 to +149
if id, err := detector(); err == nil {
cloudType, cloudID, cloudDetected = name, id, true
return
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're ignoring the err on purpose, maybe it's worth documenting.

Copy link
Contributor

@itaigilo itaigilo left a comment

Choose a reason for hiding this comment

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

LGTM 👍
This is great.

const MetadataBlockstoreTypeKey = "blockstore_type"

// SingleTypeMetadataProvider is a metadata provider that reports a single blockstore type.
type SingleTypeMetadataProvider struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, right. Missed the ids := cfg.GetStorageIDs() part, and was also confused by the name, I guess.
Maybe rename to BlockstoreTypeMetadataProvider, for example?

(But it's a matter of style and non-blocking.)

@nopcoder
Copy link
Contributor Author

@itaigilo @guy-har based on the last feedback updated the code and waiting for BI review before merging this change.

@nopcoder nopcoder changed the title Stats metadata providers refactor: Stats metadata providers Mar 26, 2025
@nopcoder
Copy link
Contributor Author

@NoyDavidson2 adding "blockstore_count" with the number of adapters configured, if more than 1

}

// BuildMetadataProviders returns metadata providers for each unique blockstore type in the storage config.
func BuildMetadataProviders(cfg config.StorageConfig) []*BlockstoreTypeMetadataProvider {
// NewMetadataProvider returns metadata provider to report blockstore type(s) based on storage config.
Copy link
Contributor

Choose a reason for hiding this comment

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

Add more information
We are returning the type with unique blockstore types
and the count of ids, because to identify we have many adapters, even they are from the same type

@nopcoder nopcoder enabled auto-merge (squash) March 26, 2025 13:53
@nopcoder nopcoder merged commit a4b8474 into master Mar 26, 2025
41 checks passed
@nopcoder nopcoder deleted the task/cloud-metadata branch March 26, 2025 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BI exclude-changelog PR description should not be included in next release changelog refactor Code refactoring that improves the code but does not affect functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BI refactor cloud and block as providers
3 participants