Skip to content

Commit

Permalink
feat: connect DataDog RUM and traces (#5875)
Browse files Browse the repository at this point in the history
* build: bump @datadog/browser-rum package

* feat: add allowedTracingUrls

* fix: use APP_URL env var

* test: add dd logging for form submission to test traces

* build: inject REACT_APP_URL into build step

* test: check app url

* fix: inject REACT_APP_URL frontend env var

* fix: remove dd logging
  • Loading branch information
wanlingt authored Mar 7, 2023
1 parent 1c09963 commit 323002e
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 27 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/deploy-eb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ jobs:
REACT_APP_DD_SAMPLE_RATE: ${{ secrets.DD_SAMPLE_RATE }}
REACT_APP_GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
REACT_APP_FORMSG_SDK_MODE: ${{ secrets.REACT_APP_FORMSG_SDK_MODE }}
REACT_APP_URL: ${{ secrets.APP_URL }}
run: |
sed -i -e "s/@REACT_APP_DD_RUM_APP_ID/$REACT_APP_DD_RUM_APP_ID/g" -e "s/@REACT_APP_DD_RUM_CLIENT_TOKEN/$REACT_APP_DD_RUM_CLIENT_TOKEN/g" -e "s/@REACT_APP_DD_RUM_ENV/$REACT_APP_DD_RUM_ENV/g" -e "s/@REACT_APP_VERSION/${{env.APP_VERSION}}/g" -e "s/@REACT_APP_DD_SAMPLE_RATE/$REACT_APP_DD_SAMPLE_RATE/g" frontend/datadog-chunk.ts
sed -i -e "s|@REACT_APP_URL|${{secrets.APP_URL}}|g" -e "s/@REACT_APP_DD_RUM_APP_ID/$REACT_APP_DD_RUM_APP_ID/g" -e "s/@REACT_APP_DD_RUM_CLIENT_TOKEN/$REACT_APP_DD_RUM_CLIENT_TOKEN/g" -e "s/@REACT_APP_DD_RUM_ENV/$REACT_APP_DD_RUM_ENV/g" -e "s/@REACT_APP_VERSION/${{env.APP_VERSION}}/g" -e "s/@REACT_APP_DD_SAMPLE_RATE/$REACT_APP_DD_SAMPLE_RATE/g" frontend/datadog-chunk.ts
echo REACT_APP_VERSION=${{env.APP_VERSION}} > frontend/.env
echo REACT_APP_URL=$REACT_APP_URL > frontend/.env
echo REACT_APP_GA_TRACKING_ID=$REACT_APP_GA_TRACKING_ID >> frontend/.env
echo REACT_APP_FORMSG_SDK_MODE=$REACT_APP_FORMSG_SDK_MODE >> frontend/.env
echo REACT_APP_DD_RUM_CLIENT_TOKEN=$REACT_APP_DD_RUM_CLIENT_TOKEN >> frontend/.env
Expand Down
1 change: 1 addition & 0 deletions frontend/datadog-chunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ datadogRum.init({
env: '@REACT_APP_DD_RUM_ENV',
site: 'datadoghq.com',
service: 'formsg-react',
allowedTracingUrls: ['@REACT_APP_URL'],

// Specify a version number to identify the deployed version of your application in Datadog
version: '@REACT_APP_VERSION',
Expand Down
58 changes: 33 additions & 25 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": {
"@chakra-ui/react": "^1.8.6",
"@datadog/browser-logs": "^4.28.1",
"@datadog/browser-rum": "^4.14.0",
"@datadog/browser-rum": "^4.34.1",
"@emotion/react": "^11.7.0",
"@emotion/styled": "^11.6.0",
"@floating-ui/react-dom-interactions": "^0.9.3",
Expand Down

0 comments on commit 323002e

Please sign in to comment.