This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 205213 - add mylyn build id to user agent
Summary: add mylyn build id to user agent
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: dev   Edit
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: 2.2   Edit
Assignee: maarten meijer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-02 13:15 EDT by Ketan Padegaonkar CLA
Modified: 2007-10-16 17:04 EDT (History)
7 users (show)

See Also:


Attachments
patch to include build version and os/platform in identifier string (1.97 KB, patch)
2007-10-02 16:38 EDT, maarten meijer CLA
no flags Details | Diff
mylyn/context/zip (672 bytes, application/octet-stream)
2007-10-02 16:40 EDT, maarten meijer CLA
no flags Details
Patch using Steffen Pingels suggestions (1.96 KB, patch)
2007-10-02 17:56 EDT, maarten meijer CLA
no flags Details | Diff
mylyn/context/zip (920 bytes, application/octet-stream)
2007-10-02 17:56 EDT, maarten meijer CLA
no flags Details
Taking on board Steffens suggestions (1.96 KB, patch)
2007-10-04 04:05 EDT, maarten meijer CLA
no flags Details | Diff
mylyn/context/zip (991 bytes, application/octet-stream)
2007-10-04 04:05 EDT, maarten meijer CLA
no flags Details
updated patch to use StringBuilder (1.31 KB, patch)
2007-10-04 10:40 EDT, Steffen Pingel CLA
no flags Details | Diff
added Java version to user-agent (1.39 KB, patch)
2007-10-04 12:31 EDT, Steffen Pingel CLA
no flags Details | Diff
mylyn/context/zip (2.25 KB, application/octet-stream)
2007-10-04 12:31 EDT, Steffen Pingel CLA
no flags Details
Patch to (almopst) create a User Agent string as Mik suggests (3.29 KB, patch)
2007-10-08 05:56 EDT, maarten meijer CLA
no flags Details | Diff
Patch that (almost, but now correctly) implements Mik's preference (3.48 KB, patch)
2007-10-09 06:10 EDT, maarten meijer CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ketan Padegaonkar CLA 2007-10-02 13:15:59 EDT
This is in addition to bug 196056.

It would be a good idea to add a mylyn buildId to the user agent so that it is easier to understand bandwidth usages of various mylyn versions.
Comment 1 maarten meijer CLA 2007-10-02 16:29:45 EDT
### Eclipse Workspace Patch 1.0
#P org.eclipse.mylyn.web.core
Index: src/org/eclipse/mylyn/web/core/WebClientUtil.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.web.core/src/org/eclipse/mylyn/web/core/WebClientUtil.java,v
retrieving revision 1.14
diff -u -r1.14 WebClientUtil.java
--- src/org/eclipse/mylyn/web/core/WebClientUtil.java	13 Sep 2007 22:51:43 -0000	1.14
+++ src/org/eclipse/mylyn/web/core/WebClientUtil.java	2 Oct 2007 20:26:25 -0000
@@ -24,6 +24,9 @@
 import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
 import org.eclipse.core.net.proxy.IProxyData;
 import org.eclipse.core.net.proxy.IProxyService;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.PluginVersionIdentifier;
