Added sentry logging.

This commit is contained in:
Patrick Fic
2021-02-24 12:27:08 -08:00
parent 7f02c130a2
commit 970fe5f9b7
5 changed files with 220 additions and 8 deletions

193
client/package-lock.json generated
View File

@@ -11,6 +11,8 @@
"@apollo/client": "^3.3.11",
"@fingerprintjs/fingerprintjs": "^3.0.6",
"@lourenci/react-kanban": "^2.1.0",
"@sentry/react": "^6.2.0",
"@sentry/tracing": "^6.2.0",
"@stripe/react-stripe-js": "^1.2.2",
"@stripe/stripe-js": "^1.12.1",
"@tanem/react-nprogress": "^3.0.56",
@@ -3084,6 +3086,115 @@
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz",
"integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw=="
},
"node_modules/@sentry/browser": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-6.2.0.tgz",
"integrity": "sha512-4r3paHcHXLemj471BtNDhUs2kvJxk5XDRplz1dbC/LHXN5PWEXP4anhGILxOlxqi4y33r53PIZu3xXFjznaVZA==",
"dependencies": {
"@sentry/core": "6.2.0",
"@sentry/types": "6.2.0",
"@sentry/utils": "6.2.0",
"tslib": "^1.9.3"
},
"engines": {
"node": ">=6"
}
},
"node_modules/@sentry/core": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-6.2.0.tgz",
"integrity": "sha512-oTr2b25l+0bv/+d6IgMamPuGleWV7OgJb0NFfd+WZhw6UDRgr7CdEJy2gW6tK8SerwXgPHdn4ervxsT3WIBiXw==",
"dependencies": {
"@sentry/hub": "6.2.0",
"@sentry/minimal": "6.2.0",
"@sentry/types": "6.2.0",
"@sentry/utils": "6.2.0",
"tslib": "^1.9.3"
},
"engines": {
"node": ">=6"
}
},
"node_modules/@sentry/hub": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-6.2.0.tgz",
"integrity": "sha512-BDTEFK8vlJydWXp/KMX0stvv73V7od224iLi+w3k7BcPwMKXBuURBXPU8d5XIC4G8nwg8X6cnDvwL+zBBlBbkg==",
"dependencies": {
"@sentry/types": "6.2.0",
"@sentry/utils": "6.2.0",
"tslib": "^1.9.3"
},
"engines": {
"node": ">=6"
}
},
"node_modules/@sentry/minimal": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-6.2.0.tgz",
"integrity": "sha512-haxsx8/ZafhZUaGeeMtY7bJt9HbDlqeiaXrRMp1CxGtd0ZRQwHt60imEjl6IH1I73SEWxNfqScGsX2s3HzztMg==",
"dependencies": {
"@sentry/hub": "6.2.0",
"@sentry/types": "6.2.0",
"tslib": "^1.9.3"
},
"engines": {
"node": ">=6"
}
},
"node_modules/@sentry/react": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@sentry/react/-/react-6.2.0.tgz",
"integrity": "sha512-Jf3s7om1iLpApkN26O7c3Ult3lS91ekZNC4WKtcPb6b+KOBQ36sB0d1KhL3hGZ55UKLmgZu3jn2hd7bJ9EY3yA==",
"dependencies": {
"@sentry/browser": "6.2.0",
"@sentry/minimal": "6.2.0",
"@sentry/types": "6.2.0",
"@sentry/utils": "6.2.0",
"hoist-non-react-statics": "^3.3.2",
"tslib": "^1.9.3"
},
"engines": {
"node": ">=6"
},
"peerDependencies": {
"react": "15.x || 16.x || 17.x"
}
},
"node_modules/@sentry/tracing": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-6.2.0.tgz",
"integrity": "sha512-pzgM1dePPJysVnzaFCMp+BKtjM5q46HZeyShiR+KcQYvneD3fmUPJigDkkcsB2DcrY3mFvDcswjoqxaTIW7ZBQ==",
"dependencies": {
"@sentry/hub": "6.2.0",
"@sentry/minimal": "6.2.0",
"@sentry/types": "6.2.0",
"@sentry/utils": "6.2.0",
"tslib": "^1.9.3"
},
"engines": {
"node": ">=6"
}
},
"node_modules/@sentry/types": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@sentry/types/-/types-6.2.0.tgz",
"integrity": "sha512-vN4P/a+QqAuVfWFB9G3nQ7d6bgnM9jd/RLVi49owMuqvM24pv5mTQHUk2Hk4S3k7ConrHFl69E7xH6Dv5VpQnQ==",
"engines": {
"node": ">=6"
}
},
"node_modules/@sentry/utils": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-6.2.0.tgz",
"integrity": "sha512-YToUC7xYf2E/pIluI7upYTlj8fKXOtdwoOBkcQZifHgX/dP+qDaHibbBFe5PyZwdmU2UiLnWFsBr0gjo0QFo1g==",
"dependencies": {
"@sentry/types": "6.2.0",
"tslib": "^1.9.3"
},
"engines": {
"node": ">=6"
}
},
"node_modules/@sinonjs/commons": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.2.tgz",
@@ -28020,6 +28131,88 @@
}
}
},
"@sentry/browser": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-6.2.0.tgz",
"integrity": "sha512-4r3paHcHXLemj471BtNDhUs2kvJxk5XDRplz1dbC/LHXN5PWEXP4anhGILxOlxqi4y33r53PIZu3xXFjznaVZA==",
"requires": {
"@sentry/core": "6.2.0",
"@sentry/types": "6.2.0",
"@sentry/utils": "6.2.0",
"tslib": "^1.9.3"
}
},
"@sentry/core": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-6.2.0.tgz",
"integrity": "sha512-oTr2b25l+0bv/+d6IgMamPuGleWV7OgJb0NFfd+WZhw6UDRgr7CdEJy2gW6tK8SerwXgPHdn4ervxsT3WIBiXw==",
"requires": {
"@sentry/hub": "6.2.0",
"@sentry/minimal": "6.2.0",
"@sentry/types": "6.2.0",
"@sentry/utils": "6.2.0",
"tslib": "^1.9.3"
}
},
"@sentry/hub": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-6.2.0.tgz",
"integrity": "sha512-BDTEFK8vlJydWXp/KMX0stvv73V7od224iLi+w3k7BcPwMKXBuURBXPU8d5XIC4G8nwg8X6cnDvwL+zBBlBbkg==",
"requires": {
"@sentry/types": "6.2.0",
"@sentry/utils": "6.2.0",
"tslib": "^1.9.3"
}
},
"@sentry/minimal": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-6.2.0.tgz",
"integrity": "sha512-haxsx8/ZafhZUaGeeMtY7bJt9HbDlqeiaXrRMp1CxGtd0ZRQwHt60imEjl6IH1I73SEWxNfqScGsX2s3HzztMg==",
"requires": {
"@sentry/hub": "6.2.0",
"@sentry/types": "6.2.0",
"tslib": "^1.9.3"
}
},
"@sentry/react": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@sentry/react/-/react-6.2.0.tgz",
"integrity": "sha512-Jf3s7om1iLpApkN26O7c3Ult3lS91ekZNC4WKtcPb6b+KOBQ36sB0d1KhL3hGZ55UKLmgZu3jn2hd7bJ9EY3yA==",
"requires": {
"@sentry/browser": "6.2.0",
"@sentry/minimal": "6.2.0",
"@sentry/types": "6.2.0",
"@sentry/utils": "6.2.0",
"hoist-non-react-statics": "^3.3.2",
"tslib": "^1.9.3"
}
},
"@sentry/tracing": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-6.2.0.tgz",
"integrity": "sha512-pzgM1dePPJysVnzaFCMp+BKtjM5q46HZeyShiR+KcQYvneD3fmUPJigDkkcsB2DcrY3mFvDcswjoqxaTIW7ZBQ==",
"requires": {
"@sentry/hub": "6.2.0",
"@sentry/minimal": "6.2.0",
"@sentry/types": "6.2.0",
"@sentry/utils": "6.2.0",
"tslib": "^1.9.3"
}
},
"@sentry/types": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@sentry/types/-/types-6.2.0.tgz",
"integrity": "sha512-vN4P/a+QqAuVfWFB9G3nQ7d6bgnM9jd/RLVi49owMuqvM24pv5mTQHUk2Hk4S3k7ConrHFl69E7xH6Dv5VpQnQ=="
},
"@sentry/utils": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-6.2.0.tgz",
"integrity": "sha512-YToUC7xYf2E/pIluI7upYTlj8fKXOtdwoOBkcQZifHgX/dP+qDaHibbBFe5PyZwdmU2UiLnWFsBr0gjo0QFo1g==",
"requires": {
"@sentry/types": "6.2.0",
"tslib": "^1.9.3"
}
},
"@sinonjs/commons": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.2.tgz",

