Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: webclient version and installation method #321

Merged

Conversation

limhjgrace
Copy link
Contributor

@limhjgrace limhjgrace commented Dec 11, 2022

Currently, AWS RUM has no way to determine how RUM users are installing the web client or the version of the installed web client. This update will add this information to the metadata of all events. The web client version will be stored in a new built-in field, aws:clientVersion, while the installation method will be stored in a new built-in field, aws:client.

This update also updates the deployment script to track all official web client versions in a file located in the S3 bucket in the AWS RUM service account (content/versions.csv).


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

.github/scripts/deploy.sh Outdated Show resolved Hide resolved
.github/scripts/deploy.sh Outdated Show resolved Hide resolved
.github/scripts/deploy.sh Outdated Show resolved Hide resolved
@limhjgrace limhjgrace force-pushed the feature/web-client-versioning branch 2 times, most recently from 5521627 to 5df1fb0 Compare January 24, 2023 20:25
@limhjgrace limhjgrace requested a review from qhanam January 25, 2023 01:15
.github/scripts/deploy.sh Outdated Show resolved Hide resolved
@limhjgrace limhjgrace force-pushed the feature/web-client-versioning branch from a32d477 to 3cdd2ba Compare January 26, 2023 06:00
@limhjgrace limhjgrace force-pushed the feature/web-client-versioning branch from 3d7e2d9 to 5a54bb3 Compare January 26, 2023 16:33
#!/bin/bash

version=$(jq -r '.version' package.json)
jq --arg version $version '.version |= $version' version.json >file.json.tmp && cp file.json.tmp version.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Why do we need to write to file.json.tmp first?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we write directly to the version.json file, it appends onto the content instead of overwriting the file so we have to write to a temp file and then copy the file over to overwrite the existing file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given we're ignoring the version.json file and removed file from changes, I updated the script so that we just write to a new file.

package.json Outdated
@@ -29,7 +29,7 @@
"build:dist:es": "tsc --project ./tsconfig.es.json",
"build:dist:cjs": "tsc --project ./tsconfig.cjs.json",
"build:assets": "npm-run-all -p build:dist:* build:webpack:prod",
"build": "npm-run-all -s build:schemas build:assets",
"build": "npm-run-all -s build:schemas update:version build:assets",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: If we run any of the targets independently, like npm run build:dist:es, then the correct version may not be used.

This is fine for the deployment script in this repository, because it runs build, but there is are scenarios where this step could be missed. For example, a third party runs their own web client build, but runs only the subset they need: build:schemas && build:dist:es.

One way to help mitigate this would be to omit version.json from version control (by adding it to .gitignore). This way, like the schemas, build:version would need to run before the other build steps, helping ensure the file is up to date.

Copy link
Contributor Author

@limhjgrace limhjgrace Jan 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to .gitignore and removed files from changes

package.json Outdated Show resolved Hide resolved
@limhjgrace limhjgrace merged commit 97c543a into aws-observability:main Feb 1, 2023
@limhjgrace limhjgrace deleted the feature/web-client-versioning branch February 1, 2023 18:07
@ps863 ps863 mentioned this pull request Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants