diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8fcee162..f4950e60c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -67,6 +67,7 @@ jobs: env: S3_GIVE_DOMAIN: //${{ secrets.GIVE_WEB_HOSTNAME }} ROLLBAR_ACCESS_TOKEN: ${{ secrets.ROLLBAR_ACCESS_TOKEN }} + DATADOG_RUM_CLIENT_TOKEN: ${{ secrets.DATADOG_RUM_CLIENT_TOKEN }} run: yarn run build - name: Configure AWS Credentials diff --git a/package.json b/package.json index 08a5318cb..430e5f851 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "@babel/polyfill": "^7.7.0", "@babel/runtime-corejs2": "^7.0.0", "@cruglobal/cru-payments": "^1.2.4", + "@datadog/browser-rum": "^4.48.2", "angular": "^1.8.2", "angular-cookies": "^1.8.2", "angular-environment": "https://github.com/jonshaffer/angular-environment.git#d3082c06fb16804d324faac9b7e753fd64a44e5d", diff --git a/src/common/app.config.js b/src/common/app.config.js index c2c0e68e6..59d7c22d8 100644 --- a/src/common/app.config.js +++ b/src/common/app.config.js @@ -3,6 +3,7 @@ import 'angular-environment' import 'angular-translate' import rollbarConfig from './rollbar.config' +import dataDogConfig from './datadog.config.js' const appConfig = /* @ngInject */ function (envServiceProvider, $compileProvider, $logProvider, $httpProvider, $locationProvider, $qProvider, $translateProvider) { $httpProvider.useApplyAsync(true) @@ -543,3 +544,4 @@ export default angular.module('appConfig', [ ]) .config(appConfig) .config(rollbarConfig) + .config(dataDogConfig) diff --git a/src/common/datadog.config.js b/src/common/datadog.config.js new file mode 100644 index 000000000..935458bc1 --- /dev/null +++ b/src/common/datadog.config.js @@ -0,0 +1,26 @@ +import 'angular-environment' +import { datadogRum } from '@datadog/browser-rum' + +const dataDogConfig = /* @ngInject */ function (envServiceProvider) { + const config = { + applicationId: '3937053e-386b-4b5b-ab4a-c83217d2f953', + clientToken: process.env.DATADOG_RUM_CLIENT_TOKEN, + site: 'datadoghq.com', + service: 'give-web', + env: envServiceProvider.get(), + version: process.env.GITHUB_SHA, + sessionSampleRate: envServiceProvider.is('staging') ? 100 : 10, + sessionReplaySampleRate: envServiceProvider.is('staging') ? 100 : 1, + trackUserInteractions: true, + trackResources: true, + trackLongTasks: true, + defaultPrivacyLevel: 'mask-user-input' + } + + window.datadogRum = datadogRum + window.datadogRum && window.datadogRum.init(config) + window.datadogRum && window.datadogRum.startSessionReplayRecording() +} +export { + dataDogConfig as default +} diff --git a/webpack.config.js b/webpack.config.js index 7f04c9310..8fb4400af 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -55,7 +55,8 @@ const sharedConfig = { new webpack.EnvironmentPlugin({ GITHUB_SHA: 'development', S3_GIVE_DOMAIN: '', - ROLLBAR_ACCESS_TOKEN: JSON.stringify(process.env.ROLLBAR_ACCESS_TOKEN) || 'development-token' + ROLLBAR_ACCESS_TOKEN: JSON.stringify(process.env.ROLLBAR_ACCESS_TOKEN) || 'development-token', + DATADOG_RUM_CLIENT_TOKEN: process.env.DATADOG_RUM_CLIENT_TOKEN || '' }), // To strip all locales except “en” new MomentLocalesPlugin() diff --git a/yarn.lock b/yarn.lock index bfa232497..6e66470c1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1544,6 +1544,26 @@ dependencies: "@cspotcode/source-map-consumer" "0.8.0" +"@datadog/browser-core@4.48.2": + version "4.48.2" + resolved "https://registry.yarnpkg.com/@datadog/browser-core/-/browser-core-4.48.2.tgz#6606878660a2dad528a7c5c4aa5465169cb2c33a" + integrity sha512-ewQDLouh9jymJPTRq5M8Hz0FFzMaVlJCwHHY5gMUmGyIaBEzS8wd3AeZ56kQ32ZOcyz83au1/yZ/zcIB8LDoyA== + +"@datadog/browser-rum-core@4.48.2": + version "4.48.2" + resolved "https://registry.yarnpkg.com/@datadog/browser-rum-core/-/browser-rum-core-4.48.2.tgz#4fc13aedc6170d51c3c024327da27af937fd0186" + integrity sha512-LUlaYAC7MGXZbIPT6LvSVxaZBG0irer+meQp1LfJBdSy/lLb4OrNowrc9dcHeh4Fw9rNNLWl2Pz+4dBqRtR87g== + dependencies: + "@datadog/browser-core" "4.48.2" + +"@datadog/browser-rum@^4.48.2": + version "4.48.2" + resolved "https://registry.yarnpkg.com/@datadog/browser-rum/-/browser-rum-4.48.2.tgz#95ab72a0fd6b9f82b69cca6a351d9a91bcd8d5da" + integrity sha512-SGxjKJLUJq8AjWedhHTQicIr4rvAcDMwBr6gHvZr3h9llCBpDxPzd/RPKCK69HMxBGt/Cw7KCpjAjy9IaCURWQ== + dependencies: + "@datadog/browser-core" "4.48.2" + "@datadog/browser-rum-core" "4.48.2" + "@eslint/eslintrc@^0.3.0": version "0.3.0" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.3.0.tgz#d736d6963d7003b6514e6324bec9c602ac340318"