Skip to content
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

feat(develop): Add page context #13203

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

feat(develop): Add page context #13203

wants to merge 4 commits into from

Conversation

mydea
Copy link
Member

@mydea mydea commented Apr 2, 2025

This adds a new context to develop docs:

The new page context should be used to add information about the current page that an event originated on. It should be used for web-based client SDKs instead of putting this information into event.request.

Relay will need to extract data from this (if available) instead of event.request.

@mydea mydea requested review from cleptric, lforst and a team April 2, 2025 12:48
@mydea mydea self-assigned this Apr 2, 2025
Copy link

vercel bot commented Apr 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
develop-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 4, 2025 8:46am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
changelog ⬜️ Ignored (Inspect) Visit Preview Apr 4, 2025 8:46am
sentry-docs ⬜️ Ignored (Inspect) Visit Preview Apr 4, 2025 8:46am

Comment on lines 791 to 795
`user_agent`

: _Optional_. The user agent of the page that the event occurred on.

- Example: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36`
Copy link
Member

Choose a reason for hiding this comment

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

How can a "page" have a user agent?

Copy link
Member Author

Choose a reason for hiding this comment

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

hmm, how do we phrase this? We need to send the user agent somehow, as the server infers the os/browser stuff from it 🤔

We could make it page_request, would that make more sense?

Copy link
Member Author

Choose a reason for hiding this comment

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

After thinking about this, I think it makes more sense to split this out into #13205

@cleptric
Copy link
Member

cleptric commented Apr 2, 2025

Overall not a big fan. A page does not exist on mobile, and the naming could be better.

@mydea
Copy link
Member Author

mydea commented Apr 2, 2025

A page does not exist on mobile, and the naming could be better.

An app also does not exist on web but we still have an app context 😅 We basically want something similar but for the web.

@cleptric
Copy link
Member

cleptric commented Apr 2, 2025

Well, you wrote client SDKs. If this is just for Web FE, it's a different story.

@mydea mydea force-pushed the fn/page-context branch from 27c7523 to 54e8c06 Compare April 2, 2025 14:34

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

`full.url`
Copy link
Member

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.

@lforst
Copy link
Member

lforst commented Apr 2, 2025

Generally I am strongly in favor of this because request contexts make literally no sense on frontend events.

@Dav1dde
Copy link
Member

Dav1dde commented Apr 3, 2025

If you stop sending this data, this will eventually break everything that is built ontop of the existing fields, metric extraction rules for the performance products, existing filters, alerts, dashboards users built etc.

I would recommend heavily analyzing what needs to be done for the entire stack before committing to just moving data around, just because the naming may not be 'optimal' for a frontend SDK.

@mydea
Copy link
Member Author

mydea commented Apr 3, 2025

I would recommend heavily analyzing what needs to be done for the entire stack before committing to just moving data around, just because the naming may not be 'optimal' for a frontend SDK.

The naming is not just not optimal, it is simply wrong. there are not really any headers, the http method is meaningless, nobody thinks about this as HTTP Request information.

In regards to backwards compatibility: We'll continue to send the data as request data for the time being until the next major or so, likely. However, relevant data is already inferred from this - e.g. there is a url tag that is inferred, etc - which would continue to be inferred, just from the new place.

As far as I can tell, neither on issues stream, nor on trace explorer, nor alerts, allow to filter by request.xxx data - you can already only filter on inferred data (e.g. the url tag, ...). So IMHO these should not really be impacted by moving this. I would assume the request itself is not indexed, as I can't filter it anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants