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

feat: Add S3 Metrics Collection #12213

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

xin-zhang2
Copy link

@xin-zhang2 xin-zhang2 commented Jan 30, 2025

Add S3 file system metrics collection.

@facebook-github-bot
Copy link
Contributor

Hi @xin-zhang2!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

Copy link

netlify bot commented Jan 30, 2025

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit bc2b8a9
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/67afb5867fa81d00087d9416

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 30, 2025
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@majetideepak
Copy link
Collaborator

There is a related PR here #12200

@xin-zhang2 xin-zhang2 changed the title [WIP]feat: Implement S3 Metrics Collection and Reporting feat: Add S3 Metrics Collection Feb 13, 2025
@xin-zhang2 xin-zhang2 marked this pull request as ready for review February 13, 2025 14:06
Copy link
Collaborator

@majetideepak majetideepak left a comment

Choose a reason for hiding this comment

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

Some comments.

velox/connectors/hive/storage_adapters/s3fs/S3Counters.h Outdated Show resolved Hide resolved
velox/connectors/hive/storage_adapters/s3fs/S3Counters.h Outdated Show resolved Hide resolved
velox/connectors/hive/storage_adapters/s3fs/S3Counters.cpp Outdated Show resolved Hide resolved

namespace facebook::velox::filesystems {

void registerS3Metrics();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's add this to the public API registerS3FileSystem.h.
Prestissimo must call this similar to registerVeloxMetrics

Copy link
Author

Choose a reason for hiding this comment

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

ok. Will move it to RegisterS3FileSystem.

@@ -71,6 +73,8 @@ Aws::IOStreamFactory AwsWriteableStreamFactory(void* data, int64_t nbytes) {
return [=]() { return Aws::New<StringViewStream>("", data, nbytes); };
}

folly::once_flag s3MetricsFlag;
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove this since the client calls the registration.

Copy link
Author

Choose a reason for hiding this comment

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

ok. I'll move the registration to the client side, and it will introduce changes in the Presto repo.

"presto_cpp.hive.s3.list_status_calls"};
constexpr folly::StringPiece kCounterS3ListLocatedStatusCalls{
"presto_cpp.hive.s3.list_located_status_calls"};
constexpr folly::StringPiece kCounterS3ListObjectsCalls{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this used?

Copy link
Author

Choose a reason for hiding this comment

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

No. listStatusCalls, listLocatedStatusCalls and listObjectsCalls are not used because we don't call these APIs in Prestissimo. I keep them here just to make it consistent with the Presto Java. Do we need remove them?

RECORD_METRIC_VALUE(kCounterS3GetObjectErrors);
}
RECORD_METRIC_VALUE(kCounterS3GetObjectRetries, outcome.GetRetryCount());
RECORD_METRIC_VALUE(kCounterS3ActiveConnections, -1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

why -1 here?

Copy link
Author

Choose a reason for hiding this comment

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

It follows the rule in Presto Java (https://github.com/prestodb/presto/blob/master/presto-hive/src/main/java/com/facebook/presto/hive/s3/PrestoS3FileSystem.java#L1031).
The value of activeConnections is increased by 1 before the read operation and decreased by 1 after the read is finished.

@majetideepak
Copy link
Collaborator

We also need to add a test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants