Skip to content

Commit

Permalink
Add openreplay (#4685)
Browse files Browse the repository at this point in the history
* Add openreplay

* Add env variables for openreplay

* Add openreplay env for k8s
  • Loading branch information
jamakase authored and gl-pix committed Jul 22, 2021
1 parent a92554d commit 4eecba3
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 1 deletion.
1 change: 1 addition & 0 deletions airbyte-webapp/nginx/default.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ server {
window.TRACKING_STRATEGY = "$TRACKING_STRATEGY";
window.PAPERCUPS_STORYTIME = "$PAPERCUPS_STORYTIME";
window.FULLSTORY = "$FULLSTORY";
window.OPENREPLAY = "$OPENREPLAY";
window.AIRBYTE_VERSION = "$AIRBYTE_VERSION";
window.API_URL = "$API_URL";
window.IS_DEMO = "$IS_DEMO";
Expand Down
8 changes: 8 additions & 0 deletions airbyte-webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions airbyte-webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@fortawesome/free-solid-svg-icons": "^5.12.1",
"@fortawesome/react-fontawesome": "^0.1.8",
"@fullstory/browser": "^1.4.9",
"@openreplay/tracker": "^3.0.5",
"@papercups-io/chat-widget": "^1.1.5",
"@papercups-io/storytime": "^1.0.6",
"@rest-hooks/legacy": "^2.0.5",
Expand Down
16 changes: 16 additions & 0 deletions airbyte-webapp/src/components/hooks/useOpenReplay.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { useMemo } from "react";
import OpenReplay from "@openreplay/tracker";

const useOpenReplay = (projectKey: string): OpenReplay => {
return useMemo(() => {
const tracker = new OpenReplay({
projectKey: projectKey,
});

tracker.start();

return tracker;
}, [projectKey]);
};

export default useOpenReplay;
7 changes: 7 additions & 0 deletions airbyte-webapp/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ declare global {
TRACKING_STRATEGY?: string;
PAPERCUPS_STORYTIME?: string;
FULLSTORY?: string;
OPENREPLAY?: string;
AIRBYTE_VERSION?: string;
API_URL?: string;
IS_DEMO?: string;
Expand All @@ -32,6 +33,9 @@ type Config = {
baseUrl: string;
enableStorytime: boolean;
};
openreplay: {
projectKey: string;
};
fullstory: Fullstory.SnippetOptions;
apiUrl: string;
healthCheckInterval: number;
Expand Down Expand Up @@ -67,6 +71,9 @@ const config: Config = {
baseUrl: "https://app.papercups.io",
enableStorytime: window.PAPERCUPS_STORYTIME !== "disabled",
},
openreplay: {
projectKey: window.OPENREPLAY !== "disabled" ? "6611843272536134" : "",
},
fullstory: {
orgId: "13AXQ4",
devMode: window.FULLSTORY === "disabled",
Expand Down
5 changes: 4 additions & 1 deletion airbyte-webapp/src/pages/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import useWorkspace from "components/hooks/services/useWorkspaceHook";
import { AnalyticsService } from "core/analytics/AnalyticsService";
import { useNotificationService } from "components/hooks/services/Notification/NotificationService";
import { useApiHealthPoll } from "components/hooks/services/Health";
import useOpenReplay from "../components/hooks/useOpenReplay";

export enum Routes {
Preferences = "/preferences",
Expand Down Expand Up @@ -160,15 +161,17 @@ const OnboardingsRoutes = () => {
};

export const Routing: React.FC = () => {
useApiHealthPoll(config.healthCheckInterval);
useSegment(config.segment.token);
useFullStory(config.fullstory);
useApiHealthPoll(config.healthCheckInterval);
const tracker = useOpenReplay(config.openreplay.projectKey);

const { workspace } = useWorkspace();

useEffect(() => {
if (workspace) {
AnalyticsService.identify(workspace.customerId);
tracker.setUserID(workspace.customerId);
}
}, [workspace]);

Expand Down
1 change: 1 addition & 0 deletions kube/overlays/dev/.env
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ INTERNAL_API_HOST=airbyte-server-svc:8001
WORKER_ENVIRONMENT=kubernetes
PAPERCUPS_STORYTIME=disabled
FULLSTORY=disabled
OPENREPLAY=disabled
IS_DEMO=false
LOG_LEVEL=INFO

Expand Down
1 change: 1 addition & 0 deletions kube/overlays/stable-with-resource-limits/.env
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ INTERNAL_API_HOST=airbyte-server-svc:8001
WORKER_ENVIRONMENT=kubernetes
PAPERCUPS_STORYTIME=enabled
FULLSTORY=enabled
OPENREPLAY=enabled
IS_DEMO=false
LOG_LEVEL=INFO

Expand Down
1 change: 1 addition & 0 deletions kube/overlays/stable/.env
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ INTERNAL_API_HOST=airbyte-server-svc:8001
WORKER_ENVIRONMENT=kubernetes
PAPERCUPS_STORYTIME=enabled
FULLSTORY=enabled
OPENREPLAY=enabled
IS_DEMO=false
LOG_LEVEL=INFO

Expand Down
5 changes: 5 additions & 0 deletions kube/resources/webapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ spec:
configMapKeyRef:
name: airbyte-env
key: FULLSTORY
- name: OPENREPLAY
valueFrom:
configMapKeyRef:
name: airbyte-env
key: OPENREPLAY
- name: IS_DEMO
valueFrom:
configMapKeyRef:
Expand Down

0 comments on commit 4eecba3

Please sign in to comment.