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: User agent header addition #46

Merged
merged 14 commits into from
Mar 22, 2022

Conversation

gauravsnj
Copy link
Contributor

Currently, client libraries send headers which is used for tracking adoption, version etc
We should extend that header (user-agent) to track PGAdapter binary and version.

fixes http://b/213946108

@gauravsnj gauravsnj changed the title User agent header addition feat: User agent header addition Feb 24, 2022
@olavloite
Copy link
Collaborator

@gauravsnj To format the file according to the wishes of the lint check you must run the command mvn com.coveo:fmt-maven-plugin:format from the command line in the root of the project.

@gauravsnj gauravsnj changed the title feat: User agent header addition feat: User agent header addition Mar 17, 2022
String userAgent =
metadata.get(
Metadata.Key.of(
"x-goog-api-client", Metadata.ASCII_STRING_MARSHALLER));
Copy link
Collaborator

Choose a reason for hiding this comment

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

The client library token header that includes the value is named x-goog-api-client.

Metadata.Key.of(
"x-goog-api-client", Metadata.ASCII_STRING_MARSHALLER));
assertNotNull(userAgent);
assertTrue(userAgent.contains("pg-adapter"));
Copy link
Collaborator

Choose a reason for hiding this comment

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

The header value also includes information about the gax version used etc. So we should only verify that the pg-adapter value is included, not that it only contains pg-adapter.

@gauravsnj gauravsnj merged commit 9e891de into postgresql-dialect Mar 22, 2022
@gauravsnj gauravsnj deleted the user-agent-header-addition branch March 22, 2022 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants