Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Sqlite instrumentation #502

Merged
merged 8 commits into from
Jun 8, 2023
Merged

New Sqlite instrumentation #502

merged 8 commits into from
Jun 8, 2023

Conversation

stefanosiano
Copy link
Member

@stefanosiano stefanosiano commented Jun 1, 2023

📜 Description

auto install of sentry-android-sqlite module
added Sqlite new instrumentation

💡 Motivation and Context

We want to refactor the database instrumentation moving as much as we can to the Java side, decreasing the need of bytecode manipulation.
The sdk side was convered in getsentry/sentry-java#2722
Here is the tracking issue: #401

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • No breaking changes

🔮 Next steps

added Sqlite new instrumentation
@github-actions
Copy link
Contributor

github-actions bot commented Jun 1, 2023

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against fad50b6

@stefanosiano stefanosiano marked this pull request as ready for review June 1, 2023 20:06
Copy link
Member

@romtsn romtsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome job! There's 2 points I think that need attention - compatibility and a bytecode visitor test, but the rest is looking really good.

CHANGELOG.md Show resolved Hide resolved
descriptor: String?,
isInterface: Boolean
) {
if (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think there's one uncovered case with this approach, for example:

private val delegate: OpenHelper.Factory

private fun wrap(configuration: OpenHelper.Configuration): OpenHelper {
  return delegate.create(configuration)
}

override fun create(configuration: OpenHelper.Configuration): OpenHelper = wrap(configuration)

in this case we'd still instrument it, because delegate.create(configuration) is outside the create method scope. But I think this is still fine and it's more of an edge case; we can always come back to it if someone reports an issue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another weird thing - I tried to run it locally and decompile afterwards, and I see this weird bridge synthetic create method in AutoClosingRoomOpenHelperFactory:
image

However, I have no idea where it's coming from, the implementation doesn't look much different from the other open helpers they have. So I'm guessing it's still fine, because the other create method is properly not instrumented. Maybe it's a bug in the decompiler tool not sure

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bottom line: nothing to address here, just we should be aware of both of these things :)

restored old db instrumentation for older SDK versions
added Visitor test for FrameworkSQLiteOpenHelperFactory
restored old db instrumentation for older SDK versions
added Visitor test for FrameworkSQLiteOpenHelperFactory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants