Skip to content

feat(ourlogs): Add browser name/version to logs#4757

Merged
AbhiPrasad merged 5 commits intomasterfrom
abhi-browser-in-ourlogs
May 28, 2025
Merged

feat(ourlogs): Add browser name/version to logs#4757
AbhiPrasad merged 5 commits intomasterfrom
abhi-browser-in-ourlogs

Conversation

@AbhiPrasad
Copy link
Contributor

@AbhiPrasad AbhiPrasad commented May 20, 2025

We've received feedback externally and internally that users want to see browser information attached to their frontend logs. This matches behaviour that already exists in other data types like spans and errors (events) in the product.

To accomplish this, we generate new attributes on the log based on the incoming user agent and client hints. This matches the approach we take with spans and errors.

We set these via two new attributes, browser.name and browser.version. This is documented in the conventions here:

resolves https://linear.app/getsentry/issue/LOGS-133

@AbhiPrasad AbhiPrasad force-pushed the abhi-browser-in-ourlogs branch from 64dfb13 to cf1aece Compare May 21, 2025 20:08
@AbhiPrasad AbhiPrasad requested a review from k-fish May 21, 2025 20:09
@AbhiPrasad AbhiPrasad marked this pull request as ready for review May 21, 2025 20:09
@AbhiPrasad AbhiPrasad requested a review from a team as a code owner May 21, 2025 20:09
Copy link
Member

@Dav1dde Dav1dde left a comment

Choose a reason for hiding this comment

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

Mostly nits, would be great if you can also modify an existing integration test.

@AbhiPrasad
Copy link
Contributor Author

Addressed PR review comments, and added a changelog entry.

would be great if you can also modify an existing integration test

I pushed up a new integration test in b1aacc3

@AbhiPrasad
Copy link
Contributor Author

CI seems to be failing because of the types - but they should be correct (I can build and test locally). I think this is a stale cache issue. Is there an easy way to blow up the cache and reset this?

@Dav1dde
Copy link
Member

Dav1dde commented May 26, 2025

@AbhiPrasad it's most likely failing because you test locally with --all-features but this CI job compiles the code without the processing feature.

@AbhiPrasad
Copy link
Contributor Author

Good catch @Dav1dde.

Would you prefer if I moved the processing logic into it's own folder (I see this pattern with relay-server/src/services/processor/span.rs and relay-server/src/services/processor/ourlog/processing.rs), or just move things around in this file?

@Dav1dde
Copy link
Member

Dav1dde commented May 27, 2025

I think just moving all processing stuff to a new module might be much easier.

@AbhiPrasad
Copy link
Contributor Author

I pushed up 19af62a to move all the processing code into it's own file, relay-server/src/services/processor/ourlog/processing.rs.

AbhiPrasad added a commit to getsentry/sentry-docs that referenced this pull request May 27, 2025
…lts for every platform (#13832)

resolves https://linear.app/getsentry/issue/LOGS-28

After testing with some SDKs and getting feedback, we've decided on a
list of default attributes the SDKs should try to attach to logs.

This includes
1. user attributes from
https://develop.sentry.dev/sdk/data-model/event-payloads/user/
2. browser attributes, parsed from user agents
(getsentry/relay#4757)
3. os and device attributes attached to mobile, desktop, and native
sdks, based on
https://develop.sentry.dev/sdk/data-model/event-payloads/contexts/

I also re-organized this section to make things a bit more clear.

---------

Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>
@AbhiPrasad AbhiPrasad merged commit b95faff into master May 28, 2025
28 checks passed
@AbhiPrasad AbhiPrasad deleted the abhi-browser-in-ourlogs branch May 28, 2025 11:22
AbhiPrasad added a commit that referenced this pull request May 28, 2025
This was messed up when I rebased #4757

#skip-changelog
AbhiPrasad added a commit that referenced this pull request May 30, 2025
In #4757 we decided to attach
browser name and version to logs.

Right now for spans, we prefix browser information with `sentry.X`, see
https://github.com/getsentry/sentry/blob/34c738613c9b39e3b0d64336d13b4551a4075c66/src/sentry/search/eap/spans/attributes.py#L334.

This is causing inconsistencies between the queries for spans and logs,
which is breaking the current queries for the logs view. Considering we
are "enhancing" the data via relay, I think it makes sense to also add a
`sentry.X` prefix for logs. This PR makes that change.

resolves https://linear.app/getsentry/issue/LOGS-152
antonpirker pushed a commit to getsentry/sentry-docs that referenced this pull request Jun 6, 2025
…lts for every platform (#13832)

resolves https://linear.app/getsentry/issue/LOGS-28

After testing with some SDKs and getting feedback, we've decided on a
list of default attributes the SDKs should try to attach to logs.

This includes
1. user attributes from
https://develop.sentry.dev/sdk/data-model/event-payloads/user/
2. browser attributes, parsed from user agents
(getsentry/relay#4757)
3. os and device attributes attached to mobile, desktop, and native
sdks, based on
https://develop.sentry.dev/sdk/data-model/event-payloads/contexts/

I also re-organized this section to make things a bit more clear.

---------

Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>
bitsandfoxes pushed a commit to getsentry/sentry-docs that referenced this pull request Jul 3, 2025
…lts for every platform (#13832)

resolves https://linear.app/getsentry/issue/LOGS-28

After testing with some SDKs and getting feedback, we've decided on a
list of default attributes the SDKs should try to attach to logs.

This includes
1. user attributes from
https://develop.sentry.dev/sdk/data-model/event-payloads/user/
2. browser attributes, parsed from user agents
(getsentry/relay#4757)
3. os and device attributes attached to mobile, desktop, and native
sdks, based on
https://develop.sentry.dev/sdk/data-model/event-payloads/contexts/

I also re-organized this section to make things a bit more clear.

---------

Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>
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.

2 participants