Skip to content

Commit

Permalink
[platform] Remove logrocket and fullstory
Browse files Browse the repository at this point in the history
We have posthog now

Change-Id: I4d766dc0fe8e6fd0ace80135c96bcb2ddf24fb29
GitOrigin-RevId: 65d6dc98423ca4d94dc1c041ff1fbb3318a1f73f
  • Loading branch information
jaslong authored and Copybara committed Jun 21, 2024
1 parent edc62c4 commit 5395f83
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 117 deletions.
1 change: 0 additions & 1 deletion platform/wab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"loglevel": "^1.6.8",
"logrocket": "^1.0.9",
"lusca": "^1.6.1",
"memoize-one": "^6.0.0",
"mime": "^2.4.6",
Expand Down
3 changes: 0 additions & 3 deletions platform/wab/src/wab/client/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import * as Sentry from "@sentry/browser";
import { proxy, ProxyMarked } from "comlink";
import $ from "jquery";
import L, { pick } from "lodash";
import LogRocket from "logrocket";
import io, { Socket } from "socket.io-client";

const fullApiPath = (url: /*TWZ*/ string) => `/api/v1/${L.trimStart(url, "/")}`;
Expand Down Expand Up @@ -154,7 +153,6 @@ export class Api extends SharedApi {
Sentry.configureScope((scope) => {
scope.setUser({});
});
LogRocket.startNewSession();
}

