Select queries are not instrumented correctly #3073
Labels
enhancement
New feature or request
Platform: Android
Platform: Java
Type: Bug
Something isn't working
Description
In Android
select
queries return aCursor
, and the query is actually executed when the Cursor is read.Our instrumentation wraps the
query
method, which is always fast.Here is an example of a transaction with a slow query
select * from storeitem where first_name regexp '.*.*.*.*1'
. The Dao span is correct, but thedb.sql.query
span is 1ms long, which is wrong. The related profile gives some more insight.This affects only select queries, as updates don't return a cursor.
We should wrap the cursor with a custom wrapper and override the correct methods.
Some challenges:
getCount()
fills the data only the first time, so we should account for thatonMove()
is not available inCursor
, but only inSQLiteCursor
. But we get aCursor
and we should return aCursor
SQLiteCursor
with reflection failedThe text was updated successfully, but these errors were encountered: