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

[BEAM-14465] Reduce DefaultS3ClientBuilderFactory logging to debug level #17645

Merged
merged 5 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,13 @@
import org.apache.beam.sdk.io.aws.options.S3ClientBuilderFactory;
import org.apache.beam.sdk.io.aws.options.S3Options;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Construct AmazonS3ClientBuilder with default values of S3 client properties like path style
* access, accelerated mode, etc.
*/
public class DefaultS3ClientBuilderFactory implements S3ClientBuilderFactory {

private static final Logger LOG = LoggerFactory.getLogger(DefaultS3ClientBuilderFactory.class);

@Override
public AmazonS3ClientBuilder createBuilder(S3Options s3Options) {
AmazonS3ClientBuilder builder =
Expand All @@ -49,10 +45,6 @@ public AmazonS3ClientBuilder createBuilder(S3Options s3Options) {
s3Options.getAwsServiceEndpoint(), s3Options.getAwsRegion()));
} else if (!Strings.isNullOrEmpty(s3Options.getAwsRegion())) {
builder = builder.withRegion(s3Options.getAwsRegion());
} else {
LOG.info(
"The AWS S3 Beam extension was included in this build, but the awsRegion flag "
+ "was not specified. If you don't plan to use S3, then ignore this message.");
}
return builder;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import org.apache.beam.sdk.io.aws2.options.S3ClientBuilderFactory;
import org.apache.beam.sdk.io.aws2.options.S3Options;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.annotations.VisibleForTesting;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.S3ClientBuilder;

Expand All @@ -32,20 +30,13 @@
*/
public class DefaultS3ClientBuilderFactory implements S3ClientBuilderFactory {

private static final Logger LOG = LoggerFactory.getLogger(DefaultS3ClientBuilderFactory.class);

@Override
public S3ClientBuilder createBuilder(S3Options s3Options) {
return createBuilder(S3Client.builder(), s3Options);
}

@VisibleForTesting
static S3ClientBuilder createBuilder(S3ClientBuilder builder, S3Options s3Options) {
if (s3Options.getAwsRegion() == null) {
LOG.info(
"The AWS S3 Beam extension was included in this build, but the awsRegion flag "
+ "was not specified. If you don't plan to use S3, then ignore this message.");
}
return ClientBuilderFactory.getFactory(s3Options).create(builder, s3Options);
}
}