| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * A class of server log entries. | 7 * A class of server log entries. |
| 8 * | 8 * |
| 9 * Any changes to the values here need to be coordinated with the host and | 9 * Any changes to the values here need to be coordinated with the host and |
| 10 * server/log proto code. | 10 * server/log proto code. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 /** @private */ | 40 /** @private */ |
| 41 remoting.ServerLogEntry.KEY_SESSION_STATE_ = 'session-state'; | 41 remoting.ServerLogEntry.KEY_SESSION_STATE_ = 'session-state'; |
| 42 /** @private */ | 42 /** @private */ |
| 43 remoting.ServerLogEntry.KEY_CONNECTION_TYPE_ = 'connection-type'; | 43 remoting.ServerLogEntry.KEY_CONNECTION_TYPE_ = 'connection-type'; |
| 44 /** @private */ | 44 /** @private */ |
| 45 remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_TYPE_ = 'signal-strategy-type'; | 45 remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_TYPE_ = 'signal-strategy-type'; |
| 46 /** @private */ | 46 /** @private */ |
| 47 remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_PROGRESS_ = | 47 remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_PROGRESS_ = |
| 48 'signal-strategy-progress'; | 48 'signal-strategy-progress'; |
| 49 /** @private */ | 49 /** @private */ |
| 50 remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_ELAPSED_TIME_ = | 50 remoting.ServerLogEntry.KEY_ELAPSED_TIME_MS_ = 'elapsed-time'; |
| 51 'signal-strategy-elapsed-time'; | 51 |
| 52 | 52 |
| 53 /** | 53 /** |
| 54 * @private | 54 * @private |
| 55 * @param {remoting.ClientSession.State} state | 55 * @param {remoting.ClientSession.State} state |
| 56 * @return {string} | 56 * @return {string} |
| 57 */ | 57 */ |
| 58 remoting.ServerLogEntry.getValueForSessionState_ = function(state) { | 58 remoting.ServerLogEntry.getValueForSessionState_ = function(state) { |
| 59 switch(state) { | 59 switch(state) { |
| 60 case remoting.ClientSession.State.UNKNOWN: | 60 case remoting.ClientSession.State.UNKNOWN: |
| 61 return 'unknown'; | 61 return 'unknown'; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 return 'host-overload'; | 112 return 'host-overload'; |
| 113 case remoting.Error.P2P_FAILURE: | 113 case remoting.Error.P2P_FAILURE: |
| 114 return 'p2p-failure'; | 114 return 'p2p-failure'; |
| 115 case remoting.Error.UNEXPECTED: | 115 case remoting.Error.UNEXPECTED: |
| 116 return 'unexpected'; | 116 return 'unexpected'; |
| 117 default: | 117 default: |
| 118 return 'unknown-' + connectionError; | 118 return 'unknown-' + connectionError; |
| 119 } | 119 } |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 /** @private */ | |
| 123 remoting.ServerLogEntry.KEY_SESSION_DURATION_ = 'session-duration'; | |
| 124 | 122 |
| 125 /** @private */ | 123 /** @private */ |
| 126 remoting.ServerLogEntry.VALUE_EVENT_NAME_CONNECTION_STATISTICS_ = | 124 remoting.ServerLogEntry.VALUE_EVENT_NAME_CONNECTION_STATISTICS_ = |
| 127 "connection-statistics"; | 125 "connection-statistics"; |
| 128 /** @private */ | 126 /** @private */ |
| 129 remoting.ServerLogEntry.KEY_VIDEO_BANDWIDTH_ = "video-bandwidth"; | 127 remoting.ServerLogEntry.KEY_VIDEO_BANDWIDTH_ = "video-bandwidth"; |
| 130 /** @private */ | 128 /** @private */ |
| 131 remoting.ServerLogEntry.KEY_CAPTURE_LATENCY_ = "capture-latency"; | 129 remoting.ServerLogEntry.KEY_CAPTURE_LATENCY_ = "capture-latency"; |
| 132 /** @private */ | 130 /** @private */ |
| 133 remoting.ServerLogEntry.KEY_ENCODE_LATENCY_ = "encode-latency"; | 131 remoting.ServerLogEntry.KEY_ENCODE_LATENCY_ = "encode-latency"; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 remoting.ServerLogEntry.getValueForSessionState_(state)); | 233 remoting.ServerLogEntry.getValueForSessionState_(state)); |
| 236 if (connectionError != remoting.Error.NONE) { | 234 if (connectionError != remoting.Error.NONE) { |
| 237 entry.set_(remoting.ServerLogEntry.KEY_CONNECTION_ERROR_, | 235 entry.set_(remoting.ServerLogEntry.KEY_CONNECTION_ERROR_, |
| 238 remoting.ServerLogEntry.getValueForError_(connectionError)); | 236 remoting.ServerLogEntry.getValueForError_(connectionError)); |
| 239 } | 237 } |
| 240 entry.addModeField(mode); | 238 entry.addModeField(mode); |
| 241 return entry; | 239 return entry; |
| 242 }; | 240 }; |
| 243 | 241 |
| 244 /** | 242 /** |
| 245 * Adds a session duration to a log entry. | |
| 246 * | |
| 247 * @param {number} sessionDuration | |
| 248 */ | |
| 249 remoting.ServerLogEntry.prototype.addSessionDurationField = function( | |
| 250 sessionDuration) { | |
| 251 this.set_(remoting.ServerLogEntry.KEY_SESSION_DURATION_, | |
| 252 sessionDuration.toString()); | |
| 253 }; | |
| 254 | |
| 255 /** | |
| 256 * Makes a log entry for a set of connection statistics. | 243 * Makes a log entry for a set of connection statistics. |
| 257 * Returns null if all the statistics were zero. | 244 * Returns null if all the statistics were zero. |
| 258 * | 245 * |
| 259 * @param {remoting.StatsAccumulator} statsAccumulator | 246 * @param {remoting.StatsAccumulator} statsAccumulator |
| 260 * @param {string} connectionType | 247 * @param {string} connectionType |
| 261 * @param {remoting.DesktopConnectedView.Mode} mode | 248 * @param {remoting.DesktopConnectedView.Mode} mode |
| 262 * @return {?remoting.ServerLogEntry} | 249 * @return {?remoting.ServerLogEntry} |
| 263 */ | 250 */ |
| 264 remoting.ServerLogEntry.makeStats = function(statsAccumulator, | 251 remoting.ServerLogEntry.makeStats = function(statsAccumulator, |
| 265 connectionType, | 252 connectionType, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 entry.addModeField(mode); | 337 entry.addModeField(mode); |
| 351 return entry; | 338 return entry; |
| 352 }; | 339 }; |
| 353 | 340 |
| 354 /** | 341 /** |
| 355 * Makes a log entry for a "signal strategy fallback" event. | 342 * Makes a log entry for a "signal strategy fallback" event. |
| 356 * | 343 * |
| 357 * @param {string} sessionId | 344 * @param {string} sessionId |
| 358 * @param {remoting.SignalStrategy.Type} strategyType | 345 * @param {remoting.SignalStrategy.Type} strategyType |
| 359 * @param {remoting.FallbackSignalStrategy.Progress} progress | 346 * @param {remoting.FallbackSignalStrategy.Progress} progress |
| 360 * @param {number} elapsedTimeInMs | |
| 361 * @return {remoting.ServerLogEntry} | 347 * @return {remoting.ServerLogEntry} |
| 362 */ | 348 */ |
| 363 remoting.ServerLogEntry.makeSignalStrategyProgress = | 349 remoting.ServerLogEntry.makeSignalStrategyProgress = |
| 364 function(sessionId, strategyType, progress, elapsedTimeInMs) { | 350 function(sessionId, strategyType, progress) { |
| 365 var entry = new remoting.ServerLogEntry(); | 351 var entry = new remoting.ServerLogEntry(); |
| 366 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, | 352 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, |
| 367 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); | 353 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); |
| 368 entry.set_( | 354 entry.set_( |
| 369 remoting.ServerLogEntry.KEY_EVENT_NAME_, | 355 remoting.ServerLogEntry.KEY_EVENT_NAME_, |
| 370 remoting.ServerLogEntry.VALUE_EVENT_NAME_SIGNAL_STRATEGY_PROGRESS_); | 356 remoting.ServerLogEntry.VALUE_EVENT_NAME_SIGNAL_STRATEGY_PROGRESS_); |
| 371 entry.addSessionIdField(sessionId); | 357 entry.addSessionIdField(sessionId); |
| 372 entry.set_(remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_TYPE_, strategyType); | 358 entry.set_(remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_TYPE_, strategyType); |
| 373 entry.set_(remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_PROGRESS_, progress); | 359 entry.set_(remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_PROGRESS_, progress); |
| 374 entry.set_(remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_ELAPSED_TIME_, | |
| 375 String(elapsedTimeInMs)); | |
| 376 | 360 |
| 377 return entry; | 361 return entry; |
| 378 }; | 362 }; |
| 379 | 363 |
| 380 /** | 364 /** |
| 381 * Adds a session ID field to this log entry. | 365 * Adds a session ID field to this log entry. |
| 382 * | 366 * |
| 383 * @param {string} sessionId | 367 * @param {string} sessionId |
| 384 */ | 368 */ |
| 385 remoting.ServerLogEntry.prototype.addSessionIdField = function(sessionId) { | 369 remoting.ServerLogEntry.prototype.addSessionIdField = function(sessionId) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 return { | 444 return { |
| 461 'os_name': remoting.ServerLogEntry.VALUE_OS_NAME_CHROMEOS_, | 445 'os_name': remoting.ServerLogEntry.VALUE_OS_NAME_CHROMEOS_, |
| 462 'os_version': match[2], | 446 'os_version': match[2], |
| 463 'cpu': match[1] | 447 'cpu': match[1] |
| 464 }; | 448 }; |
| 465 } | 449 } |
| 466 return null; | 450 return null; |
| 467 }; | 451 }; |
| 468 | 452 |
| 469 /** | 453 /** |
| 454 * Adds a field to this log entry specifying the elapsed time since the start of |
| 455 * the session to the current session state. |
| 456 * @param {number} elapsedTimeInMs |
| 457 */ |
| 458 remoting.ServerLogEntry.prototype.addElapsedTimeMs = |
| 459 function(elapsedTimeInMs) { |
| 460 this.set_(remoting.ServerLogEntry.KEY_ELAPSED_TIME_MS_, |
| 461 String(elapsedTimeInMs)); |
| 462 }; |
| 463 |
| 464 |
| 465 /** |
| 470 * Adds a field specifying the browser version to this log entry. | 466 * Adds a field specifying the browser version to this log entry. |
| 471 */ | 467 */ |
| 472 remoting.ServerLogEntry.prototype.addChromeVersionField = function() { | 468 remoting.ServerLogEntry.prototype.addChromeVersionField = function() { |
| 473 var version = remoting.getChromeVersion(); | 469 var version = remoting.getChromeVersion(); |
| 474 if (version != null) { | 470 if (version != null) { |
| 475 this.set_(remoting.ServerLogEntry.KEY_BROWSER_VERSION_, version); | 471 this.set_(remoting.ServerLogEntry.KEY_BROWSER_VERSION_, version); |
| 476 } | 472 } |
| 477 }; | 473 }; |
| 478 | 474 |
| 479 /** | 475 /** |
| (...skipping 28 matching lines...) Expand all Loading... |
| 508 case remoting.DesktopConnectedView.Mode.IT2ME: | 504 case remoting.DesktopConnectedView.Mode.IT2ME: |
| 509 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; | 505 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; |
| 510 case remoting.DesktopConnectedView.Mode.ME2ME: | 506 case remoting.DesktopConnectedView.Mode.ME2ME: |
| 511 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; | 507 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; |
| 512 case remoting.DesktopConnectedView.Mode.APP_REMOTING: | 508 case remoting.DesktopConnectedView.Mode.APP_REMOTING: |
| 513 return remoting.ServerLogEntry.VALUE_MODE_APP_REMOTING_; | 509 return remoting.ServerLogEntry.VALUE_MODE_APP_REMOTING_; |
| 514 default: | 510 default: |
| 515 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; | 511 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; |
| 516 } | 512 } |
| 517 }; | 513 }; |
| OLD | NEW |