+import org.eclipse.core.runtime.internal.adaptor.PluginParser.PluginInfo;
 
 /**
  * @author Mik Kersten
@@ -32,7 +35,13 @@
  */
 public class WebClientUtil {
 
-	public static final String USER_AGENT = "Eclipse Mylyn (HttpClient/3.0.1)";
+	private static String os = System.getProperty("os.name") + "-" +
+	System.getProperty("os.version") + "-" +
+	System.getProperty("os.arch");
+
+	private static String build = (String) WebCorePlugin.getDefault().getBundle().getHeaders().get("Bundle-Version");
+
+	public static final String USER_AGENT = "Eclipse Mylyn (HttpClient/3.0.1) build: " + build + " [" + os + "]";
 
 	public static final int CONNNECT_TIMEOUT = 60000;
 
@@ -205,9 +214,9 @@
 
 	/**
 	 * utility method, proxy should be obtained via TaskRepository.getProxy()
-	 * 
+	 *
 	 * TODO: deprecate
-	 * 
+	 *
 	 * @return proxy as defined in platform proxy settings property page, Proxy.NO_PROXY otherwise
 	 */
 	public static Proxy getPlatformProxy() {
@@ -231,7 +240,7 @@
 
 	/**
 	 * utility method, proxy should be obtained via TaskRepository.getProxy()
-	 * 
+	 *
 	 * @return proxy as defined in platform proxy settings property page, Proxy.NO_PROXY otherwise
 	 * @since 2.1
 	 */
Comment 2 maarten meijer CLA 2007-10-02 16:31:33 EDT
Somehow I couldn't attach a patch so I pasted it in previous comment.

Not only do I attach the build id (==Bundle-version) but also the OS and Platform. It was easy, I did this before for a dedicated web client I made ;-)
Comment 3 maarten meijer CLA 2007-10-02 16:33:09 EDT
OK, somebody else must change the header to include [patch]
Comment 4 maarten meijer CLA 2007-10-02 16:38:22 EDT
Created attachment 79580 [details]
patch to include build version and os/platform in identifier string

A it works now!
Comment 5 maarten meijer CLA 2007-10-02 16:40:09 EDT
Created attachment 79581 [details]
mylyn/context/zip
Comment 6 maarten meijer CLA 2007-10-02 16:47:29 EDT
From my local logfile
127.0.0.1 - - [02/Oct/2007:22:46:32 +0200] "POST /bugzilla/show_bug.cgi HTTP/1.1" 200 8011 "-" "Eclipse Mylyn (HttpClient/3.0.1) build: 2.1.0.v20070927-0900 [Mac OS X-10.4.10-i386]"

Q.E.D.
Comment 7 Steffen Pingel CLA 2007-10-02 17:12:36 EDT
Mylyn should respect the format for the user-agent header specified in RFC 2616: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43 . I would suggest to change it to something like this:

 Eclipse Mylyn/2.1.0.v20070927-0900 HttpClient/3.0.1
Comment 8 maarten meijer CLA 2007-10-02 17:18:35 EDT
(In reply to comment #7)
> Mylyn should respect the format for the user-agent header specified in RFC
> 2616: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43 . I would
> suggest to change it to something like this:
> 
>  Eclipse Mylyn/2.1.0.v20070927-0900 HttpClient/3.0.1
> 
Good suggestion!
I found that when using a web stats package like awstats, including OS-platform-architecture helped in adding the user agent to the respective platfom/os aggregrations. So I think OS/Platform/architecture should remain a part of the user-agent string.
Comment 9 maarten meijer CLA 2007-10-02 17:56:36 EDT
Created attachment 79592 [details]
Patch using Steffen Pingels suggestions

Good suggestions!
Comment 10 maarten meijer CLA 2007-10-02 17:56:40 EDT
Created attachment 79593 [details]
mylyn/context/zip
Comment 11 Steffen Pingel CLA 2007-10-03 15:05:26 EDT
Exposing additional system specific information might raises privacy issues however the internal web-browser also does transmit the OS and version (at least on my system):

 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) Gecko/20061201 Firefox/2.0.0.6 (Ubuntu-feisty)
 
Maarten, could you revise your patch to match this format?
Comment 12 maarten meijer CLA 2007-10-03 15:44:22 EDT
as I think you mean as in:
client/version (platform;os;architecture) library/version
or in this case:
Eclipse Mylyn/2.1.0.v20070927-0900 (Mac OS X;10.4.10;i386)  HttpClient/3.0.1
Comment 13 maarten meijer CLA 2007-10-04 04:05:32 EDT
Created attachment 79701 [details]
Taking on board Steffens suggestions

mimic common web browsers format as much as possible
Comment 14 maarten meijer CLA 2007-10-04 04:05:36 EDT
Created attachment 79702 [details]
mylyn/context/zip
Comment 15 Steffen Pingel CLA 2007-10-04 10:40:12 EDT
Created attachment 79727 [details]
updated patch to use StringBuilder
Comment 16 Steffen Pingel CLA 2007-10-04 10:45:58 EDT
Thanks for you contribution Andrey. I have changed the patch slightly to use a StringBuilder to create the user-agent string and added a sanity check in case the bundle does not have the version header. On my system this string is generated:

Eclipse (Linux 2.6.20-16-lowlatency; i386) Mylyn/2.1.0.v20070927-0900 HttpClient/3.0.1

Rob, please review and apply.
Comment 17 Steffen Pingel CLA 2007-10-04 11:20:19 EDT
Maarten, thanks for your contribution and please excuse the name mix-up. 

Rob, we *need* proper real-name support in the next release :).
Comment 18 Eugene Kuleshov CLA 2007-10-04 11:50:58 EDT
Guys, you forgot the Java version :-)
Comment 19 Steffen Pingel CLA 2007-10-04 12:31:48 EDT
Created attachment 79747 [details]
added Java version to user-agent

