0

I have a HapiJS server running with a variety of plugins and modules used throughout. Sometimes API calls take longer than I would expect and I'm looking to instrument the code to be able to get a timing breakdown of what downstream service/call is taking up all the time.

What options are there for doing this in an on-demand fashion? Something similar to this mojito-waterfall?

2
  • Asking for modules is considered off-topic here. Though it's not as active as stack overflow, you probably want to go to Software Recommendations or frame your question differently so you're asking how to solve a specific problem rather than asking for a module to solve the problem. Commented Sep 28, 2016 at 6:49
  • 2
    A simple change to "how do I do..." would bring this back on-topic. Note that answering with a module as a recommendation is not considered bad practice (unless the answer is a link only answer) Commented Sep 28, 2016 at 6:55

1 Answer 1

1

To generally inspect network traffic on node.js you can use node-inspector. Just install it then run your application with node-debug and connect to the debugger with Google Chrome (not sure if it works with other browsers because it uses Chrome's developer tools). You can then open the network tab and see all network connections just like you would debugging your browser code.

Note that some versions of node.js may not work with node-inspector. The latest version that works that I know of to date is 6.3.1. Downgrade/upgrade node.js as necessary.

Sign up to request clarification or add additional context in comments.

2 Comments

Is there any option for doing this off a live server, instead of restarting node?
You can if you ran your server in debugging mode. Node.js opens a debugging port that you can connect to. I think there's something in the node-inspector docs about how to connect to a currently running debugger. But if you didn't run node in debugging mode then I don't think there's any mechanism to connect to it. I'm not sure what's the speed penalty when running in debugging mode.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.