Skip to content

Response Format Debate

Guido García edited this page Jul 28, 2014 · 6 revisions

Initial release (0.x)

{
  "timestamp": 1389004812756,
  "uptime": 2187,
  "pid": 5761,
  "memory": {
    "rss": 21147648,
    "heapTotal": 11344896,
    "heapUsed": 4341552
  },
  "versions": {
    "http_parser": "1.0",
    "node": "0.10.22",
    "v8": "3.14.5.9",
    "modules": "11",
    "openssl": "1.0.1e"
  },
  "title": "node",
  "arch": "x64",
  "platform": "darwin",
  "argv": [
    "node",
    "/Users/guido/express-ping/examples/server.js"
  ],
  "application": {
    "name": "express-ping",
    "version": "0.2.0"
  },
  "os": {
	"hostname": "tizona.local",
	"uptime": 307199
  }
}

Cons:

  • Separation between application information and system status is not clear.

Proposal (1.x)

{
  "timestamp": 1389004812756,
  "uptime": 2187,
  "application": { // HERE GOES THE STATIC INFO ABOUT THE APP
    "name": "express-ping",
    "version": "0.2.0",
    "pid": 5761,
    "title": "node", // DO WE NEED THIS?
    "argv": [
      "node",
      "/Users/guido/express-ping/examples/server.js"
    ],
    "versions": {
      "http_parser": "1.0",
      "node": "0.10.22",
      "v8": "3.14.5.9",
      "modules": "11",
      "openssl": "1.0.1e"
    }
  },
  "resources": { // HERE GOES THE DYNAMIC INFO ABOUT THE APP STATUS
    "memory": {
      "rss": 21147648,
      "heapTotal": 11344896,
      "heapUsed": 4341552
    },
    "cpu": {
      ... // DEFINE THIS
    },
    "disk": {
      ... // DEFINE THIS
    }
  },
  "system": {  
    "arch": "x64", // 'arm', 'ia32', or 'x64'
    "platform": "darwin", // 'darwin', 'freebsd', 'linux', 'sunos' or 'win32'
    "hostname": "tizona.local",
    "uptime": 307199,
    "cores": 2, // NEW
    "memory": 42147648, // NEW
    "disk": 201147648, // NEW
  }
}
Clone this wiki locally