This reverts commit 5e2b652690.
This commit is contained in:
@@ -31,7 +31,6 @@ import {
|
||||
UndecryptableToDeviceEventTracker,
|
||||
QualitySurveyEventTracker,
|
||||
CallDisconnectedEventTracker,
|
||||
CallConnectDurationTracker,
|
||||
} from "./PosthogEvents";
|
||||
import { Config } from "../config/Config";
|
||||
import { getUrlParams } from "../UrlParams";
|
||||
@@ -445,5 +444,4 @@ export class PosthogAnalytics {
|
||||
public eventUndecryptableToDevice = new UndecryptableToDeviceEventTracker();
|
||||
public eventQualitySurvey = new QualitySurveyEventTracker();
|
||||
public eventCallDisconnected = new CallDisconnectedEventTracker();
|
||||
public eventCallConnectDuration = new CallConnectDurationTracker();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
import { DisconnectReason } from "livekit-client";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
import {
|
||||
IPosthogEvent,
|
||||
@@ -202,38 +201,3 @@ export class CallDisconnectedEventTracker {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
interface CallConnectDuration extends IPosthogEvent {
|
||||
eventName: "CallConnectDuration";
|
||||
totalDuration: number;
|
||||
websocketDuration: number;
|
||||
peerConnectionDuration: number;
|
||||
}
|
||||
|
||||
export class CallConnectDurationTracker {
|
||||
private connectStart = 0;
|
||||
private websocketConnected = 0;
|
||||
public cacheConnectStart(): void {
|
||||
this.connectStart = Date.now();
|
||||
}
|
||||
public cacheWsConnect(): void {
|
||||
this.websocketConnected = Date.now();
|
||||
}
|
||||
|
||||
public track(options = { log: false }): void {
|
||||
const now = Date.now();
|
||||
const totalDuration = now - this.connectStart;
|
||||
const websocketDuration = this.websocketConnected - this.connectStart;
|
||||
const peerConnectionDuration = now - this.websocketConnected;
|
||||
PosthogAnalytics.instance.trackEvent<CallConnectDuration>({
|
||||
eventName: "CallConnectDuration",
|
||||
totalDuration,
|
||||
websocketDuration,
|
||||
peerConnectionDuration,
|
||||
});
|
||||
if (options.log)
|
||||
logger.log(
|
||||
`Time to connect:\ntotal: ${totalDuration}ms\npeerConnection: ${websocketDuration}ms\nwebsocket: ${peerConnectionDuration}ms`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ import { logger } from "matrix-js-sdk/src/logger";
|
||||
import * as Sentry from "@sentry/react";
|
||||
|
||||
import { SFUConfig, sfuConfigEquals } from "./openIDSFU";
|
||||
import { PosthogAnalytics } from "../analytics/PosthogAnalytics";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
@@ -132,11 +131,6 @@ async function connectAndPublish(
|
||||
micTrack: LocalTrack | undefined,
|
||||
screenshareTracks: MediaStreamTrack[],
|
||||
): Promise<void> {
|
||||
const tracker = PosthogAnalytics.instance.eventCallConnectDuration;
|
||||
// Track call connect duration
|
||||
tracker.cacheConnectStart();
|
||||
livekitRoom.once(RoomEvent.SignalConnected, () => tracker.cacheWsConnect());
|
||||
|
||||
await livekitRoom!.connect(sfuConfig!.url, sfuConfig!.jwt, {
|
||||
// Due to stability issues on Firefox we are testing the effect of different
|
||||
// timeouts, and allow these values to be set through the console
|
||||
@@ -144,10 +138,6 @@ async function connectAndPublish(
|
||||
websocketTimeout: window.websocketTimeout ?? 45000,
|
||||
});
|
||||
|
||||
// remove listener in case the connect promise rejects before `SignalConnected` is emitted.
|
||||
livekitRoom.off(RoomEvent.SignalConnected, tracker.cacheWsConnect);
|
||||
tracker.track({ log: true });
|
||||
|
||||
if (micTrack) {
|
||||
logger.info(`Publishing precreated mic track`);
|
||||
await livekitRoom.localParticipant.publishTrack(micTrack, {
|
||||
|
||||
Reference in New Issue
Block a user