【问题标题】:Performance monitoring is not uploaded by sentry-expo性能监控不是sentry-expo上传的
【发布时间】:2023-01-03 18:09:30
【问题描述】:

我想从哨兵文档中实现自动检测,但它没有上传。 https://docs.sentry.io/platforms/react-native/performance/instrumentation/automatic-instrumentation/ 我只检查IOS。 react-native 应用程序使用裸工作流程进行博览会。我用的是sentry的TEAM plan,是bare work flow,所以需要和document的设置不一样吗?我已经确认我正在运行react-native link @sentry/react-native。 https://docs.expo.dev/guides/using-sentry/

  • 世博会^43.0.0
  • 哨兵博览会^4.0.0
  • 世博会设备 4.0.3
  • 世博常量 12.1.3
  • @sentry/react-native 3.4.1
  • @react-navigation/native ^5.7.6
  • @react-navigation/stack ^5.9.3
// App.tsx
import * as Sentry from "sentry-expo";
import { routingInstrumentation } from "./RootNavigator";

Sentry.init({
    dsn: SENTRY_DNS,
    enableInExpoDevelopment: true,
    debug: true,
    environment: isDevProject ? "development" : "production",
    integrations: [
      new Sentry.Native.ReactNativeTracing({
        routingInstrumentation
      })
    ]
  });

const App = () => {
...
export default Sentry.Native.wrap(App);

// RootNavigator.tsx
export const routingInstrumentation =
  new Sentry.Native.ReactNavigationInstrumentation();

export const RootNavigator = () => {
  const navigation = useRef();
  return (
    <NavigationContainer
      ref={navigation}
      onReady={() => {
        routingInstrumentation.registerNavigationContainer(navigation);
      }}
    >
      <RootStack />
    </NavigationContainer>
  );
};

日志

 LOG  Sentry Logger [log]: Integration installed: Release
 LOG  Sentry Logger [log]: Integration installed: InboundFilters
 LOG  Sentry Logger [log]: Integration installed: FunctionToString
 LOG  Sentry Logger [log]: Integration installed: Breadcrumbs
 LOG  Sentry Logger [log]: Integration installed: LinkedErrors
 LOG  Sentry Logger [log]: Integration installed: Dedupe
 LOG  Sentry Logger [log]: Integration installed: UserAgent
 LOG  Sentry Logger [log]: Integration installed: EventOrigin
 LOG  Sentry Logger [log]: Integration installed: SdkInfo
 LOG  Sentry Logger [log]: Integration installed: DebugSymbolicator
 LOG  Sentry Logger [log]: Integration installed: DeviceContext
 LOG  Sentry Logger [log]: Unhandled promise rejections will be caught by Sentry.
 LOG  Sentry Logger [log]: Integration installed: ReactNativeErrorHandlers
 LOG  Sentry Logger [log]: Integration installed: ExpoBareIntegration
 LOG  Sentry Logger [log]: Integration installed: RewriteFrames
 LOG  Sentry Logger [log]: [ReactNativeTracing] Native frames instrumentation initialized.
 LOG  Sentry Logger [log]: Setting idle transaction on scope. Span ID: b83d8034e147174f
 LOG  Sentry Logger [log]: [ReactNativeTracing] Starting navigation transaction "Route Change" on scope
 LOG  Sentry Logger [log]: Integration installed: ReactNativeTracing
 LOG  Sentry Logger [log]: [Tracing] No active IdleTransaction
 LOG  Sentry Logger [log]: [Tracing] Discarding transaction because its trace was not chosen to be sampled.
 LOG  Sentry Logger [log]: [Tracing] No active IdleTransaction
 WARN  Constants.installationId has been deprecated in favor of generating and storing your own ID. Implement it using expo-application's androidId on Android and a storage API such as expo-secure-store on iOS and localStorage on the web. This API will be removed in SDK 44.
 LOG  Sentry Logger [log]: [ReactNavigationInstrumentation] Navigation container registered, but integration has not been setup yet.
 LOG  Sentry Logger [log]: Setting idle transaction on scope. Span ID: 9b853cb1f7205d52
 LOG  Sentry Logger [log]: [ReactNativeTracing] Starting navigation transaction "Route Change" on scope
 LOG  Sentry Logger [log]: [ReactNavigationInstrumentation] Will not send transaction "HomeScreen" due to beforeNavigate.
 LOG  Sentry Logger [log]: Setting idle transaction on scope. Span ID: 8ff341d5619f89aa
 LOG  Sentry Logger [log]: [ReactNativeTracing] Starting navigation transaction "Route Change" on scope
 LOG  Sentry Logger [log]: Setting idle transaction on scope. Span ID: a7c139b65d6cab41
 LOG  Sentry Logger [log]: [ReactNativeTracing] Starting navigation transaction "Route Change" on scope
 LOG  Sentry Logger [log]: [Tracing] No active IdleTransaction
 LOG  Sentry Logger [log]: [Tracing] Discarding transaction because its trace was not chosen to be sampled.
 LOG  Sentry Logger [log]: [Tracing] No active IdleTransaction
 LOG  Sentry Logger [log]: [Tracing] Discarding transaction because its trace was not chosen to be sampled.
 LOG  Sentry Logger [log]: [Tracing] No active IdleTransaction
 LOG  Sentry Logger [log]: [Tracing] Discarding transaction because its trace was not chosen to be sampled.
 LOG  Sentry Logger [log]: Setting idle transaction on scope. Span ID: bff56876a83da89c
 LOG  Sentry Logger [log]: [ReactNativeTracing] Starting navigation transaction "Route Change" on scope
 LOG  Sentry Logger [log]: [Tracing] No active IdleTransaction
 LOG  Sentry Logger [log]: [Tracing] Discarding transaction because its trace was not chosen to be sampled.

Screen of sentory's dashboard

【问题讨论】:

  • 我面临同样的问题,你是如何解决的?

标签: react-native expo sentry


【解决方案1】:

通过遵循世博会文档,我遇到了同样的问题。 由于他们没有提到性能监控,因此 init 中缺少一个参数:

import * as Sentry from "@sentry/react-native";

Sentry.init({
  dsn: YOUR_DNS,
  // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
  // We recommend adjusting this value in production.
  tracesSampleRate: 1.0, <--- This one
});

您可以在 react-native 的哨兵入门工具包教程中找到这个 sn-p。

【讨论】:

    猜你喜欢
    • 2022-10-16
    • 2012-09-09
    • 2020-04-16
    • 2021-06-13
    • 2019-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-09
    相关资源
    最近更新 更多