Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
52 changes: 51 additions & 1 deletion develop-docs/sdk/data-model/event-payloads/contexts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,56 @@ envelope endpoint.
}
```

## Page Context

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

`full.url`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels a bit overkill for me to store everything in separate fields. What's wrong with just having a url field?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @cleptric had concerns about pii stripping etc!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getsentry/sentry-javascript#7667 for context. We imo should not emit the full URL.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated this to be: url, http.query and http.fragment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still feels like a mess because url sounds like it contains the full url.

How about we lean it on the window.location API, which I'd assume is something people can relate to?:

  • location.origin
  • location.pathname
  • location.search
  • location.hash

From that you can reconstruct the the entire URL (minus some PII redactions).


: **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/"
}
}
}
```

## Response Context

Response context contains information about the HTTP response associated with the event.
Expand Down Expand Up @@ -829,7 +879,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 Down
5 changes: 2 additions & 3 deletions develop-docs/sdk/data-model/event-payloads/request.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ 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.
event. In client SDKs, this can be an outgoing request (use the [page context](../contexts/#page-context) to track the page that the request was made from).
On server SDKs, this could be the incoming web request that is being handled.

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