Skip to content

Overview ​

httpTracingIntegration records every outgoing HTTP request as an http.client span, named after its method and path (POST /v1/charges). It watches both ways a Node process makes requests:

  • the global fetch();
  • node:http / node:https — and every library built on them (axios, got, node-fetch, SDKs of third-party APIs).

Each span records http.method, http.url and http.status_code. It gets status ok for a 2xx response and error otherwise, including network failures. The SDK's own requests to /api/envelope are ignored.

A request made while a span is active becomes its child, so with HttpServerIntegration the calls a request handler makes show up inside that request's trace.

Usage ​

ts
import { use } from '@buglapse/node'
import { httpTracingIntegration } from '@buglapse/node/integrations'

use(httpTracingIntegration())

It has no options. A node:http span ends once the response has been read to the end; a response your code never reads leaves its span unsent.