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(rum): Capture browser navigator information #2966

Merged
merged 13 commits into from
Oct 19, 2020
Merged

Conversation

dashed
Copy link
Member

@dashed dashed commented Oct 9, 2020

We capture information from window.navigator that can provide insights into the browser (user agent) environment: https://developer.mozilla.org/en-US/docs/Web/API/Navigator

Capture network connectivity information (http://wicg.github.io/netinfo/) such as:

Device information such as:

These properties provide insights into why some transactions are longer than they typically are (e.g. someone is accessing Sentry using a poor Internet connection).

@dashed dashed requested review from rhcarvalho and a team October 9, 2020 20:16
@dashed dashed requested a review from kamilogorek as a code owner October 9, 2020 20:16
@dashed dashed self-assigned this Oct 9, 2020
*/
public setContexts(contexts: Contexts): void {
this._contexts = contexts;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Unsure if there's a better way for this.

Copy link
Contributor

Choose a reason for hiding this comment

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

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've decided to remove this altogether.

@dashed dashed requested a review from a team October 9, 2020 20:28
@github-actions
Copy link
Contributor

github-actions bot commented Oct 9, 2020

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 19.59 KB (0%)
@sentry/browser - Webpack 20.42 KB (0%)
@sentry/react - Webpack 20.42 KB (0%)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 26.54 KB (+0.61% 🔺)

@dashed dashed force-pushed the add-browser-context branch from e0d238d to 0330779 Compare October 16, 2020 19:33
@dashed dashed requested a review from kamilogorek October 16, 2020 22:16
@@ -327,3 +370,7 @@ export function _startChild(transaction: Transaction, { startTimestamp, ...ctx }
...ctx,
});
}

function isMeasurementValue(measurement: any): measurement is number {
Copy link
Contributor

Choose a reason for hiding this comment

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

Using is number should be fine here as it's generic type. We had a lot of issues with env-specific ones though :( #2277

Copy link
Member Author

Choose a reason for hiding this comment

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

Gotcha. I removed the usage of this TS feature.

* Capture the information of the user agent.
*/
private _trackNavigator(transaction: Transaction): void {
const navigator = global.navigator as null | (Navigator & NavigatorNetworkInformation & NavigatorDeviceMemory);
Copy link
Contributor

Choose a reason for hiding this comment

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

If you'd use if (!('navigator' in global)) would it still require adding information/device types? If so, we can leave it as is.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep. TypeScript does not provide the built-in interfaces for NavigatorNetworkInformation and NavigatorDeviceMemory.

@dashed dashed force-pushed the add-browser-context branch from a722fee to 221360d Compare October 19, 2020 15:00
@dashed dashed merged commit b22791e into master Oct 19, 2020
@dashed dashed deleted the add-browser-context branch October 19, 2020 16:12
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.

3 participants