Giter VIP home page Giter VIP logo

node-clinic's Introduction

Clinic.js

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

An Open Source Node.js performance profiling suite originally developed by NearForm.

Demo and detailed documentation: https://clinicjs.org/

Install

npm install -g clinic

Screenshots

Getting started

As a first step, run the clinic doctor:

clinic doctor -- node server.js

Then benchmark your server with wrk or autocannon:

wrk http://localhost:3000
autocannon http://localhost:3000

If you want to run autocannon as soon as your server starts listening you can use the --autocannon option using subarg syntax.

clinic doctor --autocannon [ / --method POST ] -- node server.js

Other benchmarking tools like wrk can be started in a similar way using the --on-port flag

# $PORT is the port the server is listening on
clinic doctor --on-port 'wrk http://localhost:$PORT' -- node server.js

Finally shut down your server (Ctrl+C). Once the server process has shutdown clinic doctor will analyse the collected data and detect what type of issue you are having. Based on the issue type, it will provide a recommendation for you.

For example, to debug I/O issues, use clinic bubbleprof:

clinic bubbleprof -- node server.js

Then benchmark your server again, just like you did with clinic doctor.

Note that when looking at the CPU graph you might notice that it doesn't necessarily go from 0-100 but might go from 0-200 or higher. This is because the percentage reflects the total amount of CPU cores your computer has. Node.js itself uses more than one thread behind the scene even though JavaScript is single threaded. V8 (The JavaScript engine) runs the garbage collector and some optimizations on background threads. With worker threads, the CPU will also utilize more than 100%. The visible percentage is always the combination of all these factors together.

NOTE: Exiting the process forcefully can result in wrong or no generation of log files.

Windows + PowerShell

In order to diagnose your application with node clinic, you should execute your application after double hyphens(--), e.g: clinic doctor -- node myapplication.js.

On Windows using PowerShell as terminal the above statement might not work because PowerShell parses everything after -- as literal arguments instead of options.

To avoid that behavior you can either quote ("--", '--') or escape (--) the double hyphens.

Supported Node.js versions

Clinic.js relies heavily on Node.js core instrumentation available in later versions. Currently the supported Node.js versions are >= 16.

Examples and Demos

Report an issue

If you encounter any issue, feel free to send us an issue report at:

https://github.com/clinicjs/node-clinic/issues

More information

For more information use the --help option:

clinic doctor --help
clinic bubbleprof --help
clinic flame --help
clinic heapprofiler --help

Flags

-h | --help                Display Help
-v | --version             Display Version
--collect-only             Do not process data on termination
--visualize-only datapath  Build or rebuild visualization from data
--on-port                  Run a script when the server starts listening on a port.
--autocannon               Run the autocannon benchmarking tool when the server starts listening on a port.
--dest                     Destination for the collect data (default .).
--stop-delay               Add a delay to close the process when a job is done through either `autocannon` or `on-port` flag (milliseconds)
--name                     The --name flag sets a name for the output data, allowing you to replace existing reports without generating new ones. Example: <code>.clinic/node-19-test.clinic-flame</code>

Programmable Interfaces

Each of the tools has a programmable interface which you can read about in their repos.

Profiling In Podman Container

Applicable for doctor, bubbleprof, flame or heapprofiler

In case you profile your application inside of container environment using podman (docker alternative). And you start profling by providing CMD step in the dockerfile.

CMD clinic flame -- node index.js

Then when you run container it exits immediately with 0 code. It is caused by a question to collect anonymous usage statistics.

A workaround is to use environment variable NO_INSIGHT with any value. In this case the question to collect anonymous usage statistics is suppressed. Thus profinling and application server start as expected.

CMD NO_INSIGHT=true clinic flame -- node index.js

License

MIT

node-clinic's People

Contributors

admataz avatar andreasmadsen avatar azure-pipelines[bot] avatar bridgear avatar davisjam avatar dependabot[bot] avatar dylanc avatar eomm avatar gerkenv avatar goto-bus-stop avatar greenkeeper[bot] avatar iamstuartwilson avatar jasnell avatar justsml avatar kaylangan avatar kudos avatar lucamaraschi avatar mafintosh avatar mattmorgis avatar mcollina avatar mrister avatar paolochiodi avatar pi0 avatar rafaelgss avatar salmanm avatar shogunpanda avatar simoneb avatar snyk-bot avatar tjmehta avatar trivikr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-clinic's Issues

--dest option is only available with clinic doctor

Expected Behavior

--dest is a great and useful option. Unfortunaly this option is only available for Doctor

Current Behavior

--dest option is ignored for Flame and Bubbleprof

  • clinic doctor --dest tmp/ -- node start.js => output files are in the tmp folder
  • clinic flame--dest tmp/ -- node start.js => output files are NOT in the tmp folder
  • clinic bubbleprof --dest tmp/ -- node start.js => output files are NOT in the tmp folder

Environment

  • Clinic version: 1.3.0
  • Node version: 8.11.1
  • Operating system and version: Windows 10 64-bit

Thank you! Very nice tool!

Add zoom/trim/pan functionality to see details in a long benchmark

It's pretty common for interfaces like this to have a feature where you can select a snippet of the timeline and "zoom in" on it. Y axis stays the same, X axis increases scale so details can be seen.

It's something users will probably expect based on experience with dev tools and similar, and seems like an important feature since Doctor can run for any time period: run it for longer than, say, 20 seconds, and (depending on screen size) events become hard to distinguish. It would also enable other potential enhancements such as loading and comparing different benchmarks on the same scale.

Should be animated so the user can clearly see what is happening as the x-axis stretches (or on zoom out, contracts) and finer-grain X-axis ticks appear (or disappear).

I like Andreas's approach of using event emitters to separate actions from the UI, I'd suggest we do it in two steps to avoid getting bogged down in UI design detail questions before we're in a good position to test ideas out:

  1. Implement a callable event like scaleXAxis( startTimestamp, endTimestamp, duration ) (duration uses default setting if unset, can be 0 for instant). This can be done before / while we make decisions on the UI and would make it easy to compare and test UI options.
  2. Add UI for this e.g. drag to select a region to zoom in on, some intuitive way to cancel a zoom, click to auto-zoom on the the highlighted problem area, etc.

Browser support review and issues

Currently supported:

Not currently supported, might be in future:

  • Edge Tested on version 42, Windows 10.
    • [Breaking] Error during element animations: "Interpolation M 1, current value: : Got number NaN, must be a number" clinicjs/node-clinic-bubbleprof#222
    • [Breaking] Sometimes incorrectly displays body background-color as white - particularly if dev tools is open. Can fix by added background color to main clinicjs/node-clinic-bubbleprof#219
    • [Serious] Doesn't respect dominant-baseline: text-before-edge; CSS property in within-circle labels' .lower-label, so time labels appear on top of each other clinicjs/node-clinic-bubbleprof#222
    • [Glitch] Fails to apply CSS animation to loading spinner
    • [Minor] Various console warnings about SVG properties in both logos (self-closing <path /> elements, <? version def elements, doctype within embedded svg)
  • Safari (Mac) Versions before 11 don't work, version 11 has some CSS glitches:
  • Chrome (Android)
    • [Serious] Main layout element obstructs and overlaps part of 'Details' and 'Stack trace' buttons in portrait view (probably a height vs innerHeight issue)
    • [Glitch] Hover boxes for labels along the top right push the page width
  • Safari (iOS)
    • [Unknown] Similar issues to Mac on simulation, need to test on real iOS device
  • Firefox (mobile)
    • [Glitch] (Android) Breadcrumbs overlap line below in portrait view
    • [Unknown] Need to test on a real iOS device
  • Opera renders identically to Chrome in desktop and mobile (Android)

"Not enough data" -- how much data do I need?

I am trying to use node clinic with the usual Fibonacci benchmark.

It runs 10 iterations of computing fib(30) to fib(40). This takes about 20 seconds.

Node clinic complains that there is not enough data. It does not say how much data it needs.

  1. How much data does it need?
  2. Can the error message be improved with an estimate of how much longer it needs to run to get enough data?
(11:29:08) jamie@woody ~/Desktop/node-profiling/benchmarks/synthetic/cpu $ time ~/Desktop/floss/node-clinic/bin.js doctor -- node app-fib.js 
Warning: Trace event is an experimental feature and could change at any time.
fib(30) = 1346269
fib(31) = 2178309
fib(32) = 3524578
fib(33) = 5702887
fib(34) = 9227465
fib(35) = 14930352
fib(36) = 24157817
fib(37) = 39088169
fib(38) = 63245986
fib(39) = 102334155
fib(30) = 1346269
fib(31) = 2178309
fib(32) = 3524578
fib(33) = 5702887
fib(34) = 9227465
fib(35) = 14930352
fib(36) = 24157817
fib(37) = 39088169
fib(38) = 63245986
fib(39) = 102334155
fib(30) = 1346269
fib(31) = 2178309
fib(32) = 3524578
fib(33) = 5702887
fib(34) = 9227465
fib(35) = 14930352
fib(36) = 24157817
fib(37) = 39088169
fib(38) = 63245986
fib(39) = 102334155
fib(30) = 1346269
fib(31) = 2178309
fib(32) = 3524578
fib(33) = 5702887
fib(34) = 9227465
fib(35) = 14930352
fib(36) = 24157817
fib(37) = 39088169
fib(38) = 63245986
fib(39) = 102334155
fib(30) = 1346269
fib(31) = 2178309
fib(32) = 3524578
fib(33) = 5702887
fib(34) = 9227465
fib(35) = 14930352
fib(36) = 24157817
fib(37) = 39088169
fib(38) = 63245986
fib(39) = 102334155
fib(30) = 1346269
fib(31) = 2178309
fib(32) = 3524578
fib(33) = 5702887
fib(34) = 9227465
fib(35) = 14930352
fib(36) = 24157817
fib(37) = 39088169
fib(38) = 63245986
fib(39) = 102334155
fib(30) = 1346269
fib(31) = 2178309
fib(32) = 3524578
fib(33) = 5702887
fib(34) = 9227465
fib(35) = 14930352
fib(36) = 24157817
fib(37) = 39088169
fib(38) = 63245986
fib(39) = 102334155
fib(30) = 1346269
fib(31) = 2178309
fib(32) = 3524578
fib(33) = 5702887
fib(34) = 9227465
fib(35) = 14930352
fib(36) = 24157817
fib(37) = 39088169
fib(38) = 63245986
fib(39) = 102334155
fib(30) = 1346269
fib(31) = 2178309
fib(32) = 3524578
fib(33) = 5702887
fib(34) = 9227465
fib(35) = 14930352
fib(36) = 24157817
fib(37) = 39088169
fib(38) = 63245986
fib(39) = 102334155
fib(30) = 1346269
fib(31) = 2178309
fib(32) = 3524578
fib(33) = 5702887
fib(34) = 9227465
fib(35) = 14930352
fib(36) = 24157817
fib(37) = 39088169
fib(38) = 63245986
fib(39) = 102334155
analysing data
/home/jamie/Desktop/floss/node-clinic/bin.js:226
        if (err) throw err
                 ^

Error: Not enough data, try running a longer benchmark
    at /home/jamie/Desktop/floss/node-clinic/node_modules/@nearform/clinic-doctor/analysis/index.js:44:29
    at /home/jamie/Desktop/floss/node-clinic/node_modules/async/dist/async.js:3874:9
    at /home/jamie/Desktop/floss/node-clinic/node_modules/async/dist/async.js:473:16
    at iterateeCallback (/home/jamie/Desktop/floss/node-clinic/node_modules/async/dist/async.js:980:24)
    at /home/jamie/Desktop/floss/node-clinic/node_modules/async/dist/async.js:958:16
    at /home/jamie/Desktop/floss/node-clinic/node_modules/async/dist/async.js:3871:13
    at Endpoint.finish (/home/jamie/Desktop/floss/node-clinic/node_modules/endpoint/endpoint.js:36:5)
    at Object.onceWrapper (events.js:272:13)
    at Endpoint.emit (events.js:185:15)
    at finishMaybe (_stream_writable.js:636:14)

real	0m18.555s
user	0m18.540s
sys	0m0.033s

An in-range update of @nearform/bubbleprof is breaking the build 🚨

Version 1.2.0 of @nearform/bubbleprof was just published.

Branch Build failing 🚨
Dependency @nearform/bubbleprof
Current Version 1.1.6
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

@nearform/bubbleprof is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • ❌ continuous-integration/appveyor/branch: Waiting for AppVeyor build to complete (Details).
  • βœ… ci/circleci: build: Your tests passed on CircleCI! (Details).
  • βœ… ci/circleci: lint: Your tests passed on CircleCI! (Details).
  • βœ… ci/circleci: test: Your tests passed on CircleCI! (Details).
  • ❌ ci/circleci: coverage: Your tests failed on CircleCI (Details).

Commits

The new version differs by 3 commits.

  • 2abf14e 1.2.0
  • ee86f7d Give collapsedNodes names by interestingness (#231)
  • c80ed83 Upgrade appveyor to use Node 10 (#233)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

TypeError: Cannot read property '1' of null

Currently the RegExp is not safe and at least a better error message should be visible in this case.

The documentation seems to be outdated as well as the output file is actually PID.clinic-flame.

Clinic Flame - v2.1.0 (0x v4.1.3)
...
You can then transfer the data and visualize it locally:

  clinic flame --visualize-only PID.flamegraph
clinic flame --visualize-only 13083.flamegraph
/home/ruben/.nvm/versions/node/v10.8.0/lib/node_modules/clinic/bin.js:256
    const name = filename.match(/clinic-([^-]+)/)[1]
                                                 ^

TypeError: Cannot read property '1' of null
    at viz (node/v10.8.0/lib/node_modules/clinic/bin.js:256:50)
    at runTool (node/v10.8.0/lib/node_modules/clinic/bin.js:228:5)
    at Command.func (node/v10.8.0/lib/node_modules/clinic/bin.js:176:34)
    at Command.call (node/v10.8.0/lib/node_modules/clinic/node_modules/commist/index.js:100:8)
    at Object.parse (node/v10.8.0/lib/node_modules/clinic/node_modules/commist/index.js:58:19)
    at Object.<anonymous> (node/v10.8.0/lib/node_modules/clinic/bin.js:182:4)

Understanding and tracking memory issues

Not a bug but an ask..
Clinic doctor is definitely easy to use and get a view of application performance.

My application is tagged as "Potential GC issue" by clinic doctor and the recommendations suggest to go through the node --inspect way to analyze the issue.

My code doesnot have a memory leak but a memory bloat i.e. its heavy at the startup itself and there is a lot of scavenge triggered by V8 and so a GC issue.

Want to understand if Clinic is planning to provide any tool to profile and point out the source of issue from a memory point of view for e.g. like a heap dump analyzer would do for java application.

I have been trying since sometime but am not able to get much details from the chrome heapdump analysis part as i don't get the source of the problem from it.

premature close error on process exit

Expected Behavior

An HTML report should be saved

Current Behavior

Doctor, bubbleprof, and flame all crash with this error:

Error: premature close
    at MultiStream.onclose (/Users/contra/.nvm/versions/node/v10.6.0/lib/node_modules/clinic/node_modules/end-of-stream/index.js:47:67)
    at MultiStream.emit (events.js:187:15)
    at MultiStream.destroy (/Users/contra/.nvm/versions/node/v10.6.0/lib/node_modules/clinic/node_modules/multistream/index.js:65:8)
    at DestroyableTransform.onClose (/Users/contra/.nvm/versions/node/v10.6.0/lib/node_modules/clinic/node_modules/multistream/index.js:111:12)
    at Object.onceWrapper (events.js:273:13)
    at DestroyableTransform.emit (events.js:187:15)
    at /Users/contra/.nvm/versions/node/v10.6.0/lib/node_modules/clinic/node_modules/through2/through2.js:20:10
    at process._tickCallback (internal/process/next_tick.js:61:11)

Steps to Reproduce (for bugs)

  1. Node 10.6
  2. npm install clinic -g
  3. clinic doctor -- node dummy-server.js
  4. Wait a bit, press CTRL-C

Environment

  • Clinic version: Clinic v1.1.0 Doctor v3.0.3
  • Node version: v10.6
  • Operating system and version: MacOS Mojave Beta

Unable to install

Expected Behavior

Module installs and is available for running

Current Behavior

Error is thrown during npm install

npm ERR! code E404
npm ERR! 404 Not Found: @nearform/doctor@^3.0.0

Steps to Reproduce (for bugs)

  1. In console run npm install -g clinic

Environment

  • Clinic version: latest
  • Node version: v10.6.0 npm v6.2.0
  • Browser name and version: Chrome 68.0.3440.84
  • Operating system and version:
    OSX 10.13.6

Feedback/Suggestions

After showing Bubbleprof to a few folks, I've received a few suggestions/feature requests:

  1. Providing a smoothing option that would hide certain known Node.js core artifacts such short, always present nextTick's that do not lead to additional async activity. Having the ability to optionally hide these can decrease the visual noise in the chart. When enabled, there should be some other indication that there is N milliseconds of hidden activity, etc, so that the information / impact of those hidden things is not lost.

  2. Provide the ability to label / abstract certain known artifacts from Node.js core. For instance, we know that closing an http socket connection will always have a certain shape, by default we can hide the details for those in a specifically labeled/colored bubble that only shows the detail when clicked on.

Incorporating metrics from the threadpool

This is a feature request, not a bug report. It is not currently actionable.

node-clinic currently gives great insight into the event loop. For some applications this is sufficient. For others, understanding the state of the threadpool may be crucial to tuning the threadpool size or the application behavior for best performance.

The threadpool has historically been hidden in libuv without a monitoring API (but see libuv #1528). I am trying to change this. I have proposed a libuv PR to make the libuv threadpool pluggable (libuv #1726) and a corresponding Node.js PR proposing various Node-land threadpools (Node.js #22631).

I would love to see threadpool monitoring integrated into node-clinic's offerings. To that end, I'd like to understand what kind of API and metrics you think would be beneficial. Please chime in on Node.js #22957 if you have thoughts.

Flame graph not works on linux

  • Execute: clinic flame --on-port=’autocannon -c2 localhost:$PORT/seed/v1’ -- node index.js
  • After 2 minutes i press CTRL + C
  • Console export: -
  • Export: isolate file.log

where is the html file ?

Node: 8.9
OS: ubuntu 16.04

Index.js

` 'use strict'

const restify = require('restify')
const { etagger, timestamp, fetchContent } = require('./util')()
const server = restify.createServer()

server.use(etagger().bind(server))

server.get('/seed/v1', function (req, res, next) {
  fetchContent(req.url, (err, content) => {
    if (err) return next(err)
    res.send({data: content, url: req.url, ts: timestamp()})
    next()
  })
})

server.listen(3000)`

util.js
`
"use strict";

require("events").defaultMaxListeners = Infinity;
const crypto = require("crypto");

module.exports = () => {
const content = crypto.rng(5000).toString("hex");
const ONE_MINUTE = 60000;
var last = Date.now();

function timestamp() {
  var now = Date.now();
  if (now - last >= ONE_MINUTE) last = now;
  return last;
}

function etagger() {
  var cache = {};
  var afterEventAttached = false;
  function attachAfterEvent(server) {
    if (attachAfterEvent === true) return;
    afterEventAttached = true;
    server.on("after", (req, res) => {
      if (res.statusCode !== 200) return;
      if (!res._body) return;
      const key = crypto
        .createHash("sha512")
        .update(req.url)
        .digest()
        .toString("hex");
      const etag = crypto
        .createHash("sha512")
        .update(JSON.stringify(res._body))
        .digest()
        .toString("hex");
      if (cache[key] !== etag) cache[key] = etag;
    });
  }
  return function(req, res, next) {
    attachAfterEvent(this);
    const key = crypto
      .createHash("sha512")
      .update(req.url)
      .digest()
      .toString("hex");
    if (key in cache) res.set("Etag", cache[key]);
    res.set("Cache-Control", "public, max-age=120");
    next();
  };
}

function fetchContent(url, cb) {
  setImmediate(() => {
    if (url !== "/seed/v1")
      cb(Object.assign(Error("Not Found"), { statusCode: 404 }));
    else cb(null, content);
  });
}

return { timestamp, etagger, fetchContent };

};

`

Clinic v0.6.2 / Node v8.9.4: Error: Invalid JSON (Unexpected "p" at position 24584 in state STOP)

This pops up after hanging at 'analyzing data' for a few seconds:

analysing data
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: Invalid JSON (Unexpected "p" at position 24584 in state STOP)
    at Parser.proto.charError (/home/aaron/code/mspdna-ssh/node_modules/jsonparse/jsonparse.js:90:16)
    at Parser.proto.write (/home/aaron/code/mspdna-ssh/node_modules/jsonparse/jsonparse.js:154:23)
    at Stream.<anonymous> (/home/aaron/code/mspdna-ssh/node_modules/JSONStream/index.js:21:12)
    at Stream.stream.write (/home/aaron/code/mspdna-ssh/node_modules/through/index.js:26:11)
    at TraceEventDecoder._transform (/home/aaron/code/mspdna-ssh/node_modules/@nearform/clinic-doctor/format/trace-event-decoder.js:114:19)
    at TraceEventDecoder.Transform._read (_stream_transform.js:186:10)
    at TraceEventDecoder.Transform._write (_stream_transform.js:174:12)
    at doWrite (_stream_writable.js:387:12)
    at writeOrBuffer (_stream_writable.js:373:5)
    at TraceEventDecoder.Writable.write (_stream_writable.js:290:11)
19:12:39 βŒ‚131% [aaron@ripley:~/code/mspdna-ssh] [mspdna] develop(+2861/-42)* 1 Β± 

The instructions say it would be super helpful if I tell clinic to upload some data to the cloud to help with debugging. I'm hesitant to do that on a private project that has SSH keys loaded into memory. What's "the cloud", where's the data going, and who gets to see it? ;)

Error opening a flame report

Expected Behavior

An HTML flame graph should be displayed

Current Behavior

The HTML flame graph does not show up and a js error is thrown:

Uncaught TypeError: Cannot read property 'reduce' of undefined
    at 31038.clinic-flame.html:2752
    at time (31038.clinic-flame.html:2504)
    at HTMLUnknownElement.<anonymous> (31038.clinic-flame.html:2735)
    at Selection.selection_each [as each] (31038.clinic-flame.html:6684)
    at update (31038.clinic-flame.html:2730)
    at HTMLUnknownElement.<anonymous> (31038.clinic-flame.html:3053)
    at Selection.selection_each [as each] (31038.clinic-flame.html:6684)
    at chart (31038.clinic-flame.html:2973)
    at flameGraph (31038.clinic-flame.html:3158)
    at module.exports (31038.clinic-flame.html:442)

Steps to Reproduce (for bugs)

  1. clinic flame -- node server.js

Sample upload

https://upload.clinicjs.org/public/ca684e50de8a7d39811df4d8906a4042ae67ce6f3eec27df92d1d4765b1294b8/31038.clinic-flame.html

Environment

  • Clinic version:
    v1.1.0
  • Node version:
    v8.10.0
  • Browser name and version:
    Chrome 68
  • Operating system and version:
    OSX 10.12.6

Add 'Export data' button which delivers JSON as downloadable file

The human-readable data is contained as JSON within the HTML whereas the data dump file written to the server is binary. Users may want to view the data, so let's make it easy for them. Since this data is already in the HTML file it shouldn't increase file weight and should be very easy to implement.

I'd say JSON only is fine, a CSV option might be a nice-to-have but I'd say it's not a priority since the kind of users who will be exporting data files are probably also the kind of users who can convert JSON to CSV themselves if that's what they needed (and maybe makes more sense server-side as a CLI option so it can be used with --collect-only?).

Regarding where in the UI, I'm also drawing up some suggestions for a feature to import data to allow different Doctor benchmarks to be compared side-by-side: it'd make sense for import/export buttons to be together, and the most intuitive place for these would be the very top header aligned right opposite the Doctor logo since it's a step outside the context of the current analysis and recommendations.

Clinic flame "TypeError: "file" argument must be a non-empty string"

When using clinic flame -- node index.js
clinic v1.2.1
node 8.11.3
ubuntu 18.04

I am getting the following error:

Current Behavior

Analysing data
/usr/lib/node_modules/clinic/bin.js:261
if (err) throw err
^

TypeError: "file" argument must be a non-empty string
at normalizeSpawnArguments (child_process.js:383:11)
at spawnSync (child_process.js:519:38)
at ticksToTree (/usr/lib/node_modules/clinic/node_modules/0x/lib/ticks-to-tree.js:30:21)
at render (/usr/lib/node_modules/clinic/node_modules/0x/lib/render.js:19:17)
at generateFlamegraph (/usr/lib/node_modules/clinic/node_modules/0x/index.js:76:22)
at visualize (/usr/lib/node_modules/clinic/node_modules/0x/index.js:119:24)
at
at process._tickCallback (internal/process/next_tick.js:188:7)

Steps to Reproduce (for bugs)

  1. Start profiling clinic flame -- node.index
  2. autocannon -c 5 -t 5 http://localhost:8080
  3. pressing CTRL+C
  4. Getting the Error

Sample upload

Environment

  • Clinic version:
  • Node version:
  • Browser name and version:
  • Operating system and version:

Browser support review

All browsers have an error in console on window resize, chart.querySelector(...) is null - might be related to the resize chopping issue (most noticeable in Chrome for Windows)

Currently supported:

  • Chrome (desktop)
    • [] [medium / serious] Some stacks get inconsistently chopped off right hand edge after window resize (especially on Windows)
  • Firefox (desktop)
    • No specific issues

May become supported in future

  • MS Edge (Windows 10)

    • [minor] Horizontal scrollbar appears after window resize, obscuring some buttons until user scrolls down
  • Safari 11 (Mac)

    • No specific issues
  • Safari (iOS)

    • Need to borrow a device
  • Chrome (Android)

    • [serious] Weird / broken resize behaviour on screen rotation - goes tiny or off screen. Must refresh page after rotating screen
    • [serious] In portrait orientation, lower button panel is off bottom of screen. User can scroll down and see them but will have no reason to try to scroll down
    • [serious] In landscape orientation, lower button panel is off bottom of screen and user can't scroll down
  • Firefox (Android)

    • [serious] Same issues as Chrome (Android)
  • Opera shows same as Chrome

Error: No files matching the pattern found

Whenever i run the command provided on npm

clinic doctor --on-port 'autocannon http://localhost:$PORT' -- node server.js

I get the error below after autocannon has finished, not opening any html file;

Error: No files matching the pattern found
    at notFound (C:\Users\Womac\AppData\Roaming\npm\node_modules\clinic\node_modules\node-trace-log-join\index.js:65:15)
    at combine (C:\Users\Womac\AppData\Roaming\npm\node_modules\clinic\node_modules\node-trace-log-join\index.js:24:34)
    at C:\Users\Womac\AppData\Roaming\npm\node_modules\clinic\node_modules\node-trace-log-join\index.js:20:5
    at FSReqWrap.oncomplete (fs.js:153:20)

Node version: v9.8.0
Clinic version: v0.8.1

Clinic upload id: b3bcbf4df8e380

The repeatable test case is simply running the command detailed above, with the following server.js file

const restify = require('restify')
const {etagger, timestamp, fetchContent} = require('./util')()
const server = restify.createServer()

server.use(etagger().bind(server))

server.get('/seed/v1', function (req, res, next) {
    fetchContent(req.url, (err, content) => {
        if (err) 
            return next(err)
        res.send({data: content, url: req.url, ts: timestamp()})
        next()
    })
})

server.listen(3000);

Error on Node.js 9.4.0: 'timestamp' of undefined

clinic doctor -- node index.js
Warning: Trace event is an experimental feature and could change at any time.
16
analysing data
/opt/nodes/9.4.0/lib/node_modules/clinic/node_modules/@nearform/clinic-doctor/analysis/index.js:42
      processStat[intervalIndex[0]].timestamp,
                                    ^

TypeError: Cannot read property 'timestamp' of undefined
    at /opt/nodes/9.4.0/lib/node_modules/clinic/node_modules/@nearform/clinic-doctor/analysis/index.js:42:37
    at /opt/nodes/9.4.0/lib/node_modules/clinic/node_modules/async/dist/async.js:3874:9
    at /opt/nodes/9.4.0/lib/node_modules/clinic/node_modules/async/dist/async.js:473:16
    at iterateeCallback (/opt/nodes/9.4.0/lib/node_modules/clinic/node_modules/async/dist/async.js:980:24)
    at /opt/nodes/9.4.0/lib/node_modules/clinic/node_modules/async/dist/async.js:958:16
    at /opt/nodes/9.4.0/lib/node_modules/clinic/node_modules/async/dist/async.js:3871:13
    at Endpoint.finish (/opt/nodes/9.4.0/lib/node_modules/clinic/node_modules/endpoint/endpoint.js:36:5)
    at Object.onceWrapper (events.js:255:19)
    at Endpoint.emit (events.js:165:20)
    at finishMaybe (_stream_writable.js:633:14)

Add a bin.js to this repo

I would really like to be able to do bubble -- node index.
Linking 2-3 repos together is not an easy to update setup (especially because npm 5 and 6 does not work well anymore with npm link).

Move: unknown source

I am running a simple JSON benchmark and trying to generate a flamegraph.
I get a lot of "Move: unknown source" errors.

~/Desktop/floss/node-clinic/bin.js flame -- node builtin-json.js
...
Big obj: string len 13058957
  JSON'ing iter 9
Big obj: string len 13058957
πŸ”₯  Process exited, generating flamegraphMove: unknown source 22987842558944
Move: unknown source 22987842562376
Move: unknown source 22987842564480
...
πŸ”₯  Flamegraph generated in
file:///home/jamie/Desktop/node-profiling/benchmarks/synthetic/cpu/7912.clinic-flame.html

This is the application:

const DO_JSON_INLINE = true;

const DO_LOG = true;

function log (msg) {
	if (DO_LOG) {
		console.error(msg);
	}
}

let bigObj = {};
let obj = bigObj;
for (let i = 0; i < 12; i++) {
	obj.a = 'a'.repeat(1000);
	obj.curr = JSON.stringify(bigObj);
	obj.child = {};
	obj = obj.child;
}

/* Call if !DO_JSON_INLINE. */
function doJSON () {
	for (let j = 0; j < 10; j++) {
		log(`  JSON'ing iter ${j}`);
		const str = JSON.stringify(bigObj);
		const obj = JSON.parse(str);
		log(`Big obj: string len ${str.length}`);
	}
}

function main () {
	console.error('Here we go!');
	for (let i = 0; i < 10; i++) {
		log(`Iter ${i}`);

		if (DO_JSON_INLINE) {
			for (let j = 0; j < 10; j++) {
				log(`  JSON'ing iter ${j}`);
				const str = JSON.stringify(bigObj);
				const obj = JSON.parse(str);
				log(`Big obj: string len ${str.length}`);
			}
		}
		else {
			doJSON();
		}
	}
}

main();

I am running on Ubuntu 16, node v9.11.1.

Visualize gc-events in UI

From clinicjs/node-clinic-doctor#42

@mcollina There is no visualization, you can look at the docs if you would like to see it. The problem with gc-stats is that it doesn't expose all events. I just exposes some always and others only sometimes. It is a bit confusing. The trace_events shows all the events.

Using the trace_events is not currently possible because there I no way of synchronizing the trace_events clock with another clock. The V8 team is currently working on this: nodejs/node#17349

Flame: v8 log conversion failed

Expected Behavior

Generate and open Flamegraph

Current Behavior

Error: v8 log conversion failed

Steps to Reproduce (for bugs)

  1. I'm using a basic node.js app just for test:

var express = require("express");
var app = express();

app.get("/", function(req, res) {
res.send("Hello World");
});

app.listen(3097);

  1. using Node.js v.10.10.0 (with both clinic doctor + autocannon installed -g)
  2. clinic flame --on-port='autocannon -c 100 localhost:$PORT' -- node index.js
  3. when autocannon finish it produce the following error: Error: v8 log conversion failed
  4. Switching to Node.js v8.12.0 -- nvm use v8.12.0 -- (with both clinic doctor + autocannon installed -g) and running exactly the same command it generates correctly the flamegraph

Sample upload

Environment

@nearform/[email protected]
[email protected]

  • Node version: Node.js v.10.10.0
  • OSX 10.13.6 (17G2307)

An in-range update of autocannon is breaking the build 🚨

The devDependency autocannon was updated from 3.0.2 to 3.1.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

autocannon is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • βœ… ci/circleci: build: Your tests passed on CircleCI! (Details).
  • βœ… ci/circleci: test: Your tests passed on CircleCI! (Details).
  • βœ… ci/circleci: lint: Your tests passed on CircleCI! (Details).
  • βœ… ci/circleci: coverage: Your tests passed on CircleCI! (Details).
  • ❌ continuous-integration/appveyor/branch: AppVeyor build failed (Details).

Release Notes for v3.1.0
  • Show two decimals #168
Commits

The new version differs by 2 commits.

  • 2d6e7ca Bumped v3.1.0.
  • 79afbd7 Show two decimal places for duration metric (#168)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Doctor has found an unknown issue - Node version 8.11.2

Expected Behavior

To receive recommendations by Node Clinic.

Current Behavior

Right now, node clinic show me the next message: "Doctor has found an unknown issue"

Steps to Reproduce (for bugs)

  1. build my app that use the framework next.js
  2. NODE_ENV=production node_modules/.bin/clinic doctor -- node server/run.js
  3. Navigate from different urls that proportionate my server
  4. Control + C
  5. Automatically, in my computer appears a node-clinic html page where appears differents graphics and also the message that says ""Doctor has found an unknown issue""

Sample upload

https://upload.clinicjs.org/public/c0b96514f7ffb7577945884aca0fb2b0e54b52aa5154daf86f3a0d5bd29aa1f9/8970.clinic-doctor.html

Environment

  • Clinic version:
    Clinic v1.2.1
    Doctor v3.4.0
  • Node version:
    Node v8.11.2
    Npm v6.4.0
  • Browser name and version:
    Chrome Version 66.0.3359.139 (Official Build) (64-bit)
  • Operating system and version:
    Fedora 28; Linux x86_64

TypeError: size must be positive

analysing data
/home/ruben/.nvm/versions/node/v9.11.1/lib/node_modules/clinic/node_modules/distributions/distributions/binomial.js:17
    throw TypeError('size must be positive');
    ^

TypeError: size must be positive
    at new BinomialDistribution (/home/ruben/.nvm/versions/node/v9.11.1/lib/node_modules/clinic/node_modules/distributions/distributions/binomial.js:17:11)
    at analyseHandles (/home/ruben/.nvm/versions/node/v9.11.1/lib/node_modules/clinic/node_modules/@nearform/clinic-doctor/analysis/analyse-handles.js:63:20)
    at /home/ruben/.nvm/versions/node/v9.11.1/lib/node_modules/clinic/node_modules/@nearform/clinic-doctor/analysis/index.js:60:18
    at /home/ruben/.nvm/versions/node/v9.11.1/lib/node_modules/clinic/node_modules/async/dist/async.js:3874:9
    at /home/ruben/.nvm/versions/node/v9.11.1/lib/node_modules/clinic/node_modules/async/dist/async.js:473:16
    at iterateeCallback (/home/ruben/.nvm/versions/node/v9.11.1/lib/node_modules/clinic/node_modules/async/dist/async.js:980:24)
    at /home/ruben/.nvm/versions/node/v9.11.1/lib/node_modules/clinic/node_modules/async/dist/async.js:958:16
    at /home/ruben/.nvm/versions/node/v9.11.1/lib/node_modules/clinic/node_modules/async/dist/async.js:3871:13
    at Endpoint.finish (/home/ruben/.nvm/versions/node/v9.11.1/lib/node_modules/clinic/node_modules/endpoint/endpoint.js:36:5)
    at Object.onceWrapper (events.js:272:13)
'use strict';

let i = 0;

const obj = {};

while (i++ < 500) {
  obj[i] = {};
}

const circular = {};

for (const k of Object.keys(obj)) {
  circular[k] = obj[k];
  obj[k]._circular = circular;
  obj[k]._obj = obj;
}

console.log(obj);

setTimeout(() => {}, 100);

Help the user see where the line is interpolated due to missing/delayed data

This is something I've already implemented on my side because I find it useful for understanding the data. If we like the idea, it's ready to PR.

Our plots are unusual compared to other time series charts and various other profiling tools because the plotting along the x-axis is (by design) not consistent - when there's no event loop delay, we plot every poll interval (10ms), then when there are delays, the resolution goes down to whatever the delays are. Within one plot there could be areas where the data is extremely fine and areas where it's extremely coarse.

Visually, there's currently no difference between a time period where we have have fine enough data to know a variable follows a consistent linear trend, and a time period where we have missing data and we're just interpolating between two data points either side of an event loop delay. Users can learn to distinguish the two, by running the mouse along and seeing where the hover box jumps or by comparing to the event loop chart (which might be off screen), but it'd help if they could just see it.

Of course, we don't want to make the UI visually busy. It needs to be unobtrusive.

This edit essentially adds a subtle highlight to each actual datapoint, making a linear trend subtly but noticeably stronger than an interpolation, and making the individual data points within a coarser delayed area easy to see.

Example with node-clinic-examples/slow-gc :

image

Example with node-clinic-examples/slow-event-loop :

image

Collecting data from a container

One feature that would be exceedingly helpful for clinic would be the ability to run it against a node process running within a container. Not yet entirely sure how that would work seamlessly, but wanted to at least open a tracking issue.

For example:

$ clinic doctor -- docker run myApp

Browser support review

Currently supported:

  • Chrome (desktop)

    • [medium] On Windows, an empty scroll bar is visible inside the Recommendations summary text
    • [minor] On Mac, white-on-cyan 'RECOMMENDATIONS' text doesn't have improved Mac anti-aliasing like other light-on-dark text (this has been applied automatically on Safari)
  • Firefox (desktop)

    • [minor] On Mac, colours appear slightly washed out compared to same colours in Chrome

May become supported in future

  • MS Edge (Windows 10)

    • [breaking] Error breaks everything: Object doesn't support property or method 'Symbol.iterator (version 42.17134.1.0)
    • [unclear] Security error 5022, but only in profiles uploaded to the server; and it doesn't seem to stop anything working
    • [minor] Various console warnings about SVG properties in both logos (self-closing elements, <? version def elements, doctype within embedded svg)
  • Safari 11 (Mac)

    • [minor] Same empty scrollbar issue as Chrome (but most Safari users have scrollbars set to invisible as per system default)
  • Safari (iOS)

    • Need to borrow a device
  • Chrome (Android)

    • No specific problems
  • Firefox (Android)

    • No specific problems
  • Opera shows same as Chrome

Stop collecting tracing data before the point where we can not process it anymore

Each tool has a specific limit up to that it's capable of visualizing the collected data. Exceeding that (yet unknown) limit is going to cause the heap memory to be exhausted and we have a mechanism in place that prevents showing the data from a specific point on.

to prevent coming in that situation, just limit the collection process up front and end the collection with SIGINT and by printing a notification for the user.

how can i solve this problem : process exited with exit code 9

My project has been launched, and it is running normally.
It can be started by normal : node www.js,
or it can be started by : pm2 www.js.

i use command: clinic doctor -- node www.js
,then print these:

node: --trace-event-categories is not allowed in NODE_OPTIONS
/root/nvm/versions/node/v8.6.0/lib/node_modules/clinic/bin.js:209
if (err) throw err
^

Error: process exited with exit code 9
at ChildProcess. (/root/nvm/versions/node/v8.6.0/lib/node_modules/clinic/node_modules/@nearform/clinic-doctor/index.js:65:13)
at Object.onceWrapper (events.js:318:30)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)

Bug: [email protected]: The engine "node" is incompatible with this module. Expected version ">=9.0.0".

$ ls -la
total 0
drwxr-xr-x   2 lquixada  staff    64  4 Mai 10:13 ./
drwxr-xr-x@ 36 lquixada  staff  1152  4 Mai 10:13 ../
$ node -v
v8.11.1
$ yarn -v
1.6.0
$ yarn add clinic
yarn add v1.6.0
info No lockfile found.
[1/4] πŸ”  Resolving packages...
[2/4] 🚚  Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=9.0.0".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

It seems node-clinic depends on 0x that depends on on-net-listen whose version 1.1.0 depends on node>=9. Its version 1.0 doesn't though.

If I use npm, it install just fine.

File should be clickable

Example: Generated HTML file is 15703.clinic-flame.html

Here the filename is not referenced as file://... and can not be clicked upon on the terminal.

Confusing CPU Usage display

I was able to finish a 10 minute analysis of my Node.js application which uses socket.io and a MongoDB backend. When I looked at the results (I uploaded them to ID: 6f8316c279ccbc2c587e33a2a3731b2f2aefe79d7d065ed542ef7241fd61bad3), I found (rightly so) that I may have a potential I/O issue.

Here are my questions about the chart:

  1. The CPU Usage chart has a vertical axis that ranges from 0 to 200. Given that I have a single process, I'm not sure how we could be using over 100% of the CPU.
  2. Does the CPU Usage chart also overlay some I/O statistics? It seems like there are two bar charts: one with red bars and one with green bars (though the green ones are very, very short).
  3. When I hover over data points, the tooltip display shows low values (generally < 10%), however the chart has tall red bars (some which go over 200) that don't reflect the tooltip.

Overall, the UI is really helpful, though the hover responsiveness is lagging, slow. I understand that there is a lot of data in the page.

An in-range update of pumpify is breaking the build 🚨

Version 1.5.1 of pumpify was just published.

Branch Build failing 🚨
Dependency pumpify
Current Version 1.5.0
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

pumpify is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • βœ… ci/circleci: build Your tests passed on CircleCI! Details
  • βœ… ci/circleci: lint Your tests passed on CircleCI! Details
  • βœ… ci/circleci: test Your tests passed on CircleCI! Details
  • βœ… ci/circleci: coverage Your tests passed on CircleCI! Details
  • ❌ continuous-integration/appveyor/branch AppVeyor build failed Details

Commits

The new version differs by 3 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

key text – concise version

I suggest having the items on the left, in a table, with descriptions on the right

(remove the intro text)

[bubble]: Grouped operations that trigger asynchronous activity. The bigger the bubble, the more time spent both executing code and waiting for responses.

[line]: Represents waiting time between one group registering callbacks for asynchronous responses and another operations group resolving those callbacks.

[inner cicle]: Outline piechart representing ratio of operation types. Click to explore further.

HIDE THIS WHEN IN TIMESTAMP MODE
[percent]: Represents time spent in both code execution and waiting for callbacks to fire in ratio to profiling duration.

ONLY SHOW THESE WHEN IN TIMESTAMP MODE
[bubble timestamp]: Aggregated time spent executing code and waiting for responses.
[line timestamp]: Aggregated delay between operation groups.

clinic doctor exits right away

When running the clinic doctor command, it exits right away and shows me a report. I do not have a chance to actually run the server, and then run autocannon.

screen shot 2018-03-28 at 8 42 20 am

Same behavior if I use the --on-port flag...

JSON parsing issue

Just tried to run this for the first time and got this on pressing ctrl-c, not sure how to debug it further for ya:

analysing data
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: Unexpected COMMA(",") in state COLON
    at Parser.proto.parseError (/Users/contra/.nvm/versions/node/v8.9.4/lib/node_modules/clinic/node_modules/jsonparse/jsonparse.js:321:16)
    at Parser.proto.onToken (/Users/contra/.nvm/versions/node/v8.9.4/lib/node_modules/clinic/node_modules/jsonparse/jsonparse.js:395:24)
    at Parser.parser.onToken (/Users/contra/.nvm/versions/node/v8.9.4/lib/node_modules/clinic/node_modules/JSONStream/index.js:126:12)
    at Parser.proto.write (/Users/contra/.nvm/versions/node/v8.9.4/lib/node_modules/clinic/node_modules/jsonparse/jsonparse.js:139:34)
    at Stream.<anonymous> (/Users/contra/.nvm/versions/node/v8.9.4/lib/node_modules/clinic/node_modules/JSONStream/index.js:21:12)
    at Stream.stream.write (/Users/contra/.nvm/versions/node/v8.9.4/lib/node_modules/clinic/node_modules/through/index.js:26:11)
    at TraceEventDecoder._transform (/Users/contra/.nvm/versions/node/v8.9.4/lib/node_modules/clinic/node_modules/@nearform/clinic-doctor/format/trace-event-decoder.js:114:19)
    at TraceEventDecoder.Transform._read (_stream_transform.js:186:10)
    at TraceEventDecoder.Transform._write (_stream_transform.js:174:12)
    at doWrite (_stream_writable.js:387:12)

then looking at the folder, it spit out 30+ folders:

screen shot 2018-02-01 at 11 28 47 pm

might have something to do with happypack running a bunch of subprocesses

Flame unusable on Node-DC-EIS workload

Ubuntu 16, Node v9.11.1.

  1. ~/Desktop/floss/node-clinic/bin.js flame -- node server-cluster.js
  2. Node-DC-EIS-client $ ./runspec.py -f ./config.json
  3. After client runs (~60 seconds), Ctrl-C
  4. Wait for flamegraph

The resulting flamegraph is un-navigable in Firefox.

This is presumably due to this 0x issue.

Is there significant benefit to be had from using node clinic -> 0x's flamegraph, or should I use something like flamebearer which relies on the built-in V8 profiler (as would 0x without the --kernel-tracing)?

In other words, what does 0x's --kernel-tracing mode buy me, other than a hard-to-use flamegraph?

cpu backend was already registered. Reusing existing backend

$ clinic doctor --on-port 'autocannon -c 2 -d 5 http://localhost:$PORT' -- node 2
cpu backend was already registered. Reusing existing backend
Warning: Trace event is an experimental feature and could change at any time.
Running 5s test @ http://localhost:3000/
2 connections

Stat    2.5%  50%   97.5% 99%   Avg      Stdev    Max
Latency 21 ms 29 ms 57 ms 90 ms 31.01 ms 18.48 ms 241.96 ms

Stat      1%    2.5%  50%     97.5% Avg     Stdev   Min
Req/Sec   54    54    58      79    63.4    9.31    54
Bytes/Sec 67 kB 67 kB 71.9 kB 98 kB 78.6 kB 11.5 kB 67 kB

Req/Bytes counts sampled once per second.

317 requests in 5s, 393 kB read
Analysing data
Generated HTML file is 23410.clinic-doctor.html
You can use this command to upload it:
clinic upload 23410.clinic-doctor

This happens every time I run clinic doctor.

node: --trace-event-categories is not allowed in NODE_OPTIONS

Hey.

I've encountered this problem using node 9.2.0, upgrading to 9.4.0 seems to resolve the problem. But what's your idea if adding a hard version dependency in clinic's package json to prevent users confusing about this error or at least indicating it in REAME?

Thanks.

clinic flame and clinic doctor not running on windows 7 and windows 10

Expected Behavior

Hi all ,
I am trying to analyse the express application with mongodb backend . My set up is completely on windows laptop 7 . With clinic doctor express server does not receive request and with clinic flame i get errors . With simple autocannon command i am able to call POST requests and records are getting created in database.

My command line - for clinic flame and clinic doctor
option 1 - clinic flame --on-port 'autocannon -method POST localhost:3000/redeem' -- node server.js
option 2 - clinic flame --on-port 'autocannon -m POST localhost:3000/redeem' -- node server.js
clinic doctor --on-port 'autocannon -m POST localhost:3000/redeem' -- node server.js

Current Behavior

I get following output for option1

clinic flame helps you find synchronous bottlenecks
by creating a flamegraph visualization that assists in identifying
function calls that may be blocking the event loop.
clinic flame only supports Linux, OS X and Solaris.

I get following error for second option 2
(node:6308) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: -m is not a recognized flag
(node:6308) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Steps to Reproduce (for bugs)

  1. run the command as described in the paragraph above.

Code for windows

My code is simple express application with mongodb as db .

Environment

  • Clinic doctor version: 2.4.1
    Clinic flame version : V4.0.11
    node version : 8.9.4
    npm version : 5.6.0
server.js
const express = require('express');
const bodyparser = require('body-parser');
const MongoClient = require('mongodb').MongoClient;
const url = "mongodb://localhost:27017/";
const app = express();
let mongoDb = null;

app.use(bodyparser.json());
app.use(bodyparser.urlencoded({ extended: true }));
let options = { useNewUrlParser: true };
app.listen(3000, function () {
    MongoClient.connect(url, options, function (err, db) {
        if (err) {
            throw err;
        }
        else {
            console.log("db connected");
            mongoDb = db;
        }
    });
    console.log("app is ready on port 3000");
});

app.post('/redeem', (req, res) => {
    console.log("first line on post");
    let db = mongoDb.db("finacle");
    console.dir(req.body, { depth: null, colors: true });
    //db.collection('trans').insertOne( { 'couponCode' : 'A123', 'points' : 100});
    let message = '';
    try {
        if (req.body) {
            if (Array.isArray(req.body)) {
                for (let obj of req.body) {
                    console.log(obj);
                    db.collection('trans').insertOne(obj);
                }
                message = 'Total  ' + req.body.length + ' Objects saved';
            }
            else if(req.body.couponCode) {
                db.collection('trans').insertOne(req.body);
                console.log("saved inside a collection");
                message = 'Total  ' + req.body.length + ' saved';
            }
            else {
                console.log("100 coupons generation");
                let max = 100;
                let obj = {};
                let val = getRandomInt(max);
                let couponCode = 'B';
                for (let val= 0 ; val< max; val++) {
                    obj = Object.create(null);
                    couponCode = 'B' + val;
                    obj.couponCode = couponCode;
                    obj.points = getRandomInt(1000);
                    db.collection('trans').insertOne(obj);
                }
                message = 'Total objects created : '+ max;
            }
        }
        
    }
    catch (ex) {
        console.log("exception " + ex);
    }
    //let allRecs = db.collection('trans').find();
    let obj = { "message": message };
    res.status(200).json(obj);
    //mongoDb.close();
});

function getRandomInt(max) {
    return Math.floor(Math.random() * Math.floor(max));
}

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.