@nearform/doctor
Programmable interface to Clinic.js Doctor
Last updated 3 days ago by goto-bus-stop .
GPL-3.0-or-later · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @nearform/doctor 
SYNC missed versions from official npm registry.

Clinic.js Doctor

Greenkeeper badge npm version Stability Stable Github Actions build status Downloads Code style

Programmable interface to Clinic.js Doctor. Learn more about Clinic.js: https://clinicjs.org/

Screenshot

Supported node versions

  • Node.js 10.0.0 and above
  • Node.js 9.4.0 and above
  • Node.js 8.10.0 and above

Node.js 8.9.4 also works, however you have to listen to SIGINT and shutdown the process nicely.

Example

const ClinicDoctor = require('@nearform/doctor')
const doctor = new ClinicDoctor()

doctor.collect(['node', './path-to-script.js'], function (err, filepath) {
  if (err) throw err

  doctor.visualize(filepath, filepath + '.html', function (err) {
    if (err) throw err
  });
})

You can find examples in node-clinic-doctor-examples

Documentation

const ClinicDoctor = require('@nearform/doctor')
const doctor = new ClinicDoctor()

new ClinicDoctor([settings])

  • settings <Object>
    • sampleInterval <Number> Time between each sample in milliseconds. Default: 10
    • detectPort <boolean> Default: false
    • dest <String> The folder where the collected data is stored. Default: '.'
    • debug <boolean> If set to true, the generated html will not be minified. Default: false
    • collectDelay <Number> Default: 0

doctor.collect(args, callback)

Starts a process by using:

const { spawn } = require('child_process')
spawn(args[0], ['-r', 'sampler.js'].concat(args.slice(1)))

The injected sampler will produce a file in the current working directory, with the process PID in its filename. The filepath relative to the current working directory will be the value in the callback.

stdout, stderr, and stdin will be relayed to the calling process. As will the SIGINT event.

doctor.visualize(dataFilename, outputFilename, callback)

Will consume the datafile specified by dataFilename, this datafile will be produced by the sampler using doctor.collect.

doctor.visualize will then output a standalone HTML file to outputFilename. When completed the callback will be called with no extra arguments, except a possible error.

License

GPL 3.0

Current Tags

  • 5.0.0                                ...           latest (3 days ago)
  • 4.0.0-beta.0                                ...           next (a year ago)

37 Versions

  • 5.0.0                                ...           3 days ago
  • 4.1.2                                ...           2 months ago
  • 4.1.1                                ...           3 months ago
  • 4.1.0                                ...           7 months ago
  • 4.0.6                                ...           a year ago
  • 4.0.5                                ...           a year ago
  • 4.0.4                                ...           a year ago
  • 4.0.3                                ...           a year ago
  • 4.0.2                                ...           a year ago
  • 4.0.1                                ...           a year ago
  • 4.0.0                                ...           a year ago
  • 4.0.0-beta.0                                ...           a year ago
  • 3.12.0                                ...           a year ago
  • 3.11.1                                ...           a year ago
  • 3.11.0                                ...           a year ago
  • 3.10.0                                ...           a year ago
  • 3.9.0                                ...           a year ago
  • 3.8.1                                ...           a year ago
  • 3.8.0                                ...           a year ago
  • 3.7.5                                ...           a year ago
  • 3.7.4                                ...           a year ago
  • 3.7.3                                ...           a year ago
  • 3.7.2                                ...           a year ago
  • 3.7.1                                ...           2 years ago
  • 3.7.0                                ...           2 years ago
  • 3.6.0                                ...           2 years ago
  • 3.5.0                                ...           2 years ago
  • 3.4.0                                ...           2 years ago
  • 3.3.0                                ...           2 years ago
  • 3.2.0                                ...           2 years ago
  • 3.1.0                                ...           2 years ago
  • 3.0.3                                ...           2 years ago
  • 3.0.2                                ...           2 years ago
  • 3.0.1                                ...           2 years ago
  • 3.0.0                                ...           2 years ago
  • 2.6.2                                ...           2 years ago
  • 2.6.1                                ...           2 years ago
Downloads
Today 0
This Week 3
This Month 3
Last Day 3
Last Week 44
Last Month 77
Dependencies (28)
Dev Dependencies (9)
Dependents (2)

Copyright 2014 - 2016 © taobao.org |