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(@aws-amplify/ui-components): User agent tracking for UI component packages #4804

Conversation

jordanranz
Copy link
Contributor

Description of changes:

  • Export function to append to Cognito user agent
  • Append to Cognito user agent inside of Auth and UI (amplify-authenticator)

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

@lgtm-com
Copy link

lgtm-com bot commented Jan 30, 2020

This pull request fixes 1 alert when merging 5e4f37e into 6d1019f - view on LGTM.com

fixed alerts:

  • 1 for Unused variable, import, function or class

Copy link
Contributor

@ericclemmons ericclemmons left a comment

Choose a reason for hiding this comment

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

The code is really straightforward! I need to spend some more time tracking down how the values get from UserAgent.prototype.userAgent to Platform.userAgent (or not).

User Agent tracking is so crucial to reporting, are there some tests that exist or that we can add to increase our coverage and protect us as we continue refining it?

packages/auth/src/Auth.ts Outdated Show resolved Hide resolved
packages/amazon-cognito-identity-js/src/UserAgent.js Outdated Show resolved Hide resolved
@jordanranz
Copy link
Contributor Author

@ericclemmons basically the Platform.userAgent is appended to the Cognito request (via UserAgent) during Auth.configure.

I will definitely add unit tests. Thank you for the feedback.

@lgtm-com
Copy link

lgtm-com bot commented Jan 31, 2020

This pull request fixes 1 alert when merging f05f0a3 into 6d1019f - view on LGTM.com

fixed alerts:

  • 1 for Unused variable, import, function or class

@jordanranz
Copy link
Contributor Author

I have pushed unit tests for this change.

@lgtm-com
Copy link

lgtm-com bot commented Feb 1, 2020

This pull request fixes 1 alert when merging f354e47 into 6d1019f - view on LGTM.com

fixed alerts:

  • 1 for Unused variable, import, function or class

Copy link
Contributor

@ericclemmons ericclemmons left a comment

Choose a reason for hiding this comment

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

👏 Thanks for adding the tests! This helps greatly, especially if we ever come across issues with the duplicate content situation (e.g. @aws-amplify/ui, @aws-amplify/ui-react, and @aws-amplify/ui-react-native all calling appendToCognitoUserAgent).

I'm in favor of shipping this so we can start getting metrics reported back 👍

In the future, I can see us taking two paths:

  1. Embracing a registration pattern, where get userAgent computes the string based on what packages have been registered.

    (Something like https://github.com/aws-amplify/amplify-js/blob/master/packages/core/src/Amplify.ts#L27-L35)

  2. Solving for per-request attribution. (possibly via stacktrace or WeakMap's)

For now, let's get visibility we haven't had before! 💪

@ericclemmons
Copy link
Contributor

Not sure why the build is failing though :(

@jordanranz
Copy link
Contributor Author

@ericclemmons error Command failed with exit code 137 means that the container is running out of memory. This currently happens in personal circleCI builds as we have limited memory constraints. When this is built on the aws-amplify repo it should succeed. That being said we should investigate this a little further and fix the personal CircleCI builds as a follow up.

Copy link
Contributor

@Amplifiyer Amplifiyer left a comment

Choose a reason for hiding this comment

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

Looks Good!

@jordanranz jordanranz merged commit 15a0a2f into aws-amplify:ui-components/master Feb 4, 2020
@github-actions
Copy link

This pull request has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants