Skip to content

Commit

Permalink
Merge pull request #1053 from CruGlobal/add-datadog
Browse files Browse the repository at this point in the history
Add datadog RUM, add datadog client token to webpack config and yml
  • Loading branch information
caleballdrin authored Sep 19, 2023
2 parents 9d0b608 + b1912ac commit 9efc4aa
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions src/common/app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -543,3 +544,4 @@ export default angular.module('appConfig', [
])
.config(appConfig)
.config(rollbarConfig)
.config(dataDogConfig)
26 changes: 26 additions & 0 deletions src/common/datadog.config.js
Original file line number Diff line number Diff line change
@@ -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
}
3 changes: 2 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
20 changes: 20 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1544,6 +1544,26 @@
dependencies:
"@cspotcode/source-map-consumer" "0.8.0"

"@datadog/[email protected]":
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/[email protected]":
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"
Expand Down

0 comments on commit 9efc4aa

Please sign in to comment.