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

fix: add nio entry to user-agent #774

Merged
merged 9 commits into from Dec 21, 2021
Merged

fix: add nio entry to user-agent #774

merged 9 commits into from Dec 21, 2021

Conversation

BenWhitehead
Copy link
Contributor

@BenWhitehead BenWhitehead commented Dec 13, 2021

No description provided.

@product-auto-label product-auto-label bot added the api: storage label Dec 13, 2021
@BenWhitehead BenWhitehead requested a review from frankyn Dec 13, 2021
private static class NioUserAgentEntryHeaderProvider extends FixedHeaderProvider {

private final ImmutableMap<String, String> userAgent =
ImmutableMap.of("user-agent", String.format("gcloud-java-nio/%s", VERSION));
Copy link
Member

@frankyn frankyn Dec 14, 2021

Choose a reason for hiding this comment

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

Does this prepend to the existing user-agent?

Copy link
Contributor Author

@BenWhitehead BenWhitehead Dec 15, 2021

Choose a reason for hiding this comment

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

It does. This is what it looks like in the logs (the version is missing because I ran it from my ide without the version file artifact

User-Agent: gcloud-java-nio/0.123.18-SNAPSHOT gcloud-java/2.2.1 Google-API-Java-Client/1.32.2 Google-HTTP-Java-Client/1.40.1 (gzip)

Copy link
Member

@frankyn frankyn left a comment

LGTM

@BenWhitehead BenWhitehead marked this pull request as ready for review Dec 15, 2021
@BenWhitehead BenWhitehead requested review from as code owners Dec 15, 2021
@BenWhitehead BenWhitehead added the kokoro:force-run label Dec 15, 2021
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run label Dec 15, 2021
Move version information and configuration of header into StorageOptionsUtil

Introduce StorageOptionsUtil which provides utilities and default instance access for StorageOptions which include our new user-agent entry.

To all tests which called com.google.cloud.storage.contrib.nio.CloudStorageFileSystemProvider.setStorageOptions in their @before, there is now a corresponding @after which sets the storageOptions back to defaults
@BenWhitehead BenWhitehead added kokoro:force-run owlbot:run labels Dec 21, 2021
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run label Dec 21, 2021
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run label Dec 21, 2021
@BenWhitehead BenWhitehead merged commit 2d30f78 into main Dec 21, 2021
18 checks passed
@BenWhitehead BenWhitehead deleted the user-agent branch Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants