Skip to content

Commit

Permalink
fix(datastore): Adding tracing to run method (#9602)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhshkh committed Apr 16, 2024
1 parent cf33b55 commit a5e197c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion datastore/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,15 @@ func (c *Client) GetAll(ctx context.Context, q *Query, dst interface{}) (keys []
}

// Run runs the given query in the given context.
func (c *Client) Run(ctx context.Context, q *Query) *Iterator {
func (c *Client) Run(ctx context.Context, q *Query) (it *Iterator) {
ctx = trace.StartSpan(ctx, "cloud.google.com/go/datastore.Query.Run")
defer func() { trace.EndSpan(ctx, it.err) }()
it = c.run(ctx, q)
return it
}

// run runs the given query in the given context.
func (c *Client) run(ctx context.Context, q *Query) *Iterator {
if q.err != nil {
return &Iterator{err: q.err}
}
Expand Down

0 comments on commit a5e197c

Please sign in to comment.