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-1542] Specifies a User Agent in Spanner Client #3574

Closed
wants to merge 3 commits into from

Conversation

mairbek
Copy link
Contributor

@mairbek mairbek commented Jul 17, 2017

R: @jkff

@mairbek
Copy link
Contributor Author

mairbek commented Jul 17, 2017

retest this please

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 70.608% when pulling a12a552 on mairbek:useragent into 7e4719c on apache:master.


/**
* Abstract {@link DoFn} that manages {@link Spanner} lifecycle. Use {@link
* AbstractSpannerFn#databaseClient} to access the Cloud Spanner database client.
*/
abstract class AbstractSpannerFn<InputT, OutputT> extends DoFn<InputT, OutputT> {
private static final String USER_AGENT_PREFIX = "apache.beam.java";
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a comment: any reason for this particular format? Is this similar to the format of other Spanner user agents?

Copy link
Contributor Author

@mairbek mairbek Jul 18, 2017

Choose a reason for hiding this comment

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

According to https://tools.ietf.org/html/rfc7231#page-46
format should be like User-Agent: CERN-LineMode/2.15 libwww/2.17b3

We just want to make sure we can track the usage of the library.

builder.setServiceFactory(spannerConfig.getServiceFactory());
}
ReleaseInfo releaseInfo = ReleaseInfo.getReleaseInfo();
builder.setUserAgentPrefix(USER_AGENT_PREFIX + "." + releaseInfo.getVersion());
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe use ReleaseInfo.getName() too? I don't know if ReleaseInfo.getProperties() is useful or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Version should be enough, the name appears to be static.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would not be surprised if at some point ReleaseInfo.getName() may return a non-hardcoded value; e.g. if somebody is using Beam via https://github.com/spotify/scio/, I think it'd be nice if ReleaseInfo said that this is scio, even though currently it doesn't say that. There doesn't seem to any downside to using ReleaseInfo.getName() instead of hardcoding "Apache_Beam_Java" yourself, is there?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.009%) to 70.635% when pulling 426a1fd on mairbek:useragent into 7e4719c on apache:master.

@asfgit asfgit closed this in 8ac796c Aug 2, 2017
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.

None yet

3 participants