-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
chore(cli): log SDK calls when using -vvv
#32308
Conversation
(This work came out of the proxy issue research) The logging of what SDK calls were being performed was lost during the migration of SDKv2 -> SDKv3. Add it back. Also in this PR: - Set a timeout on `npm view`; if for network isolation reasons NPM can't connect to the server, it will make the CLI hang for a minute. - Work around an issue where the CLI entirely fails if it is run as a user that doesn't have a home directory.
Still a Draft because I'm not happy with how the messages are being formatted; there is too much detail in them as they include the entire API call payloads and responses (including somewhat-sensitive information). But creating a PR already anyway because I want to store this code somewhere safe. |
-vvv
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.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #32308 +/- ##
==========================================
+ Coverage 78.36% 78.45% +0.08%
==========================================
Files 105 106 +1
Lines 7170 7208 +38
Branches 1315 1323 +8
==========================================
+ Hits 5619 5655 +36
- Misses 1364 1365 +1
- Partials 187 188 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
public trace(...content: any[]) { | ||
// This is too much detail for our logs | ||
// trace('[SDK trace] %s', this.fmtContent(content)); | ||
Array.isArray(content); |
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 don't understand what this line is doing.
const api = content.commandName.replace(/Command$/, ''); | ||
|
||
const parts = []; | ||
if (content.metadata.attempts > 1) { |
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.
Is metadata
guaranteed to exist?
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 so but who knows.
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'll code more defensively
* Stringify and join without separator. | ||
*/ | ||
private fmtContent(content: any[]) { | ||
if (content.length === 1) { |
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.
Can content
not be an array with more than one error, for example?
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.
If so we won't do the wrong thing, we just won't be doing a nice thing.
We'll see that in the logs at some point and fix it then.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Comments on closed issues and PRs are hard for our team to see. |
(This work came out of the proxy issue research)
The logging of what SDK calls were being performed was lost during the migration of SDKv2 -> SDKv3. Add it back.
Also in this PR:
npm view
; if for network isolation reasons NPM can't connect to the server, it will make the CLI hang for a minute.Closes #32306.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license