You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix user tracing of DO SQL queries and add system tracing of them
The user tracing of DO SQL queries was setting the rows_read tag too
soon, before the cursor actually iterated over the result rows. This
lead to under-reporting of rows_read in these trace spans.
We can fix this by passing the span into the Cursor, allowing it to be
finalized when the query itself is done. For some queries this will
still be immediately because there aren't result rows to iterate over,
but for others this will keep the span held open until either the result
rows have all been read or the cursor has been canceled/closed.
There's still one case here that's a little awkward: if the query throws
an exception, we don't add any tags at all (either before this change or
after it). We may want to add a try-catch here that adds an error span
to the traces when running the sql statement throws an exception, but we
can decide on that separately since it does come involve making the code
more complex and adding a bit of runtime overhead.
0 commit comments