Skip to content

Added traceLog function in registry.go#2587

Closed
shin- wants to merge 2 commits intomoby:masterfrom
shin-:registry_tracelogs
Closed

Added traceLog function in registry.go#2587
shin- wants to merge 2 commits intomoby:masterfrom
shin-:registry_tracelogs

Conversation

@shin-
Copy link
Contributor

@shin- shin- commented Nov 7, 2013

This will help us report server faults more accurately when communicating with the index/registry.

/cc @samalba

@vieux
Copy link
Contributor

vieux commented Nov 7, 2013

I understand this is useful, but still, even in debug, I'm not found of displaying HTML in the debug output.

Try: docker pull dsdsa

@creack
Copy link
Contributor

creack commented Nov 7, 2013

I think this is an issue from the index. /cc @kencochrane

Copy link
Contributor

Choose a reason for hiding this comment

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

This should be a debug message. If the index sends erroneous HTML content (which it does currently for non-existent images), you don't want that in the daemon logs unless you're in debug mode.

@samalba
Copy link
Contributor

samalba commented Nov 12, 2013

Just to give some background for this PR, we discussed this feature with Joffrey before. The idea is to make push/pull errors useful for easy debugging. Right now copy/pasting errors are useless and does not bring any info to debug (usually you have to relaunch the deamon in debug, retry and still not have enough data...).

I did not test the PR yet...

@shykes
Copy link
Contributor

shykes commented Nov 12, 2013

Basically when you pull a non-existent image, the body of the 404 is a very large html error page.

@samalba @kencochrane I see the reason for the feature, but I think it will be really weird to display tons of html output.

Maybe only print the body only if content-type is application/json?

Otherwise maybe we could add a "debug" feature on the index where logged in users could retrieve their failed queries - it's more work but could be a really awesome way to give support.

@solomonstre
@docker

On Mon, Nov 11, 2013 at 8:15 PM, Sam Alba [email protected]
wrote:

Just to give some background for this PR, we discussed this feature with Joffrey before. The idea is to make push/pull errors useful for easy debugging. Right now copy/pasting errors are useless and does not bring any info to debug (usually you have to relaunch the deamon in debug, retry and still not have enough data...).

I did not test the PR yet...

Reply to this email directly or view it on GitHub:
#2587 (comment)

@samalba
Copy link
Contributor

samalba commented Nov 12, 2013

I think we should not print html anyway. But we need the raw content for
other errors. 3 options:

1- print 1024 chars only for the body (then html will be stripped)

2- read the first chars, if we detect html, we don't print it. We print any
other content

3- both

On Tuesday, November 12, 2013, Solomon Hykes wrote:

Basically when you pull a non-existent image, the body of the 404 is a
very large html error page.

@samalba @kencochrane I see the reason for the feature, but I think it
will be really weird to display tons of html output.

Maybe only print the body only if content-type is application/json?

Otherwise maybe we could add a "debug" feature on the index where logged
in users could retrieve their failed queries - it's more work but could be
a really awesome way to give support.

@solomonstre
@docker

On Mon, Nov 11, 2013 at 8:15 PM, Sam Alba <[email protected]<javascript:_e({}, 'cvml', '[email protected]');>>

wrote:

Just to give some background for this PR, we discussed this feature with
Joffrey before. The idea is to make push/pull errors useful for easy
debugging. Right now copy/pasting errors are useless and does not bring any
info to debug (usually you have to relaunch the deamon in debug, retry and
still not have enough data...).

I did not test the PR yet...

Reply to this email directly or view it on GitHub:
#2587 (comment)


Reply to this email directly or view it on GitHubhttps://github.com//pull/2587#issuecomment-28269445
.

@sam_alba

@shykes
Copy link
Contributor

shykes commented Nov 28, 2013

@shin- could you re-open this with a check to only print error body when 1) content-type is application/json and 2) DEBUG is enabled?

Thanks! In the meantime I'm closing this for bookkeeping.

@shykes shykes closed this Nov 28, 2013
@samalba
Copy link
Contributor

samalba commented Nov 28, 2013

I'd print this even if debug is disabled. It's a PITA to always reply "please retry in debug". It makes the output not useful for understanding a problem. However I agree for the content-type.

@shin- shin- reopened this Dec 3, 2013
@shin-
Copy link
Contributor Author

shin- commented Dec 3, 2013

Added truncating if response body is longer than 1024 bytes. @samalba @shykes

@samalba
Copy link
Contributor

samalba commented Dec 4, 2013

LGTM

@crosbymichael
Copy link
Contributor

@shin- You can use net/http/httputil to format and dump the response and avoid all these Errorf calls.

Copy link
Contributor

Choose a reason for hiding this comment

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

You should not read the entire request into memory if you are only going to write 1024 bytes. You could crash the daemon by sending a large payload. If you only want 1024 bytes, only read 1024 bytes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also be sure to close the response Body to avoid leaks

@vieux
Copy link
Contributor

vieux commented Dec 16, 2013

@shin- could you update this to match @crosbymichael requirements ?
Also what do you think about generating a .dump file somewhere, instead of printing everything in the daemon log ?

@crosbymichael
Copy link
Contributor

Closing this for now to help with bookkeeping, feel free to reopen when changes are made.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants