Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Unified Diff: remoting/webapp/crd/js/log_to_server.js

Issue 953223002: Include time elapsed since start of a remoting session in each log entry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove now unnecessary session duration logging. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/webapp/crd/js/fallback_signal_strategy.js ('k') | remoting/webapp/crd/js/server_log_entry.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/crd/js/log_to_server.js
diff --git a/remoting/webapp/crd/js/log_to_server.js b/remoting/webapp/crd/js/log_to_server.js
index 8b87f1b5c4efc7273b3cb4ce5f43f36ae5926294..d76b33f0d00e068200649e3b946df75c4fab4a58 100644
--- a/remoting/webapp/crd/js/log_to_server.js
+++ b/remoting/webapp/crd/js/log_to_server.js
@@ -25,7 +25,7 @@ remoting.LogToServer = function(signalStrategy, mode) {
/** @private */
this.sessionIdGenerationTime_ = 0;
/** @private */
- this.sessionStartTime_ = 0;
+ this.sessionStartTime_ = new Date().getTime();
/** @private */
this.signalStrategy_ = signalStrategy;
/** @private */
@@ -60,12 +60,6 @@ remoting.LogToServer.CONNECTION_STATS_ACCUMULATE_TIME = 60 * 1000;
remoting.LogToServer.prototype.logClientSessionStateChange =
function(state, connectionError) {
this.maybeExpireSessionId_();
- // Set the session start time if we haven't done so already.
- if (remoting.LogToServer.isStartOfSession_(state)) {
- if (this.sessionStartTime_ == 0) {
- this.sessionStartTime_ = new Date().getTime();
- }
- }
// Log the session state change.
var entry = remoting.ServerLogEntry.makeClientSessionStateChange(
state, connectionError, this.mode_);
@@ -73,15 +67,6 @@ remoting.LogToServer.prototype.logClientSessionStateChange =
entry.addChromeVersionField();
entry.addWebappVersionField();
entry.addSessionIdField(this.sessionId_);
- // Maybe clear the session start time, and log the session duration.
- if (remoting.LogToServer.shouldAddDuration_(state) &&
- (this.sessionStartTime_ != 0)) {
- entry.addSessionDurationField(
- (new Date().getTime() - this.sessionStartTime_) / 1000.0);
- if (remoting.LogToServer.isEndOfSession_(state)) {
- this.sessionStartTime_ = 0;
- }
- }
this.log_(entry);
// Don't accumulate connection statistics across state changes.
this.logAccumulatedStatistics_();
@@ -104,13 +89,12 @@ remoting.LogToServer.prototype.setConnectionType = function(connectionType) {
/**
* @param {remoting.SignalStrategy.Type} strategyType
* @param {remoting.FallbackSignalStrategy.Progress} progress
- * @param {number} elapsedTimeInMs
*/
remoting.LogToServer.prototype.logSignalStrategyProgress =
- function(strategyType, progress, elapsedTimeInMs) {
+ function(strategyType, progress) {
this.maybeExpireSessionId_();
var entry = remoting.ServerLogEntry.makeSignalStrategyProgress(
- this.sessionId_, strategyType, progress, elapsedTimeInMs);
+ this.sessionId_, strategyType, progress);
this.log_(entry);
};
@@ -143,20 +127,6 @@ remoting.LogToServer.isEndOfSession_ = function(state) {
(state == remoting.ClientSession.State.CONNECTION_CANCELED));
};
-/**
- * Whether the duration should be added to the log entry for this state.
- *
- * @private
- * @param {remoting.ClientSession.State} state
- * @return {boolean}
- */
-remoting.LogToServer.shouldAddDuration_ = function(state) {
- // Duration is added to log entries at the end of the session, as well as at
- // some intermediate states where it is relevant (e.g. to determine how long
- // it took for a session to become CONNECTED).
- return (remoting.LogToServer.isEndOfSession_(state) ||
- (state == remoting.ClientSession.State.CONNECTED));
-};
/**
* Logs connection statistics.
@@ -203,6 +173,10 @@ remoting.LogToServer.prototype.logAccumulatedStatistics_ = function() {
* @param {remoting.ServerLogEntry} entry
*/
remoting.LogToServer.prototype.log_ = function(entry) {
+ // Log the time taken to get to this point from the time this session started.
+ var elapsedTimeInMs = new Date().getTime() - this.sessionStartTime_;
+ entry.addElapsedTimeMs(elapsedTimeInMs);
+
// Send the stanza to the debug log.
console.log('Enqueueing log entry:');
entry.toDebugLog(1);
« no previous file with comments | « remoting/webapp/crd/js/fallback_signal_strategy.js ('k') | remoting/webapp/crd/js/server_log_entry.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698