Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add openreplay #4685

Merged
merged 4 commits into from
Jul 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -31,6 +32,9 @@ type Config = {
baseUrl: string;
enableStorytime: boolean;
};
openreplay: {
projectKey: string;
};
fullstory: Fullstory.SnippetOptions;
apiUrl: string;
healthCheckInterval: number;
Expand Down Expand Up @@ -65,6 +69,9 @@ const config: Config = {
baseUrl: "https://app.papercups.io",
enableStorytime: window.PAPERCUPS_STORYTIME !== "disabled",
},
openreplay: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to do anything to keep this disabled while in dev mode?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added env variables for k8s here same as for Fullstory

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 @@ -33,6 +33,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 @@ -33,6 +33,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 @@ -33,6 +33,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