Skip to content

WIP do not merge: Dump HTTP operations#201

Closed
mtrmac wants to merge 1 commit intocontainers:mainfrom
mtrmac:http-dump
Closed

WIP do not merge: Dump HTTP operations#201
mtrmac wants to merge 1 commit intocontainers:mainfrom
mtrmac:http-dump

Conversation

@mtrmac
Copy link
Copy Markdown
Collaborator

@mtrmac mtrmac commented Jan 7, 2017

Quite often it has been useful to dump the full HTTP request and response headers, and sometimes fuill bodies, for debugging; we probably should make that possible either automatically at the “debug” log level, or when the user sets an option.

This is by no means a workable implementation for that, but I’ve written exactly this hack two or three times now, so right now I am at least recording it for posterity, expecting that rebasing it will be easier than rewriting it.

A real implementation should, I guess, wrap a http.RoundTripper or perhaps http.Client (or just http.Client.Do?), or perhaps using net/http/httptrace somehow.

@runcom
Copy link
Copy Markdown
Member

runcom commented Jan 7, 2017

Isn't this adding overhead to the command? I'm fine with this, just want to make sure we don't wait that much dumping req/res.

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Jan 9, 2017

Any way to pass down a debug flag? Or just rebuild with a DEBUG Tag?

@mtrmac
Copy link
Copy Markdown
Collaborator Author

mtrmac commented Jan 9, 2017

Isn't this adding overhead to the command?

Yes, and it completely clutters the debugging output. As I said

This is by no means a workable implementation

@mtrmac
Copy link
Copy Markdown
Collaborator Author

mtrmac commented Jan 9, 2017

Any way to pass down a debug flag? Or just rebuild with a DEBUG Tag?

We have a types.SystemContext which can be used to pass down such flags, yes.

giuseppe pushed a commit to giuseppe/image that referenced this pull request Jan 24, 2017
@mtrmac mtrmac force-pushed the http-dump branch 4 times, most recently from 27bdf9e to eb7a685 Compare February 6, 2017 20:40
@mtrmac mtrmac force-pushed the http-dump branch 3 times, most recently from a49b9fb to a7f917d Compare March 2, 2017 20:15
@mtrmac mtrmac force-pushed the http-dump branch 2 times, most recently from 7db1b51 to 4a5b2b5 Compare March 4, 2017 04:40
@mtrmac mtrmac force-pushed the http-dump branch 5 times, most recently from e7030b7 to b8d0cc5 Compare April 4, 2017 15:06
@mtrmac mtrmac force-pushed the http-dump branch 2 times, most recently from b727325 to ef4adfb Compare April 10, 2017 14:50
@mtrmac mtrmac force-pushed the http-dump branch 2 times, most recently from 2f2b680 to 974b583 Compare April 26, 2017 17:25
@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Jan 29, 2018

@mtrmac Could you open a trello card with an intern flag, so we could have an intern work on this next summer.

@mtrmac
Copy link
Copy Markdown
Collaborator Author

mtrmac commented Feb 6, 2018

@mtrmac Could you open a trello card with an intern flag, so we could have an intern work on this next summer.

https://trello.com/c/xrAwKleu/542-containers-image-http-dumps-intern

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Apr 25, 2019

@mtrmac @vrothberg What is the state of this PR? Should we rebase and move forward with it or should we close it?

@mtrmac
Copy link
Copy Markdown
Collaborator Author

mtrmac commented Jun 1, 2019

Rebased, but this still needs turning into a types.SystemContext option + CLI options in users of the library.

@vrothberg
Copy link
Copy Markdown
Member

Meeting notes: use logrus.Trace*

@mtrmac
Copy link
Copy Markdown
Collaborator Author

mtrmac commented Jan 19, 2021

logrus has a Trace log level, probably a good way to opt in now.

@mtrmac
Copy link
Copy Markdown
Collaborator Author

mtrmac commented Jan 19, 2021

Updated:

  • To centralize the dumping implementation (still just a helper method, not a http.RoundTripper)
  • In that dumping implementation, to log errors as well
  • To use logrus.Tracef, if enabled.

WARNING: Using this will cause trace-level logs to include all credentials (Basic auth, bearer tokens, etc.). Is that OK? Applications including this should probably warn about that at least in documentation.

Copy link
Copy Markdown
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks for the warning. Let's add that to the release notes.

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Jan 20, 2021

Unless we can easily hide this information, then yes we should document this in the release notes. As well as in the man pages if possible. Perhaps containers-transports.5.md Under the "docker" section?

@vrothberg
Copy link
Copy Markdown
Member

Unless we can easily hide this information, then yes we should document this in the release notes. As well as in the man pages if possible. Perhaps containers-transports.5.md Under the "docker" section?

And in the man pages of the tools (i.e., the --debug and --log-level flags).

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Aug 27, 2021

Just needs to have an update to the transports man page.

@mtrmac
Copy link
Copy Markdown
Collaborator Author

mtrmac commented Jun 27, 2024

In addition to the previously-noted concerns about opt-in, this should almost certainly be reworked to become a http.RoundTripper, wrapper, so that all redirects are logged.

@kwilczynski
Copy link
Copy Markdown
Member

This would be very useful for troubleshooting issues with access to remote registries. At the moment, I tend to opt for a set up with a transparent TLS proxy to snoop on this type of traffic, but having a log that exposes this type of data that can be easily enabled would be ideal.

@mtrmac
Copy link
Copy Markdown
Collaborator Author

mtrmac commented Jul 9, 2024

For the record, Red Hat internal tracking: https://issues.redhat.com/browse/RHEL-36783

WARNING: This includes credentials, if any.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
@jankaluza
Copy link
Copy Markdown
Member

Hi, and thank you for your contribution!

We’ve recently migrated this repository into a new monorepo: containers/container-libs along with other repositories

As part of this migration, this repository is no longer accepting new Pull-Requests and therefore this Pull-Request is being closed.

Thank you very much for your contribution. We would appreciate your continued help in migrating this PR to the new container-libs repository. Please let us know if you are facing any issues.

You can read more about the migration and the reasoning behind it in our blog post: Upcoming migration of three containers repositories to monorepo.

Thanks again for your work and for supporting the containers ecosystem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature A request for, or a PR adding, new functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants