diff --git a/develop-docs/sdk/data-model/event-payloads/contexts.mdx b/develop-docs/sdk/data-model/event-payloads/contexts.mdx index 33d1b404cb02e6..0d4c22d1c55d09 100644 --- a/develop-docs/sdk/data-model/event-payloads/contexts.mdx +++ b/develop-docs/sdk/data-model/event-payloads/contexts.mdx @@ -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": "john.doe@example.com" }` + +`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": "john.doe@example.com" }` + +**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": "john.doe@example.com" + }, + "http.response.status_code": 200, + "http.response.headers": { + "Content-Type": "application/json" + }, + "http.response.data": { + "name": "John Doe", + "email": "john.doe@example.com" + } + } + } +} +``` + ## Response Context Response context contains information about the HTTP response associated with the event. @@ -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 } } } @@ -851,7 +990,6 @@ The feature flag context contains information about the flags evaluated prior to - Example: `false` - **Example Feature Flag Context** ```json diff --git a/develop-docs/sdk/data-model/event-payloads/request.mdx b/develop-docs/sdk/data-model/event-payloads/request.mdx index 7ebcb51c7897f5..b2aa7079c657f6 100644 --- a/develop-docs/sdk/data-model/event-payloads/request.mdx +++ b/develop-docs/sdk/data-model/event-payloads/request.mdx @@ -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