Add detailed request logging#1035
Closed
wfchandler wants to merge 1 commit intomainfrom
Closed
Conversation
Collaborator
Author
Currently we don't offer a way to expose the details of the API requests
the CLI or other SDK consumers to users, making troubleshooting
difficult.
With the new `middleware` feature available in Progenitor, we can now
inject our own logger using the `reqwest-tracing` crate. This gives us
output like:
./target/debug/oxide --debug disk list --project will | jq .
{
"timestamp": "2025-02-26T17:29:23.354297Z",
"level": "DEBUG",
"fields": {
"message": "close",
"time.busy": "16.7ms",
"time.idle": "365ms"
},
"target": "oxide::tracing",
"span": {
"host": "oxide.sys.r3.oxide-preview.com",
"http.request.method": "GET",
"http.response.content_length": 998,
"http.response.status_code": 200,
"oxide.request_id": "c5e7d65e-bcb2-4ade-a817-6f13b681b19b",
"url": "https://oxide.sys.r3.oxide-preview.com/v1/disks?project=will",
"name": "Oxide API Request"
},
"spans": []
}
We will also log the first KiB of the request body, if present. This
should be enough to capture the details human-readable requests, e.g. an
OxQL query, but avoid too much noise from something like a disk import.
The `--debug` flag will enable debug logs for both the CLI and any
dependencies, such as `hyper`. To view only CLI logs, set
`RUST_LOG=oxide=debug`.
Closes #1014.
c6a1fd2 to
5a151b4
Compare
Collaborator
Author
|
Closing in favor of #1053 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently we don't offer a way to expose the details of the API requests the CLI or other SDK consumers to users, making troubleshooting difficult.
With the new
middlewarefeature available in Progenitor, we can now inject our own logger using thereqwest-tracingcrate. This gives us output like:We will also log the first KiB of the request body, if present. This should be enough to capture the details human-readable requests, e.g. an OxQL query, but avoid too much noise from something like a disk import.
The
--debugflag will enable debug logs for both the CLI and any dependencies, such ashyper. To view only CLI logs, setRUST_LOG=oxide=debug.Closes #1014.