From 8aa644a03175c338521e2a0a809db9abe57c7d19 Mon Sep 17 00:00:00 2001 From: Matchu Date: Mon, 18 Jan 2021 16:31:02 -0800 Subject: [PATCH] Stop sending client-side nav transaction to Sentry Oops, we hit our Sentry transaction limit after 3 days! This is in part because we selected a 100% sample rate to start, but also because our app has a lot of client-side navs that don't represent real navigation, and are just to update the state in the URL. I'm not using most of Sentry's performance tracing features, though! I don't have logging that helps us understand once the page is really done, and I'm only really able to use Web Vitals right now - which only applies to first-time pageload events, anyway. So, that's now all we track! --- src/app/App.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/app/App.js b/src/app/App.js index bcde5a1..c96f932 100644 --- a/src/app/App.js +++ b/src/app/App.js @@ -75,17 +75,23 @@ Sentry.init({ ...context, // Assume any path segment starting with a digit is an ID, and replace // it with `:id`. This will help group related routes in Sentry stats. - // NOTE: I'm a bit uncertain about the timing on this? This seems to - // work on initial pageload, but I feel like this won't help for - // describing the page we're navigating _to_... but maybe that's - // okay in practice? I'm just following the Sentry docs. + // NOTE: I'm a bit uncertain about the timing on this for tracking + // client-side navs... but we now only track first-time + // pageloads, and it definitely works correctly for them! name: window.location.pathname.replaceAll(/\/[0-9][^/]*/g, "/:id"), }), + + // We have a _lot_ of location changes that don't actually signify useful + // navigations, like in the wardrobe page. It could be useful to trace + // them with better filtering someday, but frankly we don't use the perf + // features besides Web Vitals right now, and those only get tracked on + // first-time pageloads, anyway. So, don't track client-side navs! + startTransactionOnLocationChange: false, }), ], - // I'm figuring our traffic is low enough that 100% sample rate is fine. - // Let's see if we hit any usage limits! + // Since we're only tracking first-page loads and not navigations, 100% + // sampling isn't actually so much! Tune down if it becomes a problem, tho. tracesSampleRate: 1.0, });