---
title: "Requests Module"
url: https://develop.sentry.dev/sdk/telemetry/traces/modules/requests/
---

# Requests Module

The SDK should auto-instrument all outgoing HTTP requests, regardless of the library that issues the requests. Each outgoing request should result in a span. The Requests module is technology agnostic, it only cares about span data properties.

## [Span Attributes](https://develop.sentry.dev/sdk/telemetry/traces/modules/requests.md#span-attributes)

| Attribute     | Description                                                                                                            | Notes                                                                                                                                    |
| ------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `op`          | Always `"http.client"`                                                                                                 | Required                                                                                                                                 |
| `description` | A string including the HTTP request method, and the partial URL. e.g., `"GET https://example.com/data.json"`           | Required [1](https://develop.sentry.dev/sdk/telemetry/traces/modules/requests.md#user-content-fn-1)                                      |
| `data`        | A key-value mapping of span attributes. (e.g., `{"http.query": "filter=all", "server.address": "prod-2.example.com"}`) | Required for full experience. See [Span Data](https://develop.sentry.dev/sdk/telemetry/traces/modules/requests.md#span-data) for details |

### [Span Data](https://develop.sentry.dev/sdk/telemetry/traces/modules/requests.md#span-data)

None of the span data fields are hard requirements, but attaching as many of them as possible is a more future-proof approach. We recommend that the SDK adds every attribute listed in the [HTTP Span Data Conventions](https://develop.sentry.dev/sdk/performance/span-data-conventions.md#http). The minimal requirements are:

* `server.address` must be set to allow correct domain grouping *for descriptions containing relative URLs*. e.g., the description `"GET /data.json"` is missing a domain. In this case, `server.address` must be set. If the span description contains the partial URL, `span.server` can be omitted
* `http.response.status_code` must be set to enable response code breakdowns

## [Instrumentation Example](https://develop.sentry.dev/sdk/telemetry/traces/modules/requests.md#instrumentation-example)

Consider a website called "App Ex", running on `app.example.com`. This JavaScript code that issues an HTTP request from the browser:

```javascript
fetch("/data.json");
```

Should result in the following span, assuming the request was successful:

```json
{
  "description": "GET /data.json?user=1",
  "op": "http.client",
  "data": {
    "http.query": "user=1",
    "http.request_method": "GET",
    "http.response.status_code": 200,
    "http.fragment": "",
    "server.address": "app.example.com",
    "server.port": 8080,
    ... other span properties
  }
}
```

## [Footnotes](https://develop.sentry.dev/sdk/telemetry/traces/modules/requests.md#footnote-label)

1. The HTTP method must be one of the [known HTTP request methods](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) [↩](https://develop.sentry.dev/sdk/telemetry/traces/modules/requests.md#user-content-fnref-1)
