From a5e197c78cb112836768f012c7ee4535dec8b9f5 Mon Sep 17 00:00:00 2001 From: Baha Aiman Date: Mon, 15 Apr 2024 17:20:38 -0700 Subject: [PATCH] fix(datastore): Adding tracing to run method (#9602) --- datastore/query.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/datastore/query.go b/datastore/query.go index 20125b6f93f5..0bfe901a14f5 100644 --- a/datastore/query.go +++ b/datastore/query.go @@ -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} }