【问题标题】:Sentry.io and using the withProfiler HOC for React performance...i think i'm missing somethingSentry.io 并使用 withProfiler HOC 进行 React 性能......我想我错过了一些东西
【发布时间】:2021-07-10 09:31:00
【问题描述】:

所以,我想试用 Sentry 的 withProfiler 组件,看看它是如何报告组件性能的。我按照以下示例进行操作:

https://docs.sentry.io/platforms/javascript/guides/react/#monitor-performance

唯一的区别是组件是使用 redux compose() 导出的。所以对于 Sentry,它看起来像这样:

export default compose(
    withStuff,
    withMoreStuff,
    Sentry.withProfiler,
    connect(mapStateToProps)
)(App);

我还尝试包装一个简单的计数器应用程序。只是看看它是否可以在没有 redux 的情况下工作。

然后我访问了我的页面,并观看了组件渲染。我希望在项目绩效仪表板中看到一些东西。我看到了 react.mount 的时机。但是没有 react.render 或 react.update,即使文档表明它应该被追踪。

https://docs.sentry.io/platforms/javascript/guides/react/components/profiler/

有人知道我做错了什么吗?

谢谢!

【问题讨论】:

    标签: javascript reactjs performance sentry


    【解决方案1】:

    仅当它们所属的事务完成时才跟踪 Spans 数据,因此如果在您的组件更新时没有正在进行的事务,则不会将任何相关内容发送到 Sentry。当您“访问页面”时,Sentry 的自动性能跟踪会启动 pageloadnavigation 事务,然后结束(在您的情况下,我认为这很快就会发生),除非您以编程方式进行,否则不会进行性能跟踪开始另一个事务(参见Custom Instrumentation for React | Sentry Documentation)。

    【讨论】:

      猜你喜欢
      • 2015-07-15
      • 1970-01-01
      • 1970-01-01
      • 2011-05-14
      • 1970-01-01
      • 2018-01-08
      • 2010-09-06
      • 2010-10-17
      • 1970-01-01
      相关资源
      最近更新 更多