Skip to content

Commit 31334f8

Browse files
[PRMP-1553] Implement CloudWatch RUM PoC (UI Analytics) (#561)
* Started to implement AWS RUM on frontend * Implemented AWS RUM code and variables needed * Some changes to variable names * Removed logging and corrected conditional check against environment * Updated github_env to github_output to be used in subsequent job * Reverted to Github Env * Reverted to outputs and added debugging * Updated tsx to use Default script code from AWS * Changed Account id to REACT_APP_MONITOR_ACCOUNT_ID * ignore linter and log info, define awsRum const * ignore es-lint awsRum * Moved awsRum into App instead of index * test no initialzed * added further logging * added more logging * Corrected Identitity Pool Id React Var * Removed comment nullifying Environment Parameter check * Refactored for initial PR * Added mask and removed github-env * removed un-needed comments * Removed debugging step * Test if initiating RUM placeholder is causing issue * replaced process.env.REACT_APP_RUM_IDENTITY_POOL_ID !== 'not provided yet' with cypress bool to make readable * Corrected cypress conditional
1 parent 9e9bf1d commit 31334f8

File tree

10 files changed

+481
-4
lines changed

10 files changed

+481
-4
lines changed

.github/workflows/base-cypress-build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ jobs:
2828
- name: Cypress install
2929
run: npm install --legacy-peer-deps
3030
working-directory: ./app
31-
31+
3232
- name: Configure React environment vars
3333
env:
3434
ENDPOINT_DOC_STORE_API: http://localhost:3000
3535
AWS_REGION: test region
3636
OIDC_PROVIDER_ID: not provided yet
37+
IDENTITY_PROVIDER_POOL_ID: not provided yet
38+
MONITOR_ACCOUNT_ID: not provided yet
3739
BUILD_ENV: development
3840
IMAGE_VERSION: 'not-required'
3941
run: |

.github/workflows/base-deploy-ui.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,35 @@ jobs:
6464
cloudfront_domain_name=$(aws cloudfront list-distributions --query "DistributionList.Items[?starts_with(Origins.Items[0].DomainName, '${{ inputs.sandbox }}')].DomainName" --output text)
6565
echo "Cloudfront domain name found for environment: $cloudfront_domain_name"
6666
echo "CLOUDFRONT_DOMAIN_NAME=$cloudfront_domain_name" >> $GITHUB_ENV
67-
67+
6868
- name: Login to Amazon ECR
6969
id: login-ecr
7070
uses: aws-actions/amazon-ecr-login@v2
7171

72+
- name: Get Cognito Identity Pool ID
73+
id: cognito-identity-pool
74+
run: |
75+
identity_pool_id=$(aws cognito-identity list-identity-pools --max-results 50 \
76+
--query "IdentityPools[?starts_with(IdentityPoolName, '${{ inputs.sandbox }}')].IdentityPoolId" \
77+
--output text)
78+
echo "::add-mask::$identity_pool_id"
79+
echo "IDENTITY_PROVIDER_POOL_ID=$identity_pool_id" >> $GITHUB_OUTPUT
80+
81+
- name: Get CloudWatch RUM App Monitor ID
82+
id: rum-app-monitor
83+
run: |
84+
app_monitor_id=$(aws rum list-app-monitors \
85+
--query "AppMonitorSummaries[?starts_with(Name, '${{ inputs.sandbox }}')].Id" \
86+
--output text)
87+
echo "::add-mask::$app_monitor_id"
88+
echo "MONITOR_ACCOUNT_ID=$app_monitor_id" >> $GITHUB_OUTPUT
89+
7290
- name: Configure React environment vars
7391
env:
7492
AWS_REGION: ${{ vars.AWS_REGION }}
7593
OIDC_PROVIDER_ID: not provided yet
94+
IDENTITY_PROVIDER_POOL_ID: ${{ steps.cognito-identity-pool.outputs.IDENTITY_PROVIDER_POOL_ID }}
95+
MONITOR_ACCOUNT_ID: ${{ steps.rum-app-monitor.outputs.MONITOR_ACCOUNT_ID }}
7696
BUILD_ENV: ${{ inputs.environment }}
7797
IMAGE_VERSION: 'ndr-${{ inputs.sandbox }}-app:${{ github.sha }}'
7898
run: |

.github/workflows/base-jest-test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ jobs:
3939
ENDPOINT_DOC_STORE_API: http://localhost:3000
4040
AWS_REGION: test region
4141
OIDC_PROVIDER_ID: not provided yet
42+
IDENTITY_PROVIDER_POOL_ID: not provided yet
43+
MONITOR_ACCOUNT_ID: not provided yet
4244
BUILD_ENV: development
4345
IMAGE_VERSION: 'ndr-not-required'
4446
run: |

.github/workflows/sonarcloud-analysis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
ENDPOINT_DOC_STORE_API: http://localhost:3000
3030
AWS_REGION: test region
3131
OIDC_PROVIDER_ID: not provided yet
32+
IDENTITY_PROVIDER_POOL_ID: not provided yet
33+
MONITOR_ACCOUNT_ID: not provided yet
3234
BUILD_ENV: development
3335
IMAGE_VERSION: 'ndr-${{ vars.BUILD_ENV }}-app:${{ github.sha }}'
3436
run: |

app/.env.template

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ GENERATE_SOURCEMAP=false # false
22
REACT_APP_DOC_STORE_API_ENDPOINT=%DOC_STORE_API_ENDPOINT%
33
REACT_APP_AWS_REGION=%AWS_REGION%
44
REACT_APP_OIDC_PROVIDER_ID=%OIDC_PROVIDER_ID%
5-
REACT_APP_ENVIRONMENT=%BUILD_ENV% # 'local'
5+
REACT_APP_RUM_IDENTITY_POOL_ID=%IDENTITY_PROVIDER_POOL_ID%
6+
REACT_APP_MONITOR_ACCOUNT_ID=%MONITOR_ACCOUNT_ID%
7+
REACT_APP_ENVIRONMENT=%BUILD_ENV%
68
REACT_APP_IMAGE_VERSION="%IMAGE_VERSION%"
79
CONTAINER_PORT=xx # Port number within the container. Needed for building the docker image
810
HOST_PORT=xxxx # Port number that the docker-compose localhost exposes. Only need this if we run docker-compose

0 commit comments

Comments
 (0)