Skip to content

Commit 4eecba3

Browse files
jamakasegl-pix
authored andcommitted
Add openreplay (#4685)
* Add openreplay * Add env variables for openreplay * Add openreplay env for k8s
1 parent a92554d commit 4eecba3

File tree

10 files changed

+45
-1
lines changed

10 files changed

+45
-1
lines changed

airbyte-webapp/nginx/default.conf.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ server {
1919
window.TRACKING_STRATEGY = "$TRACKING_STRATEGY";
2020
window.PAPERCUPS_STORYTIME = "$PAPERCUPS_STORYTIME";
2121
window.FULLSTORY = "$FULLSTORY";
22+
window.OPENREPLAY = "$OPENREPLAY";
2223
window.AIRBYTE_VERSION = "$AIRBYTE_VERSION";
2324
window.API_URL = "$API_URL";
2425
window.IS_DEMO = "$IS_DEMO";

airbyte-webapp/package-lock.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

airbyte-webapp/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"@fortawesome/free-solid-svg-icons": "^5.12.1",
1717
"@fortawesome/react-fontawesome": "^0.1.8",
1818
"@fullstory/browser": "^1.4.9",
19+
"@openreplay/tracker": "^3.0.5",
1920
"@papercups-io/chat-widget": "^1.1.5",
2021
"@papercups-io/storytime": "^1.0.6",
2122
"@rest-hooks/legacy": "^2.0.5",
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { useMemo } from "react";
2+
import OpenReplay from "@openreplay/tracker";
3+
4+
const useOpenReplay = (projectKey: string): OpenReplay => {
5+
return useMemo(() => {
6+
const tracker = new OpenReplay({
7+
projectKey: projectKey,
8+
});
9+
10+
tracker.start();
11+
12+
return tracker;
13+
}, [projectKey]);
14+
};
15+
16+
export default useOpenReplay;

airbyte-webapp/src/config/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ declare global {
66
TRACKING_STRATEGY?: string;
77
PAPERCUPS_STORYTIME?: string;
88
FULLSTORY?: string;
9+
OPENREPLAY?: string;
910
AIRBYTE_VERSION?: string;
1011
API_URL?: string;
1112
IS_DEMO?: string;
@@ -32,6 +33,9 @@ type Config = {
3233
baseUrl: string;
3334
enableStorytime: boolean;
3435
};
36+
openreplay: {
37+
projectKey: string;
38+
};
3539
fullstory: Fullstory.SnippetOptions;
3640
apiUrl: string;
3741
healthCheckInterval: number;
@@ -67,6 +71,9 @@ const config: Config = {
6771
baseUrl: "https://app.papercups.io",
6872
enableStorytime: window.PAPERCUPS_STORYTIME !== "disabled",
6973
},
74+
openreplay: {
75+
projectKey: window.OPENREPLAY !== "disabled" ? "6611843272536134" : "",
76+
},
7077
fullstory: {
7178
orgId: "13AXQ4",
7279
devMode: window.FULLSTORY === "disabled",

airbyte-webapp/src/pages/routes.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import useWorkspace from "components/hooks/services/useWorkspaceHook";
2626
import { AnalyticsService } from "core/analytics/AnalyticsService";
2727
import { useNotificationService } from "components/hooks/services/Notification/NotificationService";
2828
import { useApiHealthPoll } from "components/hooks/services/Health";
29+
import useOpenReplay from "../components/hooks/useOpenReplay";
2930

3031
export enum Routes {
3132
Preferences = "/preferences",
@@ -160,15 +161,17 @@ const OnboardingsRoutes = () => {
160161
};
161162

162163
export const Routing: React.FC = () => {
164+
useApiHealthPoll(config.healthCheckInterval);
163165
useSegment(config.segment.token);
164166
useFullStory(config.fullstory);
165-
useApiHealthPoll(config.healthCheckInterval);
167+
const tracker = useOpenReplay(config.openreplay.projectKey);
166168

167169
const { workspace } = useWorkspace();
168170

169171
useEffect(() => {
170172
if (workspace) {
171173
AnalyticsService.identify(workspace.customerId);
174+
tracker.setUserID(workspace.customerId);
172175
}
173176
}, [workspace]);
174177

kube/overlays/dev/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ INTERNAL_API_HOST=airbyte-server-svc:8001
3535
WORKER_ENVIRONMENT=kubernetes
3636
PAPERCUPS_STORYTIME=disabled
3737
FULLSTORY=disabled
38+
OPENREPLAY=disabled
3839
IS_DEMO=false
3940
LOG_LEVEL=INFO
4041

kube/overlays/stable-with-resource-limits/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ INTERNAL_API_HOST=airbyte-server-svc:8001
3535
WORKER_ENVIRONMENT=kubernetes
3636
PAPERCUPS_STORYTIME=enabled
3737
FULLSTORY=enabled
38+
OPENREPLAY=enabled
3839
IS_DEMO=false
3940
LOG_LEVEL=INFO
4041

kube/overlays/stable/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ INTERNAL_API_HOST=airbyte-server-svc:8001
3535
WORKER_ENVIRONMENT=kubernetes
3636
PAPERCUPS_STORYTIME=enabled
3737
FULLSTORY=enabled
38+
OPENREPLAY=enabled
3839
IS_DEMO=false
3940
LOG_LEVEL=INFO
4041

kube/resources/webapp.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ spec:
5353
configMapKeyRef:
5454
name: airbyte-env
5555
key: FULLSTORY
56+
- name: OPENREPLAY
57+
valueFrom:
58+
configMapKeyRef:
59+
name: airbyte-env
60+
key: OPENREPLAY
5661
- name: IS_DEMO
5762
valueFrom:
5863
configMapKeyRef:

0 commit comments

Comments
 (0)