The SmallPeerInfo
property is a new feature in Ditto 4.4.0. It allows configuration of the collection and sync of Small Peer Info from across your distributed network.
Once the SmallPeerInfo
property is enabled in your application, you can access the Small Peer Info internal collection on the Ditto Portal Data Browser. This collection contains a variety of details about your small peers: what transports are connected, whether a local peer is connected to the Big Peer, etc.
Usage
Collecting Small Peer Info
Small peer info defaults to "off", but it's easy to enable with the following SDK code:
ditto.smallPeerInfo.isEnabled = true
This will begin writing to the Small Peer Info collection at five minute intervals (this interval is currently not configurable).
Additionally, you'll need to set sync scope to "Big Peer only" to allow gathered data to be sent to the Big Peer:
ditto.smallPeerInfo.syncScope = .bigPeerOnly
Once these two lines are included, Ditto will begin replicating small peer info to the Big Peer (but not other small peers).
Viewing Small Peer Info
Once enabled, Small Peer Info is visible in the Ditto Portal Data Browser.
Here is an example of a Small Peer Info collection. Ditto is continually improving this information, so the exact JSON format may change.
Collecting Device Logs
In addition to information about which peers are connected, etc., Small Peer Info can include Ditto logs from small peer devices.
Because of the amount of data being logged constantly, these logs are not automatically synced and must be explicitly requested.
First, make sure that logging is enabled with your desired logging level.
Viewing Device Logs
Device logs are viewable in the Device Dashboard on Ditto Portal. If you don't already have Device Dashboard enabled, please email support@ditto.live.
Once enabled, device logs can be downloaded from the Ditto Portal Device Dashboard. Click the three dot icon on the right and request logs for the desired peer.
Please note that it can take up to five minutes to receive the log once it's been requested. Then click "Download" to save.
Code samples
Swift
ditto.smallPeerInfo.isEnabled = true
ditto.smallPeerInfo.syncScope = .bigPeerOnly
Kotlin
ditto.smallPeerInfo.isEnabled = true
ditto.smallPeerInfo.syncScope = DittoSmallPeerInfoSyncScope.BigPeerOnly
JavaScript
ditto.smallPeerInfo.isEnabled = true
await ditto.smallPeerInfo.setSyncScope('BigPeerOnly')
Java
ditto.smallPeerInfo.isEnabled = true
ditto.smallPeerInfo.syncScope = DittoSmallPeerInfoSyncScope.BigPeerOnly
Notes
- The sync scope defaults to “Local Peer Only", so if sync scope is not set to "Big Peer only", the collected information will not be replicated. It will persist on the local device in the
__small_peer_info
collection. - Syncing small peer info with other small peers is currently not supported by the API, but is an upcoming feature. This will enable a use case like an IT admin in the field being able to sync small peer info to their admin-enabled device.
Comments
0 comments
Please sign in to leave a comment.