The update manager uses "Java/1.5.0_11" as the user-agent. I have modified the patch to include that as well:

Java/1.5.0_11 (Linux 2.6.20-16-lowlatency; i386) Eclipse Mylyn/2.1.0.v20070927-0900 HttpClient/3.0.1
Comment 20 Steffen Pingel CLA 2007-10-04 12:31:57 EDT
Created attachment 79748 [details]
mylyn/context/zip
Comment 21 Eugene Kuleshov CLA 2007-10-04 14:43:08 EDT
(In reply to comment #19)
> Java/1.5.0_11 (Linux 2.6.20-16-lowlatency; i386) Eclipse
> Mylyn/2.1.0.v20070927-0900 HttpClient/3.0.1

This probably already went too far, but you also missing Eclipse version and vendor for the JVM. :-)
Comment 22 Robert Elves CLA 2007-10-04 19:12:28 EDT
 (In reply to comment #17)
> Rob, we *need* proper real-name support in the next release :).
+1  There is no way I'm letting another release go out without real name support... and you can quote me on that. :)

Great work on this and all the config caching improvements Maarten! Patch applied, ip log updated.
Comment 23 Eugene Kuleshov CLA 2007-10-04 19:56:29 EDT
(In reply to comment #22)
> Great work on this and all the config caching improvements Maarten! Patch
> applied, ip log updated.

Umm... Rob, what about java vendor info and eclipse version? Maybe you marked this as resolved too fast.
Comment 24 Mik Kersten CLA 2007-10-04 21:03:54 EDT
Great stuff guys.  I would like us to clean up the String a bit in order to make it friendlier to webmasters' eyeballs and parsing tools, and to include the product version (i.e. Eclipse).  I agree that it would be nice to add the "java.vendor" version, not sure if I got the syntax right though (are we allowed a second slash).  How about the following?  Note that I ordered it by the stack, inspired by http://www.mozilla.org/build/revised-user-agent-strings.html (but I don't understand why they don't break out the OS).
   
  Mylyn/2.1.0 Eclipse/3.3.0 HttpClient/3.0.1 Java/1.5.0_11 (Sun) Linux/2.6.20-16-lowlatency (i386; en)   
  
Then if someone redistributed Mylyn they could do this:

  Mylyn/2.1.0 Eclipse/3.3.0 HttpClient/3.0.1 Java/1.5.0_11 (Sun) Linux/2.6.20-16-lowlatency (i386; en) MegaCorpTool/1.0 (MegaCorp, Inc.) 
Comment 25 Robert Elves CLA 2007-10-05 01:14:15 EDT
 (In reply to comment #23)
> Umm... Rob, what about java vendor info and eclipse version? Maybe you marked
> this as resolved too fast.
My bad, will reopen for comments on Mik's proposed changes...
Comment 26 Gunnar Wagenknecht CLA 2007-10-05 01:21:40 EDT
(In reply to comment #24)
> Note that I ordered it by
> the stack, inspired by
> http://www.mozilla.org/build/revised-user-agent-strings.html (but I don't
> understand why they don't break out the OS).

Maybe you should also be sensitive about their concerns.

* There is concern that giving the operating system version on Windows reveals too much information about a system (such as potential security holes).
https://bugzilla.mozilla.org/show_bug.cgi?id=57555

* There is concern that revealing localization information is a violation of privacy.
https://bugzilla.mozilla.org/show_bug.cgi?id=55366
Comment 27 Eugene Kuleshov CLA 2007-10-05 01:33:39 EDT
(In reply to comment #24)
> Mylyn/2.1.0 Eclipse/3.3.0 HttpClient/3.0.1 Java/1.5.0_11 (Sun)
> Linux/2.6.20-16-lowlatency (i386; en)

But when we couldn't tell from release builds of Mylyn and Eclipse and the dev builds.
Comment 28 Ketan Padegaonkar CLA 2007-10-05 01:54:39 EDT
(In reply to comment #27)
> (In reply to comment #24)
> > Mylyn/2.1.0 Eclipse/3.3.0 HttpClient/3.0.1 Java/1.5.0_11 (Sun)
> > Linux/2.6.20-16-lowlatency (i386; en)
> 
> But when we couldn't tell from release builds of Mylyn and Eclipse and the dev
> builds.

Do we really need all this information ? As far as I remember from the conference call.

IMO, mylyn version number is all that matters, anything else will be too difficult and not solve *any* practical purpose as far as any sort of reporting is concerned.

This, I think should be Denis' call. Denis, any thoughts?
Comment 29 Eugene Kuleshov CLA 2007-10-05 02:47:52 EDT
(In reply to comment #28)
> not solve *any* practical purpose as far as any sort of reporting is concerned.

There is *very* practical purpose. Given that Mylyn is included into almost all default packages, this info will practically give a real time picture of what users are actually running. Getting such report is simply a matter of running some log analyzer.
Comment 30 Denis Roy CLA 2007-10-05 08:56:45 EDT
> IMO, mylyn version number is all that matters, anything else will be too
> difficult and not solve *any* practical purpose as far as any sort of reporting
> is concerned.

Agreed.
I also agree with Gunnar's statements in comment 26.

(In reply to comment #29)
> this info will practically give a real time picture of what
> users are actually running. Getting such report is simply a matter of running
> some log analyzer.

Actually, I don't typically log the user agent on bugs.eclipse.org.  I enabled it some time ago to troubleshoot some performance problems, but I will re-disable it.  At any rate, our privacy policy and terms of use have restrictions as to what we can and cannot do with that information.

IMHO, Mylyn/2.1.0 Eclipse/3.3.0 would be sufficient -- but that's just me.
Comment 31 maarten meijer CLA 2007-10-05 09:39:59 EDT
(In reply to comment #29)
> (In reply to comment #28)
> > not solve *any* practical purpose as far as any sort of reporting is concerned.
> 
> There is *very* practical purpose. Given that Mylyn is included into almost all
> default packages, this info will practically give a real time picture of what
> users are actually running. Getting such report is simply a matter of running
> some log analyzer.
> 
Agree, also note that eclipse.org is NOT THE ONLY bugzilla accessed using Mylyn.
It is just another browser and should tell a host as much. Some sites do run log analyzers and it provides useful information.

The above is a case for moving the code into the main plugin and making it API, getMylynClientString() sot that JIRA, Trac, generic webconnector and all the other can use it as well.

Somehow I always hope it will reveal that us Mac users are NOT A MINORITY so its worthwile to fix bug 68111 ;-)
Comment 32 Steffen Pingel CLA 2007-10-05 10:14:49 EDT
> > There is *very* practical purpose. Given that Mylyn is included into almost all
> > default packages, this info will practically give a real time picture of what
> > users are actually running. Getting such report is simply a matter of running
> > some log analyzer.
> > 
> Agree, also note that eclipse.org is NOT THE ONLY bugzilla accessed using
> Mylyn.

The current user-agent string already identities Mylyn. The goal of this bug report is to determine what other additional information is useful in that string.

> It is just another browser and should tell a host as much. Some sites do run
> log analyzers and it provides useful information.

There is a difference between useful in the sense of interesting and what is required on a technical level. The purpose of the user-agent is to allow web-servers to respond differently if a certain version of a product requires it. Therefore any information other than the Mylyn and HttpClient version seems unnecessary and in the case of potentially private information such as the locale there should be an option to disable inclusion in the user-agent.

If there is a need to collect statistics about the Eclipse user base I suggest to implement a separate plug-in that will make this explicit to the user or possibly include this in the Mylyn monitor plug-in.
 
> The above is a case for moving the code into the main plugin and making it API,
> getMylynClientString() sot that JIRA, Trac, generic webconnector and all the
> other can use it as well.

All connectors should invoke WebClientUtil.setupHttpClient() which configures the user-agent. Please file a bug report if that does not work properly.
Comment 33 Eugene Kuleshov CLA 2007-10-05 13:26:47 EDT
(In reply to comment #32)
> > It is just another browser and should tell a host as much. Some sites do run
> > log analyzers and it provides useful information.
> There is a difference between useful in the sense of interesting and what is
> required on a technical level. 

Given the frequent Mylyn releases you won't be able to tell if users are running version with some particular patch/change or not, and it won't allow to do the same for Eclipse version.

> The purpose of the user-agent is to allow web-servers to respond differently if a 
> certain version of a product requires it. Therefore any information other than the 
> Mylyn and HttpClient version seems unnecessary and in the case of potentially 
> private information such as the locale there should be an option to disable 
> inclusion in the user-agent.

BTW, locale is always passed by a web browser in a completely different header, so there is no privacy issue there.

> If there is a need to collect statistics about the Eclipse user base I suggest
> to implement a separate plug-in that will make this explicit to the user or
> possibly include this in the Mylyn monitor plug-in.

Why that would be necessary if existing path could be used?

I do understand privacy issues Denis was referring to, but that is a matter of keeping that information private, as long as only aggregated data published.
Comment 34 Mik Kersten CLA 2007-10-05 17:47:07 EDT
-1 for differentiating minor-minor-minor Eclipse and Mylyn date String, and keeping the version String at something like Mylyn/2.1.0.  Length is important because some loggers truncate the user agent string by default.  Also, in many cases we will be able to recognize that it is an integration build because it's version will be ahead (e.g. 2.2.0 for this week's build).

I agree with prioritizing privacy concerns since that's a guiding principle for Mylyn, but I think that we should be matching the current browser implementations since they represent the state of the art (afaik Mozilla still has OS and localization, MSIE has that as well as CLR version, and WebKit works like Mozilla).  I'm happiest with our following the Mozilla pattern, so if anyone knows that they are or will soon be logging a subset of this, please post and we can prune accordingly.  On quick read of the bugs linked in comment#26 wasn't clear to me from the bug reports if/when they would change.  But if enough people feel strongly about this we can remove this info, at the cost of being less standard.

Combining feedback above, and looking over some http log files for formatting and other conventions, here is a summary of important info and explanations of why it is useful diagnosing how the Mylyn client is accessing a server.
1) Mylyn: know we need it, need to include connector since it controls the connection and in some cases will be more relevant than the Mylyn version
2) Eclipse: we depend on org.eclipse.core.net which can affect connections, have folded in the redistribution into the comment, but the redistribution is very important to include because it can affect how Mylyn behaves and who supports it
3) HttpClient: used for most connections
4) Java: java.net is used by HttpClient, can be used by us (though we avoid it)
5) OS: following browser convention 

So I'm still ending up with the following String:

    Mylyn/2.1.0 (Rally Connector 1.0) Eclipse/3.3.0 (JBuilder 2007) HttpClient/3.0.1 Java/1.5.0_11 (Sun) Linux/2.6.20-16-lowlatency (i386; en) 

If anyone would like to provide a shortened version please post arguments for removing one of the 1-5 entries and the resulting string.  Also please vote on the privacy issue.  My vote is:

+1 for consistency with latest Mozilla implementation, since in my opinion it sets the de facto standard for finessing the privacy vs. utility tradeoff
Comment 35 maarten meijer CLA 2007-10-07 13:07:19 EDT
+1 for consistency with latest Mozilla implementation, as that is:
-  most likely to be parsable by all web stats packages: awstats, webalyzer, etc.
and provide desired feedback to host owner
- most usable for traffic reduction/optimization efforts using mod_rewrite etc.
Comment 36 maarten meijer CLA 2007-10-08 05:54:57 EDT
 (In reply to comment #34)
> 1) Mylyn: know we need it, need to include connector since it controls the
> connection and in some cases will be more relevant than the Mylyn version
Retrieve version info from WebcorePlugin Bundle

> 2) Eclipse: we depend on org.eclipse.core.net which can affect connections, have
> folded in the redistribution into the comment, but the redistribution is very
> important to include because it can affect how Mylyn behaves and who supports it
Retrieve version info from
osgi.framework.version=3.3.1.R33x_v20070828

> 3) HttpClient: used for most connections
Retrieve from HttpClientParams.getDefaultParams().getParameter(HttpClientParams.USER_AGENT);

> 4) Java: java.net is used by HttpClient, can be used by us (though we avoid it)
create from:
java.vendor=Apple Computer, Inc.
java.version=1.5.0_07

> 5) OS: following browser convention
create form:
os.arch=i386
os.name=Mac OS X
os.version=10.4.10

