The BA Inspector. This is not an observability tool, but instead is a development tool that helps you monitor what's happening in your application.
A few years ago, Chrome DevTools was integrated directly into BA, expanding its capabilities to include newer applications.
There are a few ways to get started. One is using the inspect flag, as we can see here, which will start the inspector. Then you can pass a host and a port that you want to listen, just as here. And if no parameters are passed, it will connect to the port 127 by default, as we can see here. One other way is useful when doing a local development using the inspect break flag, this flag. This has the same options for hosts and ports that the inspect flag, but also puts a break point before the user code starts. So you can do any type of setup you prefer without having to try to catch breakpoints in your code at runtime.
Now, let's check a little demo. So if we create this line of code here, just a promise reject, a new error, a very cool error. And then if we just do node the flag inspect break and the name of the file, we can see that Booker is listening of WS, and then we have a WebSocket URL. WebSocket makes it possible to open like a two-way interactive communication session between your users, browsers and servers. We can also see a message here that directs us to the Node.js documentation so we understand what's happening there and if we have any questions, we can just go there. Then if we go to Chrome inspect this will direct us to a link here, Node.js link and if we open up that link, it will show us a pop up window for debugging your Node.js session. So now devtools is connected to your Node.js providing you with access to all of the Chrome devtools features you used and this allows you to edit pages on the fly, access source map, live edit, console evaluation, sample in JavaScript profiler with frame graph, heap of snapshots, asynchronous stacks for native premises and others.
However, the VA inspectors should never be used in production because devtools actions hold events. This is acceptable in development, but it's not suitable for production environments. For production environments, we will see later which one is the best options. But there are some problems with things that Node.js already provides for observability, like profiling, performance hooks, and others is that it tells you that there is a problem but it doesn't tell you where to find it. Also, sometimes there's not easy to implement. It doesn't give you enough information or is not presented in an easy way, like graphs or a center performance metric that standard tools provide. Also, it has significant overhead. Generally, it is not viable in production and only provides data overhead, which means that there's a ton of data and it requires expertise to separate signal and significant data from noise.
But there are some pros because there are great toolings and they have extensive data and insight. So now, we will check some external tools for Node.js observability. First is the blocked library. The block npm package is a concise example of using timers for observability. It helps you check if the loop is blocked.
Comments