-
Notifications
You must be signed in to change notification settings - Fork 176
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
docs: Improve ORAS diagnose experience #1483
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Feynman Zhou <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1483 +/- ##
==========================================
+ Coverage 85.54% 86.02% +0.47%
==========================================
Files 113 118 +5
Lines 3936 4228 +292
==========================================
+ Hits 3367 3637 +270
- Misses 342 352 +10
- Partials 227 239 +12 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Feynman Zhou <[email protected]>
Signed-off-by: Feynman Zhou <[email protected]>
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.
IMHO, if a user decides to get verbose output, he or she will be prepared to receive a lot of information in the output (including very technical information - for example, curl gives details about the encryption algorithm). I am still not convinced that we need to complicate the interface to suppress some of the output.
Signed-off-by: Feynman Zhou <[email protected]>
Signed-off-by: Feynman Zhou <[email protected]>
Signed-off-by: Feynman Zhou <[email protected]>
Signed-off-by: Feynman Zhou <[email protected]>
Signed-off-by: Feynman Zhou <[email protected]>
Signed-off-by: Feynman Zhou <[email protected]>
Signed-off-by: Feynman Zhou <[email protected]>
Signed-off-by: Feynman Zhou <[email protected]>
- Introduce a new flag `--detail` to replace the existing global flag `--verbose` of commands like `pull`, `push`, `attach`, and `discover` for detailed output. | ||
- Add separator lines between each request and response for readability. | ||
- Add timestamp of each request and response to the beginning of each request and response. | ||
- Add the response body including [error code](https://github.com/opencontainers/distribution-spec/blob/main/spec.md#error-codes) and the metadata of processed OCI object (e.g. image manifest) to the debug logs |
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 does it mean? Is it applicable to OCI image layout?
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 error code is not included in the response body in ORAS debug logs now. We need to add it to make it analyzable.
This is not applicable to OCI image layout but only registry.
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.
Error code is in the response body as we do extract error code from the JSON response body.
Signed-off-by: Feynman Zhou <[email protected]>
Signed-off-by: Feynman Zhou <[email protected]>
Signed-off-by: Feynman Zhou <[email protected]>
- Introduce a new flag `--detail` to replace the existing global flag `--verbose` of commands like `pull`, `push`, `attach`, and `discover` for detailed output. | ||
- Add separator lines between each request and response for readability. | ||
- Add timestamp of each request and response to the beginning of each request and response. | ||
- Add the response body including [error code](https://github.com/opencontainers/distribution-spec/blob/main/spec.md#error-codes) and the metadata of processed OCI object (e.g. image manifest) to the debug logs |
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.
Error code is in the response body as we do extract error code from the JSON response body.
"Www-Authenticate": "Bearer realm=\"https://ghcr.io/token\",service=\"ghcr.io\",scope=\"repository:oras-project/oras:pull\"" | ||
"Date": "Fri, 02 Aug 2024 23:56:03 GMT" | ||
< Response body: | ||
{ |
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 format seems wrong
- Make the verbose output of command `discover` as a formatted output, controlled by `--format tree-full`. | ||
- Add an empty line as the separator between each request and response for readability. | ||
- Add timestamp of each request and response to the beginning of each request and response. | ||
- Add the response body including [error code](https://github.com/opencontainers/distribution-spec/blob/main/spec.md#error-codes) and the metadata of processed OCI object (e.g. image manifest) to the debug logs. |
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 should never print out binary response body. We need a list of printable content types such as application/json
.
|
||
Currently, the output of ORAS `--verbose` flag only exists in oras `pull/push/attach/discover` commands, which prints out detailed status output and metadata output. Since ORAS v1.2.0, progress bar is enabled in `pull/push/attach` by default, thus the ORAS output is already verbose on a terminal. | ||
|
||
It is intended for end-users who want to observe the detailed file operation when using ORAS. It gives users a comprehensive view of what the tool is doing at every step and how long does it take when push or pull a file. |
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 does "it" refer to?
**Current debug log** | ||
|
||
``` | ||
[DEBU0000] Request #0 | ||
> Request URL: "https://ghcr.io/v2/oras-project/oras/manifests/v1.2.0" | ||
> Request method: "GET" | ||
> Request headers: | ||
"User-Agent": "oras/1.2.0+Homebrew" | ||
"Accept": "application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, application/vnd.oci.artifact.manifest.v1+json" | ||
DEBU[0001] Response #0 | ||
< Response Status: "401 Unauthorized" | ||
< Response headers: | ||
"Content-Length": "73" | ||
"X-Github-Request-Id": "9FC6:30019C:17C06:1C462:66AD0463" | ||
"Content-Type": "application/json" | ||
"Www-Authenticate": "Bearer realm=\"https://ghcr.io/token\",service=\"ghcr.io\",scope=\"repository:oras-project/oras:pull\"" | ||
"Date": "Fri, 02 Aug 2024 16:08:04 GMT" | ||
DEBU[0001] Request #1 | ||
> Request URL: "https://ghcr.io/token?scope=repository%3Aoras-project%2Foras%3Apull&service=ghcr.io" | ||
> Request method: "GET" | ||
> Request headers: | ||
"User-Agent": "oras/1.2.0+Homebrew" | ||
DEBU[0002] Response #1 | ||
< Response Status: "200 OK" | ||
< Response headers: | ||
"Content-Type": "application/json" | ||
"Docker-Distribution-Api-Version": "registry/2.0" | ||
"Date": "Fri, 02 Aug 2024 16:08:05 GMT" | ||
"Content-Length": "69" | ||
"X-Github-Request-Id": "9FC6:30019C:17C0D:1C46C:66AD0464" | ||
``` |
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.
Actually, debug logs are showed differently in TTY and non-TTY. For example,
in TTY:
DEBU[0000] Request #0
> Request URL: "http://localhost:5000/v2/240923test1/manifests/v1"
> Request method: "HEAD"
...
in non-TTY:
time=2024-10-10T18:45:10+08:00 level=debug msg=Request #0
> Request URL: "http://localhost:5000/v2/240923test1/manifests/v1"
> Request method: "HEAD"
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.
Should non-tty use the json formatter? Looks like it has everything else in there for structured logging.
Signed-off-by: Feynman Zhou <[email protected]>
What this PR does / why we need it:
This proposal document aims to:
--verbose
and--debug
options.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #1091