You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

statistics.js 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. import EventEmitter from 'events';
  2. import analytics from './AnalyticsAdapter';
  3. import CallStats from './CallStats';
  4. import LocalStats from './LocalStatsCollector';
  5. import RTPStats from './RTPStatsCollector';
  6. import RTCBrowserType from '../RTC/RTCBrowserType';
  7. import Settings from '../settings/Settings';
  8. import ScriptUtil from '../util/ScriptUtil';
  9. import JitsiTrackError from '../../JitsiTrackError';
  10. import * as StatisticsEvents from '../../service/statistics/Events';
  11. const logger = require('jitsi-meet-logger').getLogger(__filename);
  12. /**
  13. * Stores all active {@link Statistics} instances.
  14. * @type {Set<Statistics>}
  15. */
  16. let _instances;
  17. /**
  18. * True if callstats API is loaded
  19. */
  20. let isCallstatsLoaded = false;
  21. /**
  22. * Since callstats.io is a third party, we cannot guarantee the quality of their
  23. * service. More specifically, their server may take noticeably long time to
  24. * respond. Consequently, it is in our best interest (in the sense that the
  25. * intergration of callstats.io is pretty important to us but not enough to
  26. * allow it to prevent people from joining a conference) to (1) start
  27. * downloading their API as soon as possible and (2) do the downloading
  28. * asynchronously.
  29. *
  30. * @param customScriptUrl
  31. */
  32. function loadCallStatsAPI(customScriptUrl) {
  33. if (!isCallstatsLoaded) {
  34. ScriptUtil.loadScript(
  35. customScriptUrl
  36. || 'https://api.callstats.io/static/callstats-ws.min.js',
  37. /* async */ true,
  38. /* prepend */ true);
  39. isCallstatsLoaded = true;
  40. }
  41. // FIXME At the time of this writing, we hope that the callstats.io API will
  42. // have loaded by the time we needed it (i.e. CallStats.init is invoked).
  43. }
  44. /**
  45. * callstats strips any additional fields from Error except for "name", "stack",
  46. * "message" and "constraintName". So we need to bundle additional information
  47. * from JitsiTrackError into error passed to callstats to preserve valuable
  48. * information about error.
  49. * @param {JitsiTrackError} error
  50. */
  51. function formatJitsiTrackErrorForCallStats(error) {
  52. const err = new Error();
  53. // Just copy original stack from error
  54. err.stack = error.stack;
  55. // Combine name from error's name plus (possibly) name of original GUM error
  56. err.name = (error.name || 'Unknown error') + (error.gum && error.gum.error
  57. && error.gum.error.name ? ` - ${error.gum.error.name}` : '');
  58. // Put all constraints into this field. For constraint failed errors we will
  59. // still know which exactly constraint failed as it will be a part of
  60. // message.
  61. err.constraintName = error.gum && error.gum.constraints
  62. ? JSON.stringify(error.gum.constraints) : '';
  63. // Just copy error's message.
  64. err.message = error.message;
  65. return err;
  66. }
  67. /**
  68. * Init statistic options
  69. * @param options
  70. */
  71. Statistics.init = function(options) {
  72. Statistics.audioLevelsEnabled = !options.disableAudioLevels;
  73. if (typeof options.audioLevelsInterval === 'number') {
  74. Statistics.audioLevelsInterval = options.audioLevelsInterval;
  75. }
  76. Statistics.disableThirdPartyRequests = options.disableThirdPartyRequests;
  77. };
  78. /**
  79. *
  80. * @param xmpp
  81. * @param options
  82. */
  83. export default function Statistics(xmpp, options) {
  84. /**
  85. * {@link RTPStats} mapped by {@link TraceablePeerConnection.id} which
  86. * collect RTP statistics for each peerconnection.
  87. * @type {Map<string, RTPStats}
  88. */
  89. this.rtpStatsMap = new Map();
  90. this.eventEmitter = new EventEmitter();
  91. this.xmpp = xmpp;
  92. this.options = options || {};
  93. this.callStatsIntegrationEnabled
  94. = this.options.callStatsID && this.options.callStatsSecret
  95. // Even though AppID and AppSecret may be specified, the integration
  96. // of callstats.io may be disabled because of globally-disallowed
  97. // requests to any third parties.
  98. && (Statistics.disableThirdPartyRequests !== true);
  99. if (this.callStatsIntegrationEnabled) {
  100. if (!RTCBrowserType.isReactNative()) {
  101. loadCallStatsAPI(this.options.callStatsCustomScriptUrl);
  102. }
  103. if (!this.options.callStatsConfIDNamespace) {
  104. logger.warn('"callStatsConfIDNamespace" is not defined');
  105. }
  106. }
  107. /**
  108. * Stores {@link CallStats} instances for each
  109. * {@link TraceablePeerConnection} (one {@link CallStats} instance serves
  110. * one TPC). The instances are mapped by {@link TraceablePeerConnection.id}.
  111. * @type {Map<number, CallStats>}
  112. */
  113. this.callsStatsInstances = new Map();
  114. Statistics.instances.add(this);
  115. }
  116. Statistics.audioLevelsEnabled = false;
  117. Statistics.audioLevelsInterval = 200;
  118. Statistics.disableThirdPartyRequests = false;
  119. Statistics.analytics = analytics;
  120. Object.defineProperty(Statistics, 'instances', {
  121. /**
  122. * Returns the Set holding all active {@link Statistics} instances. Lazily
  123. * initializes the Set to allow any Set polyfills to be applied.
  124. * @type {Set<Statistics>}
  125. */
  126. get() {
  127. if (!_instances) {
  128. _instances = new Set();
  129. }
  130. return _instances;
  131. }
  132. });
  133. /**
  134. * Starts collecting RTP stats for given peerconnection.
  135. * @param {TraceablePeerConnection} peerconnection
  136. */
  137. Statistics.prototype.startRemoteStats = function(peerconnection) {
  138. this.stopRemoteStats(peerconnection);
  139. try {
  140. const rtpStats
  141. = new RTPStats(
  142. peerconnection,
  143. Statistics.audioLevelsInterval,
  144. 2000,
  145. this.eventEmitter);
  146. rtpStats.start(Statistics.audioLevelsEnabled);
  147. this.rtpStatsMap.set(peerconnection.id, rtpStats);
  148. } catch (e) {
  149. logger.error(`Failed to start collecting remote statistics: ${e}`);
  150. }
  151. };
  152. Statistics.localStats = [];
  153. Statistics.startLocalStats = function(stream, callback) {
  154. if (!Statistics.audioLevelsEnabled) {
  155. return;
  156. }
  157. const localStats = new LocalStats(stream, Statistics.audioLevelsInterval,
  158. callback);
  159. this.localStats.push(localStats);
  160. localStats.start();
  161. };
  162. Statistics.prototype.addAudioLevelListener = function(listener) {
  163. if (!Statistics.audioLevelsEnabled) {
  164. return;
  165. }
  166. this.eventEmitter.on(StatisticsEvents.AUDIO_LEVEL, listener);
  167. };
  168. Statistics.prototype.removeAudioLevelListener = function(listener) {
  169. if (!Statistics.audioLevelsEnabled) {
  170. return;
  171. }
  172. this.eventEmitter.removeListener(StatisticsEvents.AUDIO_LEVEL, listener);
  173. };
  174. Statistics.prototype.addBeforeDisposedListener = function(listener) {
  175. this.eventEmitter.on(StatisticsEvents.BEFORE_DISPOSED, listener);
  176. };
  177. Statistics.prototype.removeBeforeDisposedListener = function(listener) {
  178. this.eventEmitter.removeListener(
  179. StatisticsEvents.BEFORE_DISPOSED, listener);
  180. };
  181. Statistics.prototype.addConnectionStatsListener = function(listener) {
  182. this.eventEmitter.on(StatisticsEvents.CONNECTION_STATS, listener);
  183. };
  184. Statistics.prototype.removeConnectionStatsListener = function(listener) {
  185. this.eventEmitter.removeListener(
  186. StatisticsEvents.CONNECTION_STATS,
  187. listener);
  188. };
  189. Statistics.prototype.addByteSentStatsListener = function(listener) {
  190. this.eventEmitter.on(StatisticsEvents.BYTE_SENT_STATS, listener);
  191. };
  192. Statistics.prototype.removeByteSentStatsListener = function(listener) {
  193. this.eventEmitter.removeListener(StatisticsEvents.BYTE_SENT_STATS,
  194. listener);
  195. };
  196. Statistics.prototype.dispose = function() {
  197. try {
  198. // NOTE Before reading this please see the comment in stopCallStats...
  199. //
  200. // Here we prevent from emitting the event twice in case it will be
  201. // triggered from stopCallStats.
  202. // If the event is triggered from here it means that the logs will not
  203. // be submitted anyway (because there is no CallStats instance), but
  204. // we're doing that for the sake of some kind of consistency.
  205. if (!this.callsStatsInstances.size) {
  206. this.eventEmitter.emit(StatisticsEvents.BEFORE_DISPOSED);
  207. }
  208. for (const callStats of this.callsStatsInstances.values()) {
  209. this.stopCallStats(callStats.tpc);
  210. }
  211. for (const tpcId of this.rtpStatsMap.keys()) {
  212. this._stopRemoteStats(tpcId);
  213. }
  214. if (this.eventEmitter) {
  215. this.eventEmitter.removeAllListeners();
  216. }
  217. } finally {
  218. Statistics.instances.delete(this);
  219. }
  220. };
  221. Statistics.stopLocalStats = function(stream) {
  222. if (!Statistics.audioLevelsEnabled) {
  223. return;
  224. }
  225. for (let i = 0; i < Statistics.localStats.length; i++) {
  226. if (Statistics.localStats[i].stream === stream) {
  227. const localStats = Statistics.localStats.splice(i, 1);
  228. localStats[0].stop();
  229. break;
  230. }
  231. }
  232. };
  233. /**
  234. * Stops remote RTP stats for given peerconnection ID.
  235. * @param {string} tpcId {@link TraceablePeerConnection.id}
  236. * @private
  237. */
  238. Statistics.prototype._stopRemoteStats = function(tpcId) {
  239. const rtpStats = this.rtpStatsMap.get(tpcId);
  240. if (rtpStats) {
  241. rtpStats.stop();
  242. this.rtpStatsMap.delete(tpcId);
  243. }
  244. };
  245. /**
  246. * Stops collecting RTP stats for given peerconnection
  247. * @param {TraceablePeerConnection} tpc
  248. */
  249. Statistics.prototype.stopRemoteStats = function(tpc) {
  250. this._stopRemoteStats(tpc.id);
  251. };
  252. // CALSTATS METHODS
  253. /**
  254. * Initializes the callstats.io API.
  255. * @param {TraceablePeerConnection} tpc the {@link TraceablePeerConnection}
  256. * instance for which CalStats will be started.
  257. * @param {string} remoteUserID
  258. */
  259. Statistics.prototype.startCallStats = function(tpc, remoteUserID) {
  260. if (!this.callStatsIntegrationEnabled) {
  261. return;
  262. } else if (this.callsStatsInstances.has(tpc.id)) {
  263. logger.error('CallStats instance for ${tpc} exists already');
  264. return;
  265. }
  266. if (!CallStats.isBackendInitialized()) {
  267. const userName = Settings.callStatsUserName;
  268. if (!CallStats.initBackend({
  269. callStatsID: this.options.callStatsID,
  270. callStatsSecret: this.options.callStatsSecret,
  271. userName: this.options.swapUserNameAndAlias
  272. ? this.options.callStatsAliasName : userName,
  273. aliasName: this.options.swapUserNameAndAlias
  274. ? userName : this.options.callStatsAliasName
  275. })) {
  276. // Backend initialization failed bad
  277. return;
  278. }
  279. }
  280. logger.info(`Starting CallStats for ${tpc}...`);
  281. const newInstance
  282. = new CallStats(
  283. tpc,
  284. {
  285. confID: this._getCallStatsConfID(),
  286. remoteUserID
  287. });
  288. this.callsStatsInstances.set(tpc.id, newInstance);
  289. };
  290. /**
  291. * Obtains the list of *all* {@link CallStats} instances collected from every
  292. * valid {@link Statistics} instance.
  293. * @return {Set<CallStats>}
  294. * @private
  295. */
  296. Statistics._getAllCallStatsInstances = function() {
  297. const csInstances = new Set();
  298. for (const statistics of Statistics.instances) {
  299. for (const cs of statistics.callsStatsInstances.values()) {
  300. csInstances.add(cs);
  301. }
  302. }
  303. return csInstances;
  304. };
  305. /**
  306. * Constructs the CallStats conference ID based on the options currently
  307. * configured in this instance.
  308. * @return {string}
  309. * @private
  310. */
  311. Statistics.prototype._getCallStatsConfID = function() {
  312. // The conference ID is case sensitive!!!
  313. return this.options.callStatsConfIDNamespace
  314. ? `${this.options.callStatsConfIDNamespace}/${this.options.roomName}`
  315. : this.options.roomName;
  316. };
  317. /**
  318. * Removes the callstats.io instances.
  319. */
  320. Statistics.prototype.stopCallStats = function(tpc) {
  321. const callStatsInstance = this.callsStatsInstances.get(tpc.id);
  322. if (callStatsInstance) {
  323. // FIXME the original purpose of adding BEFORE_DISPOSED event was to be
  324. // able to submit the last log batch from jitsi-meet to CallStats. After
  325. // recent changes we dispose the CallStats earlier
  326. // (before Statistics.dispose), so we need to emit this event here to
  327. // give this last chance for final log batch submission.
  328. //
  329. // Eventually there should be a separate module called "log storage"
  330. // which should emit proper events when it's underlying
  331. // CallStats instance is going away.
  332. if (this.callsStatsInstances.size === 1) {
  333. this.eventEmitter.emit(StatisticsEvents.BEFORE_DISPOSED);
  334. }
  335. this.callsStatsInstances.delete(tpc.id);
  336. // The fabric needs to be terminated when being stopped
  337. callStatsInstance.sendTerminateEvent();
  338. }
  339. };
  340. /**
  341. * Returns true if the callstats integration is enabled, otherwise returns
  342. * false.
  343. *
  344. * @returns true if the callstats integration is enabled, otherwise returns
  345. * false.
  346. */
  347. Statistics.prototype.isCallstatsEnabled = function() {
  348. return this.callStatsIntegrationEnabled;
  349. };
  350. /**
  351. * Logs either resume or hold event for the given peer connection.
  352. * @param {TraceablePeerConnection} tpc the connection for which event will be
  353. * reported
  354. * @param {boolean} isResume true for resume or false for hold
  355. */
  356. Statistics.prototype.sendConnectionResumeOrHoldEvent = function(tpc, isResume) {
  357. const instance = this.callsStatsInstances.get(tpc.id);
  358. if (instance) {
  359. instance.sendResumeOrHoldEvent(isResume);
  360. }
  361. };
  362. /**
  363. * Notifies CallStats and analytics(if present) for ice connection failed
  364. * @param {TraceablePeerConnection} tpc connection on which failure occurred.
  365. */
  366. Statistics.prototype.sendIceConnectionFailedEvent = function(tpc) {
  367. const instance = this.callsStatsInstances.get(tpc.id);
  368. if (instance) {
  369. instance.sendIceConnectionFailedEvent();
  370. }
  371. Statistics.analytics.sendEvent('connection.ice_failed');
  372. };
  373. /**
  374. * Notifies CallStats for mute events
  375. * @param {TraceablePeerConnection} tpc connection on which failure occurred.
  376. * @param {boolean} muted true for muted and false for not muted
  377. * @param {String} type "audio"/"video"
  378. */
  379. Statistics.prototype.sendMuteEvent = function(tpc, muted, type) {
  380. const instance = tpc && this.callsStatsInstances.get(tpc.id);
  381. CallStats.sendMuteEvent(muted, type, instance);
  382. };
  383. /**
  384. * Notifies CallStats for screen sharing events
  385. * @param start {boolean} true for starting screen sharing and
  386. * false for not stopping
  387. */
  388. Statistics.prototype.sendScreenSharingEvent = function(start) {
  389. for (const cs of this.callsStatsInstances.values()) {
  390. cs.sendScreenSharingEvent(start);
  391. }
  392. };
  393. /**
  394. * Notifies the statistics module that we are now the dominant speaker of the
  395. * conference.
  396. */
  397. Statistics.prototype.sendDominantSpeakerEvent = function() {
  398. for (const cs of this.callsStatsInstances.values()) {
  399. cs.sendDominantSpeakerEvent();
  400. }
  401. };
  402. /**
  403. * Notifies about active device.
  404. * @param {{deviceList: {String:String}}} devicesData - list of devices with
  405. * their data
  406. */
  407. Statistics.sendActiveDeviceListEvent = function(devicesData) {
  408. const globalSet = Statistics._getAllCallStatsInstances();
  409. if (globalSet.size) {
  410. for (const cs of globalSet) {
  411. CallStats.sendActiveDeviceListEvent(devicesData, cs);
  412. }
  413. } else {
  414. CallStats.sendActiveDeviceListEvent(devicesData, null);
  415. }
  416. };
  417. /* eslint-disable max-params */
  418. /**
  419. * Lets the underlying statistics module know where is given SSRC rendered by
  420. * providing renderer tag ID.
  421. * @param {TraceablePeerConnection} tpc the connection to which the stream
  422. * belongs to
  423. * @param {number} ssrc the SSRC of the stream
  424. * @param {boolean} isLocal
  425. * @param {string} userId
  426. * @param {string} usageLabel meaningful usage label of this stream like
  427. * 'microphone', 'camera' or 'screen'.
  428. * @param {string} containerId the id of media 'audio' or 'video' tag which
  429. * renders the stream.
  430. */
  431. Statistics.prototype.associateStreamWithVideoTag = function(
  432. tpc,
  433. ssrc,
  434. isLocal,
  435. userId,
  436. usageLabel,
  437. containerId) {
  438. const instance = this.callsStatsInstances.get(tpc.id);
  439. if (instance) {
  440. instance.associateStreamWithVideoTag(
  441. ssrc,
  442. isLocal,
  443. userId,
  444. usageLabel,
  445. containerId);
  446. }
  447. };
  448. /* eslint-enable max-params */
  449. /**
  450. * Notifies CallStats that getUserMedia failed.
  451. *
  452. * @param {Error} e error to send
  453. */
  454. Statistics.sendGetUserMediaFailed = function(e) {
  455. const error
  456. = e instanceof JitsiTrackError
  457. ? formatJitsiTrackErrorForCallStats(e) : e;
  458. const globalSet = Statistics._getAllCallStatsInstances();
  459. if (globalSet.size) {
  460. for (const cs of globalSet) {
  461. CallStats.sendGetUserMediaFailed(error, cs);
  462. }
  463. } else {
  464. CallStats.sendGetUserMediaFailed(error, null);
  465. }
  466. };
  467. /**
  468. * Notifies CallStats that peer connection failed to create offer.
  469. *
  470. * @param {Error} e error to send
  471. * @param {TraceablePeerConnection} tpc connection on which failure occurred.
  472. */
  473. Statistics.prototype.sendCreateOfferFailed = function(e, tpc) {
  474. const instance = this.callsStatsInstances.get(tpc.id);
  475. if (instance) {
  476. instance.sendCreateOfferFailed(e);
  477. }
  478. };
  479. /**
  480. * Notifies CallStats that peer connection failed to create answer.
  481. *
  482. * @param {Error} e error to send
  483. * @param {TraceablePeerConnection} tpc connection on which failure occured.
  484. */
  485. Statistics.prototype.sendCreateAnswerFailed = function(e, tpc) {
  486. const instance = this.callsStatsInstances.get(tpc.id);
  487. if (instance) {
  488. instance.sendCreateAnswerFailed(e);
  489. }
  490. };
  491. /**
  492. * Notifies CallStats that peer connection failed to set local description.
  493. *
  494. * @param {Error} e error to send
  495. * @param {TraceablePeerConnection} tpc connection on which failure occurred.
  496. */
  497. Statistics.prototype.sendSetLocalDescFailed = function(e, tpc) {
  498. const instance = this.callsStatsInstances.get(tpc.id);
  499. if (instance) {
  500. instance.sendSetLocalDescFailed(e);
  501. }
  502. };
  503. /**
  504. * Notifies CallStats that peer connection failed to set remote description.
  505. *
  506. * @param {Error} e error to send
  507. * @param {TraceablePeerConnection} tpc connection on which failure occurred.
  508. */
  509. Statistics.prototype.sendSetRemoteDescFailed = function(e, tpc) {
  510. const instance = this.callsStatsInstances.get(tpc.id);
  511. if (instance) {
  512. instance.sendSetRemoteDescFailed(e);
  513. }
  514. };
  515. /**
  516. * Notifies CallStats that peer connection failed to add ICE candidate.
  517. *
  518. * @param {Error} e error to send
  519. * @param {TraceablePeerConnection} tpc connection on which failure occurred.
  520. */
  521. Statistics.prototype.sendAddIceCandidateFailed = function(e, tpc) {
  522. const instance = this.callsStatsInstances.get(tpc.id);
  523. if (instance) {
  524. instance.sendAddIceCandidateFailed(e);
  525. }
  526. };
  527. /**
  528. * Adds to CallStats an application log.
  529. *
  530. * @param {String} m a log message to send or an {Error} object to be reported
  531. */
  532. Statistics.sendLog = function(m) {
  533. const globalSubSet = new Set();
  534. // FIXME we don't want to duplicate logs over P2P instance, but
  535. // here we should go over instances and call this method for each
  536. // unique conference ID rather than selecting the first one.
  537. // We don't have such use case though, so leaving as is for now.
  538. for (const stats of Statistics.instances) {
  539. if (stats.callsStatsInstances.size) {
  540. globalSubSet.add(stats.callsStatsInstances.values().next().value);
  541. }
  542. }
  543. if (globalSubSet.size) {
  544. for (const csPerStats of globalSubSet) {
  545. CallStats.sendApplicationLog(m, csPerStats);
  546. }
  547. } else {
  548. CallStats.sendApplicationLog(m, null);
  549. }
  550. };
  551. /**
  552. * Sends the given feedback through CallStats.
  553. *
  554. * @param overall an integer between 1 and 5 indicating the user feedback
  555. * @param detailed detailed feedback from the user. Not yet used
  556. */
  557. Statistics.prototype.sendFeedback = function(overall, detailed) {
  558. CallStats.sendFeedback(this._getCallStatsConfID(), overall, detailed);
  559. Statistics.analytics.sendEvent('feedback.rating',
  560. { value: overall,
  561. detailed });
  562. };
  563. Statistics.LOCAL_JID = require('../../service/statistics/constants').LOCAL_JID;
  564. /**
  565. * Reports global error to CallStats.
  566. *
  567. * @param {Error} error
  568. */
  569. Statistics.reportGlobalError = function(error) {
  570. if (error instanceof JitsiTrackError && error.gum) {
  571. Statistics.sendGetUserMediaFailed(error);
  572. } else {
  573. Statistics.sendLog(error);
  574. }
  575. };
  576. /**
  577. * Sends event to analytics and callstats.
  578. * @param {string} eventName the event name.
  579. * @param {Object} data the data to be sent.
  580. */
  581. Statistics.sendEventToAll = function(eventName, data) {
  582. this.analytics.sendEvent(eventName, data);
  583. Statistics.sendLog(JSON.stringify({ name: eventName,
  584. data }));
  585. };