getditto / DittoSwiftTools

Diagnostic and Debugging Tools for DittoSwift
MIT License
9 stars 2 forks source link

Extend the DiskUsage tool to be a HealthMetricProvider #118

Closed bplattenburg closed 6 months ago

bplattenburg commented 6 months ago

Extends the existing DiskUsage tool such that DiskUsageViewModel is now a HealthMetricProvider that gives the current state of the disk usage health.

Sample dittotools_devices document output including this tool:

{
  "_id": "CF2EC454-DB4D-4BE2-BBC7-F6D58B557312",
  "_schema": "1",
  "healthMetrics": {
    "DittoDiskUsage": {
      "details": {
        "__ditto_lock_file": "6 bytes",
        "ditto_attachments": "4.2 MB",
        "ditto_auth": "5 KB",
        "ditto_auth_tmp": "64 bytes",
        "ditto_logs": "256 bytes",
        "ditto_replication": "4.4 MB",
        "ditto_store": "4.3 MB",
        "ditto_tempfile": "64 bytes",
        "lastUpdated": "9:11:58 AM",
        "rootPath": "ditto-pos-demo",
        "totalSize": "12.9 MB"
      },
      "isHealthy": true
    },
    "DittoPermissionsHealth_Bluetooth": {
      "details": {
        "Authorization Status": "Allowed Always",
        "Current State": "Unsupported (Simulator)"
      },
      "isHealthy": true
    },
    "DittoPermissionsHealth_WiFi": {
      "details": {},
      "isHealthy": true
    }
  },
  "lastUpdated": "2024-05-15T13:12:06Z",
  "metadata": {
    "deviceAttributes": {},
    "deviceName": "",
    "location": {
      "expectedDeviceCount": 0,
      "locationId": "ATL-001",
      "locationName": ""
    },
    "locationAttributes": {}
  },
  "peerKey": "pkAocCgkMDq9SKA6t3VhJm0WH4HH03d/2CwRA+HhB8Klz2xfevxv0=",
  "presenceSnapshotDirectlyConnectedPeers": {},
  "presenceSnapshotDirectlyConnectedPeersCount": 0,
  "sdk": "iOS v4.7.1",
  "secondsInterval": 30
}

This also includes some leftover cleanup from the iOS 14 minimum bump that was missed in https://github.com/getditto/DittoSwiftTools/pull/112

Closes #116