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

Add additional app and device fields #881

Merged
merged 17 commits into from
Jun 23, 2020
Merged

Conversation

imjoehaines
Copy link
Contributor

@imjoehaines imjoehaines commented Jun 5, 2020

This PR adds a number of additional fields to the app and device notify keys, specifically:

  • plugin-browser-device
    • orientation — the orientation of the browser using the Screen.orientation API. This is fairly widely supported, but not universally (e.g. Safari doesn't support this). There is also fallback which compares the browser width & height, to support more devices
  • plugin-expo-device
    • totalMemory — the total memory available on the device, fetched with the expo-device module, which is a new dependency
  • plugin-node-device
    • osName — this uses os.platform, so reports the kernel name. This is still a good indicator and is much simpler and less error prone than trying to detect the OS
    • osVersion — this uses os.release, which is also kernel information
    • totalMemory — the total memory available to the node process (os.totalmem)
    • freeMemory — the free memory available to the node process (os.freemem)

Two new plugins have been added:

  • plugin-browser-app:
    • Adds the duration field to event.app, like the existing plugin-expo-app
  • plugin-node-app
    • Adds the duration field to event.app, like the existing plugin-expo-app

These plugins are currently identical so it may make sense to merge them into a plugin-duration, which could then be used in Expo too. I'm not sure if we'd want to keep them separate though, so that there's room for them to diverge in future if we add more app fields to the browser or Node

This stores the number of milliseconds that the application has
been running, based on the time Bugsnag was started and the time
the event happened

This also removes the Expo specific implementation of this, so it
also uses the version from core
This adds the 'manufacturer' and 'model' fields to Android and the
total device memory to both iOS and Android
@bugsnagbot
Copy link
Collaborator

bugsnagbot commented Jun 5, 2020

@bugsnag/browser bundle size diff

Minified Minfied + Gzipped
Before 39.22 kB 12.11 kB
After 39.54 kB 12.21 kB
± ⚠️ +317 bytes ⚠️ +96 bytes

Generated by 🚫 dangerJS against a9addf0

Copy link
Contributor

@djskinner djskinner left a comment

Choose a reason for hiding this comment

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

LGTM. A couple of comments to consider. Probably best if someone else approves too but looks good to me against the spec.

packages/core/test/client.test.ts Outdated Show resolved Hide resolved
packages/core/client.js Outdated Show resolved Hide resolved
packages/plugin-expo-app/app.js Outdated Show resolved Hide resolved
Copy link
Contributor

@bengourley bengourley left a comment

Choose a reason for hiding this comment

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

In addition to the inline comments, as we discussed, the app duration functionality should be shared between node and the browser. I think since expo's app plugin collects more info, it's fine for app.duration to be populated there.

I think the new plugin should be called @bugsnag/plugin-app-duration.

packages/plugin-browser-device/device.js Outdated Show resolved Hide resolved
packages/plugin-expo-device/device.js Outdated Show resolved Hide resolved
packages/plugin-expo-device/device.js Outdated Show resolved Hide resolved
@imjoehaines imjoehaines force-pushed the add-app-and-device-fields branch 2 times, most recently from b22fe62 to bc2fb4a Compare June 23, 2020 07:46
@bengourley bengourley merged commit 734d5c8 into next Jun 23, 2020
@bengourley bengourley deleted the add-app-and-device-fields branch June 23, 2020 14:22
@bengourley bengourley mentioned this pull request Jul 6, 2020
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