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: include User agent #747
Conversation
options.getSpannerStubSettings().toBuilder() | ||
.setTransportChannelProvider(channelProvider) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
options.getSpannerStubSettings().toBuilder() | |
.setTransportChannelProvider(channelProvider) | |
options | |
.getSpannerStubSettings() | |
.toBuilder() | |
options | |
.getSpannerStubSettings() | |
.executeSqlSettings() | |
.getRetrySettings() | |
.toBuilder() |
options.getInstanceAdminStubSettings().toBuilder() | ||
.setTransportChannelProvider(channelProvider) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
options.getInstanceAdminStubSettings().toBuilder() | |
.setTransportChannelProvider(channelProvider) | |
options | |
.getInstanceAdminStubSettings() | |
.toBuilder() | |
options | |
.getDatabaseAdminStubSettings() | |
.toBuilder() |
options | ||
.getInstanceAdminStubSettings() | ||
.toBuilder() | ||
options.getInstanceAdminStubSettings().toBuilder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
options.getInstanceAdminStubSettings().toBuilder() | |
options | |
.getInstanceAdminStubSettings() | |
.toBuilder() |
Codecov Report
@@ Coverage Diff @@
## master #747 +/- ##
=========================================
Coverage 85.05% 85.06%
Complexity 2556 2556
=========================================
Files 142 142
Lines 13930 13938 +8
Branches 1326 1326
=========================================
+ Hits 11848 11856 +8
Misses 1526 1526
Partials 556 556
Continue to review full report at Codecov.
|
a6d4e7c
to
6a41e9a
Compare
.setHeaderProvider(mergedHeaderProvider) | ||
|
||
// Inject client library version to `user-agent` | ||
.setHeaderProvider( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are overriding the header provider here, instead of adding to it. We have to manually construct a new provider that will encapsulate the existing one the the new one:
private static final String USER_AGENT_KEY = "user-agent";
private static final String CLIENT_LIBRARY_LANGUAGE = "spanner-java";
Map<String, String> headersWithUserAgent = ImmutableMap.<String, String>builder()
.put(USER_AGENT_KEY, CLIENT_LIBRARY_LANGUAGE + "/" + GaxProperties.getLibraryVersion(GapicSpannerRpc.class)))
.putAll(mergedHeaderProvider.getHeaders())
.build();
final HeaderProvider headerProviderWithUserAgent = FixedHeaderProvider.create(headersWithUserAgent);
...
.setHeaderProvider(headerProviderWithUserAgent);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Thanks!
6a41e9a
to
a075cff
Compare
* chore: add DirectPath fallback integration test * feat: include User agent
🤖 I have created a release *beep* *boop* --- ### Updating meta-information for bleeding-edge SNAPSHOT release. --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Configure the UserAgent in addition to x-goog-api-client. This will be needed for DirectPath.