mozilla / makedrive

[RETIRED] Webmaker Filesystem
Mozilla Public License 2.0
352 stars 33 forks source link

Record and log more and better info about connected clients. #415

Closed humphd closed 10 years ago

humphd commented 10 years ago

I really have wanted better details in our logs about clients/syncs. This is a step in that direction:

[2014-10-14T16:27:42.838Z]  INFO: MakeDrive/36257 on hospitality-5.local: Client connected
    client: {
      "username": "humphd",
      "id": "49e93bb8-d319-4f07-b0fa-0708e71f4f08",
      "state": "CONNECTING",
      "path": "/",
      "agent": "Chrome 38.0.2125 / Mac OS X 10.6.8",
      "device": "Other 0.0.0",
      "downstreamSyncs": 0,
      "upstreamSyncs": 0
    }
[2014-10-14T16:27:43.706Z]  INFO: MakeDrive/36257 on hospitality-5.local: Completed downstream sync to client in 863 ms
    client: {
      "username": "humphd",
      "id": "49e93bb8-d319-4f07-b0fa-0708e71f4f08",
      "state": "LISTENING",
      "path": "/",
      "agent": "Chrome 38.0.2125 / Mac OS X 10.6.8",
      "device": "Other 0.0.0",
      "downstreamSyncs": 1,
      "upstreamSyncs": 0
    }

This adds a ClientInfo module that tracks client info by client id, and deals with extracting data about browser/device, how many times we've synced, how long the last sync took, etc.

Later we should probably refactor this a bit to add SyncInfo that can track more detailed info about a sync (number of files, size of files, ...).

alicoding commented 10 years ago

r+