Skip to main content

Network Instrumentation

Generates: Spans

Automatically instruments HTTP requests made via fetch, XMLHttpRequest, and axios.

How It Works

Pulse React Native SDK intercepts XMLHttpRequest (XHR) to automatically capture all HTTP requests:

Each network request automatically captures HTTP method, URL, status code, request type, and error information. See the Attributes section below for complete details.

Configuration

Network instrumentation is enabled by default. You can disable it if needed:

Pulse.start({
autoDetectNetwork: true // Enabled by default
});

When autoDetectNetwork: false, network requests are not automatically tracked. No spans are created for HTTP requests.

Note: You can still manually instrument network requests using Custom Spans.

Generated Telemetry

Type: Span
Span Name: HTTP {method} (e.g., HTTP GET, HTTP POST)
Span Kind: INTERNAL

Attributes

Network-Specific Attributes

AttributeDescriptionExampleAlways Present
pulse.typeInstrumentation type with Network code"network.200"✅ Yes
http.methodHTTP method"GET", "POST"✅ Yes
http.urlNormalized request URL. See URL Normalization for details on how URLs are normalized."https://api.example.com/users/[redacted]"✅ Yes
http.request.typeRequest type"xmlhttprequest" (all requests, including fetch and Axios)✅ Yes
http.schemeURL scheme"https"⚠️ Only if URL is parseable
http.hostRequest hostname"api.example.com"⚠️ Only if URL is parseable
http.targetRequest path + query"/users/123" or "/api/users?id=123"⚠️ Only if URL is parseable
net.peer.nameServer hostname"api.example.com"⚠️ Only if URL is parseable
net.peer.portPort number8080⚠️ Only if URL contains port
http.status_codeResponse status code200, 404, 500⚠️ Only if response received
platformReact Native platform"android", "ios", "web"✅ Yes

Error Attributes (on failure)

AttributeDescriptionExample
errorError flagtrue

Note: When a network request fails (HTTP error status codes 4xx/5xx or network failures), the span includes error: true and the http.status_code (if available). Network failures may have http.status_code: 0 or missing status code.

URL Normalization

The Pulse React Native SDK automatically normalizes URLs in the http.url attribute to protect sensitive data and improve aggregation. The normalization process is identical to the Android SDK implementation.

For detailed information about URL normalization, including the normalization patterns, rationale, and examples, see the URL Normalization section in the Android SDK documentation.

Sample Payload: Successful Network Request

{
"name": "HTTP GET",
"kind": "INTERNAL",
"startTimeUnixNano": "1732735072000000000",
"endTimeUnixNano": "1732735072427640000",
"duration": "427.64ms",
"attributes": {
"pulse.type": "network",
"http.method": "GET",
"http.url": "https://jsonplaceholder.typicode.com/comments/1",
"http.scheme": "https",
"http.host": "jsonplaceholder.typicode.com",
"http.target": "/comments/1",
"http.status_code": 200,
"http.request.type": "xmlhttprequest",
"net.peer.name": "jsonplaceholder.typicode.com",
"platform": "android",
"service.name": "PulseReactNativeOtelExample",
"service.version": "1.0_1",
"device.manufacturer": "Google",
"device.model.name": "sdk_gphone64_arm64",
"os.name": "Android",
"os.version": "16",
"network.connection.type": "cell",
"network.carrier.name": "T-Mobile",
"session.id": "e19b517c705f78d5937c38005259ee1f"
}
}

Note: http.request.type is always "xmlhttprequest" because all requests (including fetch() and Axios) are intercepted via XHR in React Native.

Sample Payload: Failed Network Request (404)

{
"name": "HTTP GET",
"kind": "INTERNAL",
"status": "ERROR",
"startTimeUnixNano": "1732735075000000000",
"endTimeUnixNano": "1732735075135340000",
"duration": "135.34ms",
"attributes": {
"pulse.type": "network",
"http.method": "GET",
"http.url": "https://jsonplaceholder.typicode.com/posts/[redacted]",
"http.scheme": "https",
"http.host": "jsonplaceholder.typicode.com",
"http.target": "/posts/999999",
"http.status_code": 404,
"http.request.type": "xmlhttprequest",
"net.peer.name": "jsonplaceholder.typicode.com",
"error": true,
"platform": "android",
"service.name": "PulseReactNativeOtelExample",
"service.version": "1.0_1",
"device.manufacturer": "Google",
"device.model.name": "sdk_gphone64_arm64",
"os.name": "Android",
"os.version": "16",
"network.connection.type": "cell",
"network.carrier.name": "T-Mobile",
"session.id": "e19b517c705f78d5937c38005259ee1f"
}
}

Note: HTTP error status codes (4xx, 5xx) result in spans with status: "ERROR" and include error: true. Network failures (connection errors, timeouts) also include error: true and may have http.status_code: 0 or missing status code.

Global Attributes

All network spans include global attributes (service, device, OS, session, etc.). See Global Attributes for complete list.