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 1 commit
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
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;
6 changes: 6 additions & 0 deletions airbyte-webapp/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ type Config = {
baseUrl: string;
enableStorytime: boolean;
};
openreplay: {
projectKey: string;
};
fullstory: Fullstory.SnippetOptions;
apiUrl: string;
healthCheckInterval: number;
Expand Down Expand Up @@ -65,6 +68,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: "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 @@ -27,6 +27,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 @@ -152,15 +153,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