Show/Get 运行时,os,来自 Sentry 的设备上下文 Javascript

Show/Get runtime, os, device contexts from Sentry Javascript

我正在尝试获取 运行时os and/or 设备 context/information Sentry 在发送事件时进行测量,例如:

我想在反应本机应用程序中回收该信息以发送到我的 API 并进行分析;因此信息必须在正常的 JavaScript 对象中并且需要随时获取,而不仅仅是在应用程序崩溃和 Sentry 发送事件时;)。

你能帮我解决这个问题吗,我只找到 setContext 的表单并完成该信息,但不知道如何在运行时获取它。

谢谢大家的支持

这些信息由 Sentry 通过其本地集成 (https://github.com/getsentry/sentry-react-native) 收集。

我建议您通过以下方式自行获取这些信息 https://github.com/react-native-community/react-native-device-info

基础 OS 构建产品基于:

DeviceInfo.getBaseOs().then(baseOs => {
  // "Windows", "Android" etc
});

获取设备名称:

DeviceInfo.getDeviceName().then(deviceName => {
  // iOS: "Becca's iPhone 6"
  // Android: ?
  // Windows: ?
});