Created
July 29, 2021 18:26
-
-
Save jasonLaster/d4f3799067e95809e8170a7a00f0ab40 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/protocol/socket.ts b/src/protocol/socket.ts | |
index 00bb62d4..0be7f19c 100644 | |
--- a/src/protocol/socket.ts | |
+++ b/src/protocol/socket.ts | |
@@ -63,7 +63,7 @@ export function initSocket(store: UIStore, address?: string) { | |
socket.onmessage = makeInfallible(onSocketMessage); | |
} | |
-export function sendMessage<M extends CommandMethods>( | |
+export function sendMessage<M extends CommandMethods>(f | |
method: M, | |
params: CommandParams<M>, | |
sessionId?: SessionId, | |
diff --git a/src/ui/utils/telemetry.ts b/src/ui/utils/telemetry.ts | |
index 1b11d229..12eaabaf 100644 | |
--- a/src/ui/utils/telemetry.ts | |
+++ b/src/ui/utils/telemetry.ts | |
@@ -34,11 +34,14 @@ export function setupTelemetry(context: Record<string, any>) { | |
Sentry.setContext("recording", { ...context, url: window.location.href }); | |
} | |
+let user; | |
+ | |
export function setTelemetryContext( | |
userId: string | undefined, | |
userEmail: string | undefined, | |
isInternal: boolean | |
) { | |
+ user = { userId, userEmail, isInternal }; | |
Sentry.setTag("userInternal", isInternal); | |
if (userId && userEmail) { | |
Sentry.setUser({ id: userId, email: userEmail }); | |
@@ -67,7 +70,7 @@ export async function sendTelemetryEvent(event: string, tags: any = {}) { | |
headers: { | |
"Content-Type": "application/json", | |
}, | |
- body: JSON.stringify({ event, ...tags }), | |
+ body: JSON.stringify({ event, ...tags, user }), | |
}); | |
if (!response.ok) { | |
console.error(`Sent telemetry event ${event} but got status code ${response.status}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment