@cryptotaxi247 / kubo / commits / 1c3e590c8

Add event logging around path resolution

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

Forrest Weston committed Nov 14, 2017 at 17:39 UTC 1c3e590c886297ce8bd1649336a7c869acd4c760
2 files changed +3
core/pathresolver.go
+1
@@ -22,6 +22,7 @@ var ErrNoNamesys = errors.New(
22 // entries and returning the final node.
23 func Resolve(ctx context.Context, nsys namesys.NameSystem, r *path.Resolver, p path.Path) (node.Node, error) {
24 if strings.HasPrefix(p.String(), "/ipns/") {
25 + defer log.EventBegin(ctx, "resolveIpnsPath").Done()
26 // resolve ipns paths
27
28 // TODO(cryptix): we sould be able to query the local cache for the path
path/resolver.go
+2
@@ -135,6 +135,7 @@ func (s *Resolver) ResolvePathComponents(ctx context.Context, fpath Path) ([]nod
135 if err != nil {
136 return nil, err
137 }
138 + defer log.EventBegin(ctx, "resolvePathComponents", logging.LoggableMap{"parts": parts, "cid": h}).Done()
139
140 log.Debug("resolve dag get")
141 nd, err := s.DAG.Get(ctx, h)
@@ -154,6 +155,7 @@ func (s *Resolver) ResolvePathComponents(ctx context.Context, fpath Path) ([]nod
155 // would retrieve "baz" in ("bar" in ("foo" in nd.Links).Links).Links
156 func (s *Resolver) ResolveLinks(ctx context.Context, ndd node.Node, names []string) ([]node.Node, error) {
157
158 + defer log.EventBegin(ctx, "resolveLinks", logging.LoggableMap{"names": names}).Done()
159 result := make([]node.Node, 0, len(names)+1)
160 result = append(result, ndd)
161 nd := ndd // dup arg workaround