Commit Detail
Commit 35bba0f
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.
Files changed
2 files changed~2 modified