bmr-cymru / dmioscope

Device-mapper IO visualisation tools
GNU General Public License v2.0
5 stars 1 forks source link

dmioscope: support pretty and compact JSON formatting #14

Open bmr-cymru opened 7 years ago

bmr-cymru commented 7 years ago

For now we use the standard JTS 1.0 dictionary keys. There are proposals for more compact representations, for example CJTSD, e.g.:

{
    "u": "s",
    "t": [1441000, 1441060, 1441120, 1441180],
    "n": [10, 13, 8, 12]
}

It is also possible to ask Python's json encoder to produce a more pretty-printed output, with whitespace indentation and line breaks to ease readability of the data:

{
  "recordCount": "1", 
  "docType": "jts", 
  "version": "1.0", 
  "startTime": "2016-09-30T16:05:42.513739", 
  "endTime": "2016-09-30T16:05:42.513739", 
  "data": [
    {
      "ts": "2016-09-30T16:05:42.513739", 
      "f": {
        "1": {
          "v": 6257
        }, 
        "0": {
          "v": 1050
        }, 
        "3": {
          "v": 38
        }, 
        "2": {
          "v": 778
        }
      }
    }
  ], 
  "columns": {
    "1": {
      "name": "16777216", 
      "format": "0", 
      "dataType": "NUMBER", 
      "renderType": "VALUE", 
      "aggregate": "NONE", 
      "id": "f1xm3a129bc9b4035f906d71"
    }, 
    "0": {
      "name": "16777216", 
      "format": "0", 
      "dataType": "NUMBER", 
      "renderType": "VALUE", 
      "aggregate": "NONE", 
      "id": "f1xm3a129bc9b4035f906d70"
    }, 
    "3": {
      "name": "16777216", 
      "format": "0", 
      "dataType": "NUMBER", 
      "renderType": "VALUE", 
      "aggregate": "NONE", 
      "id": "f1xm3a129bc9b4035f906d73"
    }, 
    "2": {
      "name": "16777216", 
      "format": "0", 
      "dataType": "NUMBER", 
      "renderType": "VALUE", 
      "aggregate": "NONE", 
      "id": "f1xm3a129bc9b4035f906d72"
    }
  }
}

We should support both the compact, and readable formats via the JSON data logger.