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

Feat/log/uuid #4392

Merged
merged 3 commits into from
Nov 18, 2017
Merged

Feat/log/uuid #4392

merged 3 commits into from
Nov 18, 2017

Conversation

frrist
Copy link
Member

@frrist frrist commented Nov 15, 2017

Add an uuid/requestId to root context - this will add a requestId to event logs resulting from a command
Add event logs around path resolution - said logs make use of requestId

@ghost ghost assigned frrist Nov 15, 2017
@ghost ghost added the status/in-progress In progress label Nov 15, 2017
Every log event resulting from a command will have a uuid associated with it

License: MIT
Signed-off-by: Forrest Weston <forrest@protocol.ai>
License: MIT
Signed-off-by: Forrest Weston <forrest@protocol.ai>
path/resolver.go Outdated
@@ -135,6 +135,7 @@ func (s *Resolver) ResolvePathComponents(ctx context.Context, fpath Path) ([]nod
if err != nil {
return nil, err
}
defer log.EventBegin(ctx, "resolvePathComponents", logging.LoggableMap{"parts": parts, "cid": h}).Done()
Copy link
Member Author

Choose a reason for hiding this comment

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

In the case that there is an error in the execution of this method, do we want to add a loggable error to the event log (see L143)?

Copy link
Member

Choose a reason for hiding this comment

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

IMO, yes. We'd probably also want to log the error from L146 as well. Also, this event should probably go at the top and include any errors from SplitAbsPath.

Copy link
Member

Choose a reason for hiding this comment

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

You can save the result value of EventBegin and add additional data to it.

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

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

Overall, LGTM.

Gripe: libp2p/go-libp2p-loggables#12

path/resolver.go Outdated
@@ -135,6 +135,7 @@ func (s *Resolver) ResolvePathComponents(ctx context.Context, fpath Path) ([]nod
if err != nil {
return nil, err
}
defer log.EventBegin(ctx, "resolvePathComponents", logging.LoggableMap{"parts": parts, "cid": h}).Done()
Copy link
Member

Choose a reason for hiding this comment

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

IMO, yes. We'd probably also want to log the error from L146 as well. Also, this event should probably go at the top and include any errors from SplitAbsPath.

@@ -137,6 +138,7 @@ func (i internalHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}

ctx, cancel := context.WithCancel(node.Context())
ctx = logging.ContextWithLoggable(ctx, loggables.Uuid("requestId"))
Copy link
Member

Choose a reason for hiding this comment

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

I would move this down below the defer cancel.

Copy link
Member

@whyrusleeping whyrusleeping left a comment

Choose a reason for hiding this comment

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

One nitpick, then LGTM

If an error occurs during an event add it to the events metadata

License: MIT
Signed-off-by: Forrest Weston <forrest@protocol.ai>
@whyrusleeping
Copy link
Member

@victorbjelkholm whatsup with jenkins?

@whyrusleeping whyrusleeping added this to the go-ipfs 0.4.14 milestone Nov 16, 2017
@whyrusleeping whyrusleeping merged commit b01e48a into master Nov 18, 2017
@ghost ghost removed the status/in-progress In progress label Nov 18, 2017
@whyrusleeping whyrusleeping deleted the feat/log/uuid branch November 18, 2017 18:25
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.

5 participants