Browse Source

feat(p2p): log analytics event

Log when P2P succeeds or fails. Also log when a conference switches
back to the JVB connection.
dev1
paweldomas 8 years ago
parent
commit
5c1913f9da
1 changed files with 13 additions and 0 deletions
  1. 13
    0
      JitsiConference.js

+ 13
- 0
JitsiConference.js View File

@@ -1839,6 +1839,9 @@ JitsiConference.prototype._onIceConnectionFailed = function(session) {
1839 1839
     // We do nothing for the JVB connection, because it's up to the Jicofo to
1840 1840
     // eventually come up with the new offer (at least for the time being).
1841 1841
     if (session.isP2P) {
1842
+        if (this.p2pJingleSession && this.p2pJingleSession.isInitiator) {
1843
+            Statistics.sendEventToAll('p2p.ice_failed');
1844
+        }
1842 1845
         this._stopP2PSession('connectivity-error', 'ICE FAILED');
1843 1846
     }
1844 1847
 };
@@ -1963,6 +1966,11 @@ JitsiConference.prototype._onIceConnectionEstablished
1963 1966
     // Start remote stats
1964 1967
     logger.info('Starting remote stats with p2p connection');
1965 1968
     this._startRemoteStats();
1969
+
1970
+    // Log the P2P established event
1971
+    if (this.p2pJingleSession.isInitiator) {
1972
+        Statistics.sendEventToAll('p2p.established');
1973
+    }
1966 1974
 };
1967 1975
 
1968 1976
 /**
@@ -2184,6 +2192,11 @@ JitsiConference.prototype._maybeStartOrStopP2P = function(userLeftEvent) {
2184 2192
         }
2185 2193
     } else if (isModerator && this.p2pJingleSession && !shouldBeInP2P) {
2186 2194
         logger.info(`Will stop P2P with: ${this.p2pJingleSession.peerjid}`);
2195
+
2196
+        // Log that there will be a switch back to the JVB connection
2197
+        if (this.p2pJingleSession.isInitiator && peerCount > 1) {
2198
+            Statistics.sendEventToAll('p2p.switch_to_jvb');
2199
+        }
2187 2200
         this._stopP2PSession();
2188 2201
     }
2189 2202
 };

Loading…
Cancel
Save