Skip to content
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

allow basic logging for http Get err with RegisterErrLogFn #81

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

qbig
Copy link

@qbig qbig commented Apr 11, 2017

attempt to improve this :

func (g *Group) load(ctx Context, key string, dest Sink) (value ByteView, destPopulated bool, err error) {
// TODO(bradfitz): log the peer's error? keep
// log of the past few for /groupcachez? It's
// probably boring (normal task movement), so not
// worth logging I imagine.

@googlebot
Copy link
Collaborator

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@qbig
Copy link
Author

qbig commented Apr 11, 2017

I signed it!

@googlebot
Copy link
Collaborator

CLAs look good, thanks!

groupcache.go Outdated
@@ -121,6 +122,20 @@ func RegisterNewGroupHook(fn func(*Group)) {
newGroupHook = fn
}

// RegisterErrLogFn registers a log func that is used for http error logging
Copy link
Contributor

Choose a reason for hiding this comment

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

The "Fn" suffix isn't consistent with the naming elsewhere in Go in general or this file in particular. This file uses "Hook".

Also, end sentences with a period. And http should be HTTP.

Copy link
Author

Choose a reason for hiding this comment

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

cool. will update.

Copy link
Author

Choose a reason for hiding this comment

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

updated

groupcache.go Outdated
// log of the past few for /groupcachez? It's
// probably boring (normal task movement), so not
// worth logging I imagine.
logErr(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

What about other context? Do we want to include the key?

Copy link
Author

Choose a reason for hiding this comment

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

Good point! Just wondering how specific errLogFn func(error) should be ?

logErr(fmt.Errorf("g.getFromPeer(ctx, peer, key), ctx: %+v, peer: %+v, key: %+v, err: %+v", ctx, peer, key, err))

or

logErr(ctx, peer, key, err)

Copy link
Author

Choose a reason for hiding this comment

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

updated

rename to follow hook function name convention, log more ctx info
@qbig
Copy link
Author

qbig commented Apr 12, 2017

updated:)

@qbig
Copy link
Author

qbig commented Apr 12, 2017

sorry.. but was there a new review? #81 (review) didn't show anything

@qbig
Copy link
Author

qbig commented Apr 13, 2017

@bradfitz any other parts I could improve on this diff ?

Qiao Liang added 2 commits May 4, 2017 10:04
…ontext info (ctx, peer, key, err)

rename to follow hook function name convention, log more ctx info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants