Coder Social home page Coder Social logo

fuath / node-clinic-doctor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from clinicjs/node-clinic-doctor

0.0 0.0 0.0 5.69 MB

Programmable interface to `clinic doctor`

Home Page: https://clinicjs.org

License: Other

JavaScript 87.78% CSS 12.22%

node-clinic-doctor's Introduction

node-clinic-doctor

Greenkeeper badge npm version Stability Stable Azure Pipelines build status Downloads Code style

Programmable interface to clinic doctor. Learn more about clinic: https://clinicjs.org/

banner

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

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

node-clinic-doctor's People

Contributors

adrivanhoudt avatar alansl avatar andreasmadsen avatar azure-pipelines[bot] avatar bridgear avatar cuginoale avatar davisjam avatar goto-bus-stop avatar greenkeeper[bot] avatar iamstuartwilson avatar jasnell avatar lucamaraschi avatar mafintosh avatar mcdonnelldean avatar mcollina avatar ovhemert avatar trivikr avatar yoshuawuyts avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.