0.1.2 • Published 10 years ago

autohost-memwatch v0.1.2

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

Autohost Memwatch

An API for collecting and reporting memory usage for the purpose of detecting and tracking down memory leaks in Node services. Uses memwatch-next.

API

Status

Request GET /ah/memoryProfile/status

Response

{
  "lastEvent": "",
  "lastGC": {
  	"timestamp": "",
    "num_full_gc": 17,
    "num_inc_gc": 8,
    "heap_compactions": 8,
    "estimated_base": 2592568,
    "current_base": 2592568,
    "min": 2499912,
    "max": 2592568,
    "usage_trend": 0
  },
  "lastLeak": {
  	"timestamp": "",
    "start": "Fri, 29 Jun 2012 14:12:13 GMT",
    "end": "Fri, 29 Jun 2012 14:12:33 GMT",
    "growth": 67984,
    "reason": "heap growth over 5 consecutive GCs (20s) - 11.67 mb/hr"
  },
  "lastDiff": {
    "timestamp": "",
    "before": { "nodes": 11625, "size_bytes": 1869904, "size": "1.78 mb" },
    "after":  { "nodes": 21435, "size_bytes": 2119136, "size": "2.02 mb" },
    "change": { "size_bytes": 249232, "size": "243.39 kb", "freed_nodes": 197,
      "allocated_nodes": 10007,
      "details": [
        { "what": "String",
          "size_bytes": -2120,  "size": "-2.07 kb",  "+": 3,    "-": 62
        },
        { "what": "Array",
          "size_bytes": 66687,  "size": "65.13 kb",  "+": 4,    "-": 78
        }
      ]
    }
  }
}

Details

Request GET /ah/memoryProfile/:profile

Response

{
  "lastEvent": "",
  "lastGC": {
  	"timestamp": "",
    "num_full_gc": 17,
    "num_inc_gc": 8,
    "heap_compactions": 8,
    "estimated_base": 2592568,
    "current_base": 2592568,
    "min": 2499912,
    "max": 2592568,
    "usage_trend": 0
  },
  "lastLeak": {
  	"timestamp": "",
    "start": "Fri, 29 Jun 2012 14:12:13 GMT",
    "end": "Fri, 29 Jun 2012 14:12:33 GMT",
    "growth": 67984,
    "reason": "heap growth over 5 consecutive GCs (20s) - 11.67 mb/hr"
  },
  "lastDiff": {
    "timestamp": "",
    "before": { "nodes": 11625, "size_bytes": 1869904, "size": "1.78 mb" },
    "after":  { "nodes": 21435, "size_bytes": 2119136, "size": "2.02 mb" },
    "change": { "size_bytes": 249232, "size": "243.39 kb", "freed_nodes": 197,
      "allocated_nodes": 10007,
      "details": [
        { "what": "String",
          "size_bytes": -2120,  "size": "-2.07 kb",  "+": 3,    "-": 62
        },
        { "what": "Array",
          "size_bytes": 66687,  "size": "65.13 kb",  "+": 4,    "-": 78
        }
      ]
    }
  }
}

List

Including a ?details=true parameter will cause the list to include the detail for each profile captured instead of only providing the ids.

Request GET /ah/memory

Response

{
  "memoryProfiles": []
}

Delete

Request DELETE /ah/memoryProfile/:profile

Response

{
	"message": "Deleted profile :profile"
}