View File

@@ -7,6 +7,8 @@
"@apollo/client": "^3.3.11",
"@fingerprintjs/fingerprintjs": "^3.0.6",
"@lourenci/react-kanban": "^2.1.0",
"@sentry/react": "^6.2.0",
"@sentry/tracing": "^6.2.0",
"@stripe/react-stripe-js": "^1.2.2",
"@stripe/stripe-js": "^1.12.1",
"@tanem/react-nprogress": "^3.0.56",

View File

@@ -4,7 +4,7 @@ import "firebase/auth";
import "firebase/database";
import "firebase/firestore";
import "firebase/messaging";
//import { store } from "../redux/store";
import { store } from "../redux/store";
const config = JSON.parse(process.env.REACT_APP_FIREBASE_CONFIG);
firebase.initializeApp(config);
@@ -48,16 +48,17 @@ try {
export { messaging };
export const logImEXEvent = (eventName, additionalParams, stateProp = null) => {
// const state = stateProp || store.getState();
const state = stateProp || store.getState();
const eventParams = {
// shop:
// (state.user && state.user.bodyshop && state.user.bodyshop.shopname) ||
// null,
// user:
// (state.user && state.user.currentUser && state.user.currentUser.email) ||
// null,
shop:
(state.user && state.user.bodyshop && state.user.bodyshop.shopname) ||
null,
user:
(state.user && state.user.currentUser && state.user.currentUser.email) ||
null,
...additionalParams,
};
console.log("%c[Analytics]", "background: tomato", eventName, eventParams);
analytics.logEvent(eventName, eventParams);
};

View File

@@ -1,4 +1,6 @@
import { AlertOutlined } from "@ant-design/icons";
import * as Sentry from "@sentry/react";
import { Integrations } from "@sentry/tracing";
import { Button, notification } from "antd";
import Dinero from "dinero.js";
import i18n from "i18next";
@@ -21,6 +23,17 @@ Dinero.defaultCurrency = "CAD";
Dinero.globalLocale = "en-CA";
Dinero.globalRoundingMode = "HALF_UP";
Sentry.init({
dsn:
"https://fd7e89369b6b4bdc9c6c4c9f22fa4ee4@o492140.ingest.sentry.io/5651027",
integrations: [new Integrations.BrowserTracing()],
environment: process.env || "development",
// We recommend adjusting this value in production, or using tracesSampler
// for finer control
tracesSampleRate: 0.5,
});
ReactDOM.render(
<Provider store={store}>
<BrowserRouter>

View File

@@ -2,6 +2,7 @@ import Fingerprint2 from "@fingerprintjs/fingerprintjs";
import LogRocket from "logrocket";
import { all, call, delay, put, select, takeLatest } from "redux-saga/effects";
import {
analytics,
auth,
firestore,
getCurrentUser,
@@ -160,6 +161,8 @@ export function* signInSuccessSaga({ payload }) {
LogRocket.identify(payload.email);
if (!payload.email.includes("@imex.")) yield put(setInstanceId(payload.uid));
analytics.setUserId(payload.email);
analytics.setUserProperties(payload);
yield logImEXEvent("redux_sign_in_success");
}