So everything can be done, except:
- connector identifier, this must go into setupHttpClient as a parameter
- redistribution, is there a retrievable property for that too, like
Comment 37 maarten meijer CLA 2007-10-08 05:56:39 EDT
Created attachment 79888 [details]
Patch to (almopst) create a User Agent string as Mik suggests

Still Missing:
- redistribution
- connector info
Comment 38 maarten meijer CLA 2007-10-09 06:10:32 EDT
Created attachment 79940 [details]
Patch that (almost, but now correctly) implements Mik's preference

Missing:
- Task repository client ID
- Redistribution ID
Comment 39 Mik Kersten CLA 2007-10-09 21:02:30 EDT
Maarten: great stuff!  I'll let Rob take over on applying the patch.  

(In reply to comment #38)
> - Task repository client ID

Seems like WebClientUtil will have to be setup by the connector to either take an instance of the connector plug-in or a version String.  Then the version can be retrieved from the bundle.

> - Redistribution ID

Seems like the following property is best, since it is automatically set in RCP apps: eclipse.product=org.eclipse.platform.ide
Comment 40 Robert Elves CLA 2007-10-11 16:32:45 EDT
Path applied, ip log updated.
Comment 41 maarten meijer CLA 2007-10-15 13:38:26 EDT
distro and connector left for later
Comment 42 Mik Kersten CLA 2007-10-16 12:45:44 EDT
 (In reply to comment #41)
> distro and connector left for later

Created bug 206496
Comment 43 maarten meijer CLA 2007-10-16 17:04:20 EDT
 (In reply to comment #42)
> (In reply to comment #41)
> > distro and connector left for later
> 
> Created bug 206496
connector requires API change as it has to be passed into setupHttpClient(), so needs to be done for all callers:
bugzilla, trac, monitor, jira, webrepository, etc. When is that feasible?

distro: we need some dfeedback on how distro's show up in the properties. Ask on the newsgroup?
Should these be sub tasks?