Commit 8e4f6ca3 authored by anandc's avatar anandc Committed by Commit bot

Start logging host-version info in the Chromoting client.

BUG=479831

Review URL: https://codereview.chromium.org/1103913002

Cr-Commit-Position: refs/heads/master@{#326910}
parent d01af7ce
...@@ -47,6 +47,7 @@ remoting.DesktopRemotingActivity.prototype.start = ...@@ -47,6 +47,7 @@ remoting.DesktopRemotingActivity.prototype.start =
function(/** remoting.ClientSession */ session) { function(/** remoting.ClientSession */ session) {
that.session_ = session; that.session_ = session;
session.logHostOfflineErrors(!opt_suppressOfflineError); session.logHostOfflineErrors(!opt_suppressOfflineError);
session.getLogger().setHostVersion(host.hostVersion);
session.connect(host, credentialsProvider); session.connect(host, credentialsProvider);
}); });
}; };
......
...@@ -31,6 +31,8 @@ remoting.LogToServer = function(signalStrategy) { ...@@ -31,6 +31,8 @@ remoting.LogToServer = function(signalStrategy) {
this.connectionType_ = ''; this.connectionType_ = '';
/** @private */ /** @private */
this.authTotalTime_ = 0; this.authTotalTime_ = 0;
/** @private {string} */
this.hostVersion_ = '';
this.setSessionId_(); this.setSessionId_();
signalStrategy.sendConnectionSetupResults(this); signalStrategy.sendConnectionSetupResults(this);
...@@ -62,7 +64,7 @@ remoting.LogToServer.prototype.logClientSessionStateChange = ...@@ -62,7 +64,7 @@ remoting.LogToServer.prototype.logClientSessionStateChange =
// Log the session state change. // Log the session state change.
var entry = remoting.ServerLogEntry.makeClientSessionStateChange( var entry = remoting.ServerLogEntry.makeClientSessionStateChange(
state, connectionError); state, connectionError);
entry.addHostFields(); entry.addClientOSFields();
entry.addChromeVersionField(); entry.addChromeVersionField();
entry.addWebappVersionField(); entry.addWebappVersionField();
entry.addSessionIdField(this.sessionId_); entry.addSessionIdField(this.sessionId_);
...@@ -156,7 +158,7 @@ remoting.LogToServer.prototype.logAccumulatedStatistics_ = function() { ...@@ -156,7 +158,7 @@ remoting.LogToServer.prototype.logAccumulatedStatistics_ = function() {
var entry = remoting.ServerLogEntry.makeStats(this.statsAccumulator_, var entry = remoting.ServerLogEntry.makeStats(this.statsAccumulator_,
this.connectionType_); this.connectionType_);
if (entry) { if (entry) {
entry.addHostFields(); entry.addClientOSFields();
entry.addChromeVersionField(); entry.addChromeVersionField();
entry.addWebappVersionField(); entry.addWebappVersionField();
entry.addSessionIdField(this.sessionId_); entry.addSessionIdField(this.sessionId_);
...@@ -178,6 +180,9 @@ remoting.LogToServer.prototype.log_ = function(entry) { ...@@ -178,6 +180,9 @@ remoting.LogToServer.prototype.log_ = function(entry) {
(new Date().getTime() - this.sessionStartTime_ - (new Date().getTime() - this.sessionStartTime_ -
this.authTotalTime_) / 1000.0; this.authTotalTime_) / 1000.0;
entry.addSessionDuration(sessionDurationInSeconds); entry.addSessionDuration(sessionDurationInSeconds);
// The host-version will be blank for logs before a session has been created.
// For example, the signal-strategy log-entries won't have host version info.
entry.addHostVersion(this.hostVersion_);
// Send the stanza to the debug log. // Send the stanza to the debug log.
console.log('Enqueueing log entry:'); console.log('Enqueueing log entry:');
...@@ -260,3 +265,11 @@ remoting.LogToServer.prototype.setAuthTotalTime = function(totalTime) { ...@@ -260,3 +265,11 @@ remoting.LogToServer.prototype.setAuthTotalTime = function(totalTime) {
this.authTotalTime_ = totalTime; this.authTotalTime_ = totalTime;
}; };
/**
* @param {string} hostVersion Version of the host for current session.
* @return {void} Nothing.
*/
remoting.LogToServer.prototype.setHostVersion = function(hostVersion) {
this.hostVersion_ = hostVersion;
};
...@@ -158,6 +158,9 @@ remoting.ServerLogEntry.KEY_BROWSER_VERSION_ = 'browser-version'; ...@@ -158,6 +158,9 @@ remoting.ServerLogEntry.KEY_BROWSER_VERSION_ = 'browser-version';
/** @private */ /** @private */
remoting.ServerLogEntry.KEY_WEBAPP_VERSION_ = 'webapp-version'; remoting.ServerLogEntry.KEY_WEBAPP_VERSION_ = 'webapp-version';
/** @private */
remoting.ServerLogEntry.KEY_HOST_VERSION_ = 'host-version';
/** @private */ /** @private */
remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_ID_OLD_ = 'session-id-old'; remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_ID_OLD_ = 'session-id-old';
...@@ -367,7 +370,7 @@ remoting.ServerLogEntry.prototype.addSessionIdField = function(sessionId) { ...@@ -367,7 +370,7 @@ remoting.ServerLogEntry.prototype.addSessionIdField = function(sessionId) {
/** /**
* Adds fields describing the host to this log entry. * Adds fields describing the host to this log entry.
*/ */
remoting.ServerLogEntry.prototype.addHostFields = function() { remoting.ServerLogEntry.prototype.addClientOSFields = function() {
var host = remoting.ServerLogEntry.getHostData_(); var host = remoting.ServerLogEntry.getHostData_();
if (host) { if (host) {
if (host.os_name.length > 0) { if (host.os_name.length > 0) {
...@@ -476,6 +479,15 @@ remoting.ServerLogEntry.prototype.addWebappVersionField = function() { ...@@ -476,6 +479,15 @@ remoting.ServerLogEntry.prototype.addWebappVersionField = function() {
} }
}; };
/**
* Adds a field specifying the host version to this log entry.
* @param {string} hostVersion Version of the host for current session.
* @return {void} Nothing.
*/
remoting.ServerLogEntry.prototype.addHostVersion = function(hostVersion) {
this.set_(remoting.ServerLogEntry.KEY_HOST_VERSION_, hostVersion);
};
/** /**
* Adds a field specifying the mode to this log entry. * Adds a field specifying the mode to this log entry.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment