Network
The network Instrument automatically tracks outgoing HTTP(S) requests, providing valuable insights into network traffic and how modules and different parts of your application utilize the network.
It works by intercepting the fetch
function and Node’s built-in http(s)
module. This approach ensures that all outgoing requests, regardless of their origin, will be captured automatically across the entire application, including external modules. This allows you to track requests made by third-party modules and SDKs such as Stripe and AWS.
Instrument
Access the network instrument via the network
namespace:
Configuration
Configure the network instrument using the main Inspector configuration options:
Available configuration options:
disabled: boolean
: Disables the instrument. When disabled, the instrument cannot be activated, and no data will be recorded (defaultfalse
).interceptors: [fetch | http]
: An array of enabled interceptors. Possible values:fetch
,http
.maxBodySize: number
: The maximum size of the captured request body (in bytes). The body will be trimmed to this size.readBody: boolean
: Whether to capture the request body.
Capturing Requests
When the instrument is activated, request capture works automatically. Simply calling fetch
(or making a request from the http(s)
modules) will capture the request.
If you wish to track custom requests, for example, if you use unsupported APIs, utilize the push
function:
Querying Network
While you can easily view tracked requests in the Application, sometimes you may need to perform more specific queries. In such cases, utilize the query()
function, which is consistent across all instruments.