- Client SDK Diagnostics - Implement a sync diagnostics screen/view in your client application that provides critical sync information.
- Issue Alerts - Trigger notifications when the PowerSync replicator runs into errors.
Client SDK Diagnostics
It’s important to know what’s going on with a PowerSync enabled client application, this becomes useful during debugging issues with end users. We recommend adding a view/screen in your application that offers diagnostic information about a client. Here you would want to add the following client specific information:connected
- Boolean; True if the client is connected to the PowerSync Service instance. False if not.connecting
- Boolean; True if the client is attempting to connect to the PowerSync Service instance. False if not.uploading
- Boolean; If the client has a network connection and changes in the upload queue are present this will be set to true when the client attempts to upload changes to the backend API in theuploadData
function. This option can be found on thedataFlowStatus
object.downloading
- Boolean; If the client is connected to the PowerSync Service and new data is available, this will be set to true, else it will be false. This option can be found on thedataFlowStatus
object.hasSynced
- Boolean; True if the client completed a full sync at least once. False if the client never completed a full sync.lastSyncedAt
- DateTime; Timestamp of when the client last completed a full sync.
SyncStatus
class that can be used to access the fields mentioned above.
In addition to the SyncStatus
options above, it’s also a good idea to see what the current length of the upload queue looks like.
The upload queue contains all local mutations that need to be processed by the client specific uploadData
implementation.
To get this information you can simply count the number of rows present in the internal ps_crud
SQLite table e.g.
Issue Alerts
PowerSync Cloud
The PowerSync Cloud dashboard offers features and functionality that makes it easy to monitor the replication process from your source DB to your PowerSync Service instance and raise alerts when issues occur. We highly recommend you read the sections below and configure alerts as suggested.Replication Issue Alerts
At a minimum we recommend creating an issue alert forReplication issues
. For details instructions on how to configure Issue Alerts, see the Issue Alerts section of the Monitoring and Alerting docs.
Here’s quick example of what the Issue alert should look like to catch replication issues:
