Skip to content

feat(develop): Add outgoing_request context #13204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 140 additions & 2 deletions develop-docs/sdk/data-model/event-payloads/contexts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,145 @@ envelope endpoint.
}
```

## Page Context

Page context contains information about the page that the event occurred on.

`full.url`

: **Required.** The URL of the page that the event occurred on, including query parameters.

- Example: `https://sentry.io/issues?page=1#123`

`http.url`

: **Required.** The URL of the page that the event occurred on, excluding query parameters.

- Example: `https://sentry.io/issues`

`http.query`

: **Optional.** The query parameters of the page that the event occurred on.

- Example: `?page=1`

`http.fragment`

: **Optional.** The fragment of the page that the event occurred on.

- Example: `#123`

`referer`

: _Optional_. The referer of the page that the event occurred on.

- Example: `https://sentry.io/`

**Example Page Context**

```json
{
"contexts": {
"page": {
"full.url": "https://sentry.io/issues?page=1#123",
"http.url": "https://sentry.io/issues",
"http.query": "?page=1",
"http.fragment": "#123",
"referer": "https://sentry.io/"
}
}
}
```

## Outgoing Request Context

Outgoing request context contains information about the outgoing request associated with the event.
It should only be set for events that are associated with an outgoing request - for example, a `failed to fetch` error on a web page.

`full.url`

: **Required.** The full URL of the outgoing request, including query parameters.

- Example: `https://sentry.io/api/0/projects/sentry/sentry/issues/?page=1`

`http.request.url`

: **Required.** The full URL of the outgoing request, excluding query parameters.

- Example: `https://sentry.io/api/0/projects/sentry/sentry/issues/`

`http.request.method`

: **Required.** The HTTP method of the outgoing request.

- Example: `GET`

`http.request.query`

: **Optional.** The query parameters of the outgoing request.

- Example: `?page=1`

`http.request.headers`

: **Optional.** The headers of the outgoing request.

- Example: `{ "Content-Type": "application/json" }`

`http.request.data`

: **Optional.** The data of the outgoing request.

- Example: `{ "name": "John Doe", "email": "[email protected]" }`

`http.response.status_code`

: **Optional.** The status code of the outgoing request.

- Example: `200`

`http.response.headers`

: **Optional.** The headers of the outgoing request.

- Example: `{ "Content-Type": "application/json" }`

`http.response.data`

: **Optional.** The data of the outgoing request.

- Example: `{ "name": "John Doe", "email": "[email protected]" }`

**Example Outgoing Request Context**

```json
{
"contexts": {
"outgoing_request": {
"full.url": "https://sentry.io/api/0/projects/sentry/sentry/issues/?page=1",
"http.request.url": "https://sentry.io/api/0/projects/sentry/sentry/issues/",
"http.request.query": "?page=1",
"http.request.method": "GET",
"http.request.headers": {
"Content-Type": "application/json"
},
"http.request.data": {
"name": "John Doe",
"email": "[email protected]"
},
"http.response.status_code": 200,
"http.response.headers": {
"Content-Type": "application/json"
},
"http.response.data": {
"name": "John Doe",
"email": "[email protected]"
}
}
}
}
```

## Response Context

Response context contains information about the HTTP response associated with the event.
Expand Down Expand Up @@ -829,7 +968,7 @@ The required field is `package` which should contain the package or framework wh
"contexts": {
"missing_instrumentation": {
"package": "express",
"javascript.is_cjs": true,
"javascript.is_cjs": true
}
}
}
Expand All @@ -851,7 +990,6 @@ The feature flag context contains information about the flags evaluated prior to

- Example: `false`


**Example Feature Flag Context**

```json
Expand Down
8 changes: 4 additions & 4 deletions develop-docs/sdk/data-model/event-payloads/request.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ title: Request Interface
sidebar_order: 8
---

The Request interface contains information on a HTTP request related to the
event. In client SDKs, this can be an outgoing request, or the request that
rendered the current web page. On server SDKs, this could be the incoming web
request that is being handled.
The Request interface contains information on an incoming HTTP request related to the
event. For outgoing requests, use the [outgoing request context](../contexts/#outgoing-request-context).

In client SDKs, use the [page context](../contexts/#page-context) instead.

The data variable should only contain the request body (not the query string).
It can either be a dictionary (for standard HTTP requests) or a raw request
Expand Down