-
Notifications
You must be signed in to change notification settings - Fork 824
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:usage-diagnoses #3641
feat:usage-diagnoses #3641
Conversation
142b5b4
to
6c4a60b
Compare
2ac1aac
to
81bc4d1
Compare
This pull request introduces 1 alert when merging 81bc4d1dfe18f2cee473b5a25350d68f905ab31a into 39870f1 - view on LGTM.com new alerts:
|
81bc4d1
to
37fe311
Compare
Codecov Report
@@ Coverage Diff @@
## master #3641 +/- ##
==========================================
- Coverage 61.57% 60.57% -1.00%
==========================================
Files 333 349 +16
Lines 14550 15133 +583
Branches 2764 2865 +101
==========================================
+ Hits 8959 9167 +208
- Misses 5164 5478 +314
- Partials 427 488 +61
Continue to review full report at Codecov.
|
This pull request introduces 1 alert when merging 37fe3118e30516b6a90b41aa38fa988e33270054 into 493e631 - view on LGTM.com new alerts:
|
@@ -12,18 +13,30 @@ try { | |||
} catch (e) { | |||
// could not delete the cache directory but don't want to fail the installation | |||
} | |||
console.log('\n'); | |||
console.log(EOL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Why are we printing EOL
s, to have 2 empty lines? I think we'd be good just a simple empty line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to make sure it was platform independent
windows it's '\n\r'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant that how is it different from an empty console.log()
statement. We want 2 empty lines or what is the reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I am sorry I misunderstood, it's just to keep separation more obvious
packages/amplify-provider-awscloudformation/lib/configuration-manager.js
Outdated
Show resolved
Hide resolved
5b15646
to
b934571
Compare
This pull request introduces 2 alerts when merging b93457174354cbb4f74121e35204bd72ffe1aeef into f45d32b - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging d330a9411dcc5b6ff0a1db959f01414a28e698f4 into f45d32b - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging 097235d045969a46cf993c637e90302a9db2ab15 into f45d32b - view on LGTM.com new alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the previous comments, added a few new ones.
|
||
describe('test telemetry', () => { | ||
beforeAll(() => { | ||
process.env = Object.assign(process.env, { AMPLIFY_CLI_BETA_USAGE_TRACKING_URL: originalUrl }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have the BETA
in it? I think that we need to use the same variable: AMPLIFY_CLI_USAGE_TRACKING_URL
and its value should point to different endpoint during testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by testing? e2e tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't be exposing a beta url to the public also.
|
||
export function write(context: Context, keyValues: Object) { | ||
Config.Instance.setValues(keyValues); | ||
fs.writeFileSync(getPath(context), JSON.stringify(Config.Instance)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can fail if ~/.amplify
directory does not exist, not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
~/.amplify the directory is created during a plugin scan.
@@ -0,0 +1,23 @@ | |||
import semver from 'semver'; | |||
|
|||
const APIVersionToPayloadVersion = new Map<string, Array<string>>([['v1.0', ['1.0.0']]]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the design here? a given CLI version just reports 1 version of the payload what we change over time. So the CLI does not have to support multiple versions.
On the other hand it seems that the getLatestApiVersion()
is doing the version calculation on every call which seems to be suboptimal as this code is on the hot path if telemetry is enabled, if you decide to keep the multiple versions here, can we cache it between invocations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want the API version to be mapped to payload version. This way it's explicit if there are any major changes we would have to make sure the API works with the new payload. No we are not caching it. It's kind of excessive to cache something that's been called twice in a lifetime
import { getLatestApiVersion } from './VersionManager'; | ||
|
||
const version = getLatestApiVersion(); | ||
const prodUrl = `https://aws-amplify-cli-telemetry.us-east-1.amazonaws.com/${version}/metrics`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the payload version and the API version for telemetry is coupled together?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the payload version is coupled together with the API version
|
||
const version = getLatestApiVersion(); | ||
const prodUrl = `https://aws-amplify-cli-telemetry.us-east-1.amazonaws.com/${version}/metrics`; | ||
export function getUrl(): UrlWithStringQuery { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we caching the result of this function between invocations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No we are not caching it. It's kind of excessive to cache something that's been called twice in a lifetime when the software is running
this.input = redactInput(input, true); | ||
} | ||
|
||
static get Instance(): ITelemetry { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need static instance variable in the ITelemetry
implementations?
This only accessed through context
, which already has an instance of those classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is how a singleton is created
} | ||
init(installationUuid: String, version: String, input: any): void {} | ||
|
||
private static instance: NoTelemetry; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as for the other ITelemetry
implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as telemetry
e45aae2
to
2a7d318
Compare
This reverts commit 30a7fe7.
This reverts commit a755863.
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 |
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.