async req(
Expand Down Expand Up @@ -657,7 +655,6 @@ export function setUser(user: ApiUser) {
Sentry.configureScope((scope) => {
scope.setUser({ id, ...traits });
});
LogRocket.identify(id, traits);
}

export function invalidationKey(method: string, ...args: any[]) {
Expand Down
88 changes: 0 additions & 88 deletions platform/wab/src/wab/client/components/Shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import {
CustomError,
hackyCast,
isLiteralObject,
mkUuid,
stampObjectUuid,
swallow,
tuple,
withoutFalsy,
Expand All @@ -31,7 +29,6 @@ import { UserError } from "@/wab/shared/UserError";
import * as Sentry from "@sentry/browser";
import * as Integrations from "@sentry/integrations";
import { createBrowserHistory } from "history";
import LogRocket from "logrocket";
import { onReactionError } from "mobx";
import posthog from "posthog-js";
import * as React from "react";
Expand Down Expand Up @@ -118,27 +115,6 @@ export function main() {

applyDevFlagOverrides(DEVFLAGS, initClientFlags(DEVFLAGS));

if (DEVFLAGS.useLogrocket) {
hackyCast(window).useLogrocket = true;
type Payload = { body?: string };
const sanitizer = function <T extends Payload>(payload: T): T {
if (payload.body && payload.body.length > 999) {
payload.body = JSON.stringify({
length: payload.body.length,
snip: `${payload.body.slice(0, 500)}..${payload.body.slice(-400)}`,
});
}
return payload;
};
LogRocket.init("dl8waw/plasmic", {
mergeIframes: true,
network: {
requestSanitizer: sanitizer,
responseSanitizer: sanitizer,
},
});
}

if (DeploymentFlags.DEPLOYENV === "production") {
if (DEVFLAGS.posthog) {
posthog.init("phc_eaI1hFsPRIZkmwrXaSGRNDh4H9J3xdh1j9rgNy27NgP");
Expand Down Expand Up @@ -224,70 +200,6 @@ export function main() {
event.tags.tier = getMaximumTier(userTiers);
}

//
// Record FullStory session ID.
// Adapted from https://gist.github.com/patrick-fs/8066c2a0c97aec6cca6d355a55a52506
// via https://github.com/getsentry/sentry-fullstory/issues/30
//

const _fs = hackyCast(window[hackyCast(window)._fs_namespace]);
// getCurrentSessionURL isn't available until after the FullStory script is fully bootstrapped.
// If an error occurs before getCurrentSessionURL is ready, make a note in Sentry and move on.
// More on getCurrentSessionURL here: https://help.fullstory.com/develop-js/getcurrentsessionurl
event.extra.fullstory =
typeof _fs !== "function"
? "FullStory is not installed"
: typeof _fs.getCurrentSessionURL === "function"
? _fs.getCurrentSessionURL(true)
: "current session URL API not ready";

//
// Record LogRocket session ID (including timestamp).
//

const logRocketSession = LogRocket.sessionURL;
if (logRocketSession) {
event.extra.LogRocket = logRocketSession;
}

if (hint) {
//
// Tag the error with a UUID. This is usually read later by
// handleError which reports it in analytics.track().
//

const uuid = hint.originalException
? stampObjectUuid(hint.originalException)
: mkUuid();
if (!event.tags) {
event.tags = {};
}
event.tags.plasmicErrorUuid = uuid;

// This originally tracks the Sentry ID to FS, but we are already
// calling analytics.track() in handleError(). But that doesn't
// have the Sentry event_id, which we have only here in
// beforeSend. We might want to merge the two somehow and ensure
// analytics.track() has the Sentry event_id (or even some
// kind of unique Segment event ID?).
const error = hint.originalException;
if (
0 / 1 &&
typeof _fs === "function" &&
error &&
error instanceof Error
) {
// FS.event is immediately ready even if FullStory isn't fully bootstrapped
_fs.event("Application error", {
name: error.name,
message: error.message,
fileName: hackyCast(error).fileName,
sentryEventId: hint.event_id,
sentryUrl: `https://sentry.io/organizations/${sentryOrgId}/issues/?project=${sentryProjId}&query=${hint.event_id}`,
});
}
}

return event;
},
});
Expand Down
9 changes: 0 additions & 9 deletions platform/wab/src/wab/client/frame-ctx/top-frame-ctx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,6 @@ export function TopFrameCtxProvider({
topFrameApi.registerLocationListener(locationListener)
);
},

toJSON() {
// When we do console.log(studioCtx) in the inner frame, fullstory
// tries to jsonify studioCtx, converting all descendant objects
// into json to record in fullstory, eventually calling api.toJSON().
// So we add that method here to prevent comlink from trying to call a
// non-existent function on our API object.
return "API";
},
} as TopFrameFullApi;
Comlink.expose(topFrameCtxApi, {
...hostFrameEndpoint,
Expand Down
2 changes: 0 additions & 2 deletions platform/wab/src/wab/client/tracking.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import L from "lodash";
import LogRocket from "logrocket";
import { useEffect } from "react";

const reservedProps = [
Expand Down Expand Up @@ -40,7 +39,6 @@ export function trackEvent(eventName: string, eventData?: any) {
}
}
analytics.track(eventName, eventData);
LogRocket.track(eventName);
}

export function useTracking() {
Expand Down
1 change: 0 additions & 1 deletion platform/wab/src/wab/devflags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,6 @@ const DEFAULT_DEVFLAGS = {
uncatchErrors: false,
// Prefers loading state over expression fallback
useLoadingState: false,
useLogrocket: false,
showHiddenHostLessComponents: false,
ccStubs: false,
workspaces: false,
Expand Down
8 changes: 0 additions & 8 deletions platform/wab/tools/studio-html-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,6 @@ export class StudioHtmlPlugin implements RspackPluginInstance {
`<script id="ReactDevToolsScript" crossorigin="anonymous"></script>` // Replaced in studio.js
);

// Specify that this iframe is the outermost root of the FullStory recording.
root
.querySelector("head")
.insertAdjacentHTML(
"afterbegin",
`<script>window['_fs_is_outer_script'] = true;</script>`
);

// Allow our instrumentation to run when the host URL uses HTTP
root
.querySelector("head")
Expand Down
5 changes: 0 additions & 5 deletions platform/wab/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18305,11 +18305,6 @@ loglevel@^1.6.8:
resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.7.1.tgz#005fde2f5e6e47068f935ff28573e125ef72f197"
integrity sha512-Hesni4s5UkWkwCGJMQGAh71PaLUmKFM60dHvq0zi/vDhhrzuk+4GgNbTXJ12YYQJn6ZKBDNIjYcuQGKudvqrIw==

logrocket@^1.0.9:
version "1.0.14"
resolved "https://registry.yarnpkg.com/logrocket/-/logrocket-1.0.14.tgz#afe61a6b993691a706154e83fe2c05e8174a650d"
integrity sha512-notwwiIiXOmWSKQDsW8UrFJPu81u9rd6YaIFBmx6uF0XtXXwNQ+Mvteh5WHdABWcQ2nN4I7QkQrCAocYDx7OVg==

loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1, loose-envify@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
Expand Down

0 comments on commit 5395f83

Please sign in to comment.