getsentry / getsentry/sentry-javascript

Use `client.on('startNavigationSpan')` in the BrowserSession integration

オープン
#18,998 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
Browser Feature
主要言語
TypeScript
スター
8.7k
フォーク
1.8k
平均マージ
1日 17時間
マージ済み PR(30日)
515

説明

### Description

follow up to https://github.com/getsentry/sentry-javascript/issues/18921#issuecomment-3790620627

Right now we make use of `addHistoryInstrumentationHandler`, which listens on the `popstate` event listener. This works fine, but when tracing is enabled `client.on('startNavigationSpan')` is more granular for specific libraries, such as reactrouter: https://github.com/getsentry/sentry-javascript/blob/c45eae4648179c8d565439ec07d0ec386babf9d6/packages/react/src/reactrouter.tsx#L174-L181

With the `client.on` approach, there _might be 2 problems_:

1. There won't be any `from` anymore. So in case we would implement a function to exclude certain routes, we would only have the `to` parameter in a slightly different format
2. If my research is correct, we might have receive 1 more session, as we don't skip the first transaction (as there is a `from !== undefined`, which would be the first navigation): https://github.com/getsentry/sentry-javascript/blob/c45eae4648179c8d565439ec07d0ec386babf9d6/packages/browser/src/integrations/browsersession.ts#L50

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。