-
Notifications
You must be signed in to change notification settings - Fork 49
Add a debugMode flag to log queries to the performance timeline #229
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
Conversation
🦋 Changeset detectedLatest commit: 05f3dbd The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM . This is an awesome feature.
Is it documented? |
@guillempuche It's not properly documented yet, but you can see how it's used in the diagnostics app: powersync-js/tools/diagnostics-app/src/library/powersync/ConnectionManager.ts Lines 26 to 32 in 05f3dbd
I'd recommend using something like this to only enable debugMode in development: debugMode: process.env.NODE_ENV != 'production' The feature just displays queries in the "Performance" tab of Chrome's developer tools (after recording) - see the screenshots above. |
Thanks Ralf @rkistner |
This displays all SQL queries on the performance timeline. Currently only implemented in the Web SDK.
This excludes the time waiting for the global transaction lock, but includes all overhead in worker communication. This means you won't see concurrent queries in most cases.
This includes internal statements from PowerSync, including queries saving sync data, and begin/commit statements. It does not include internal statements from powersync-sqlite-core.
TODO:
The flag currently defaults to false ifUpdated default to false, requiring explicit opt-in for now.process.env.NODE_ENV == 'production'
, similar to what React does. All other cases default to true. Should we perhaps be more conservative and require explicit opt-in, since the queries could be considered semi-sensitive data?Example of the diagnostics app during initial sync: