-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
98828 Add initial RUM implementation - form 10-10d #33772
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adds RUM initialization function (modified from EZR form example).
sessionSampleRate: 100, | ||
sessionReplaySampleRate: 100, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defaulting to 100% because we need to test in staging. Once we decide to start using in prod, this will have to change to a significantly reduced percentage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Helper used later with useMemo
to get relevant feature toggle state
import { VaBreadcrumbs } from '@department-of-veterans-affairs/component-library/dist/react-bindings'; | ||
import PropTypes from 'prop-types'; | ||
import RoutedSavableApp from 'platform/forms/save-in-progress/RoutedSavableApp'; | ||
import { VaBreadcrumbs } from '@department-of-veterans-affairs/component-library/dist/react-bindings'; | ||
import { Toggler } from 'platform/utilities/feature-toggles'; | ||
import formConfig from '../config/form'; | ||
import WIP from '../../shared/components/WIP'; | ||
import { useBrowserMonitoring } from '../helpers/useBrowserMonitoring'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reordered, nothing important here.
…artment-of-veterans-affairs/vets-website into 98828-monitoring-rum-dashboard-setup
const useBrowserMonitoring = () => { | ||
// Retrieve feature flag values to control behavior | ||
const selectFeatureToggles = useMemo(makeSelectFeatureToggles, []); | ||
const featureToggles = useSelector(selectFeatureToggles); | ||
const { isBrowserMonitoringEnabled, isLoadingFeatureFlags } = featureToggles; | ||
|
||
useEffect( | ||
() => { | ||
if (isLoadingFeatureFlags) return; | ||
if (isBrowserMonitoringEnabled) { | ||
initializeRealUserMonitoring(); | ||
} else { | ||
delete window.DD_RUM; | ||
} | ||
}, | ||
[isBrowserMonitoringEnabled, isLoadingFeatureFlags], | ||
); | ||
}; | ||
|
||
export { useBrowserMonitoring }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on existing RUM config examples in vets-website. Uses memoized feature toggle info when initializing RUM.
import { createSelector } from 'reselect'; | ||
import { toggleValues } from '@department-of-veterans-affairs/platform-site-wide/selectors'; | ||
import FEATURE_FLAG_NAMES from '@department-of-veterans-affairs/platform-utilities/featureFlagNames'; | ||
|
||
const selectFeatureToggles = createSelector( | ||
state => ({ | ||
isLoadingFeatureFlags: state?.featureToggles?.loading, | ||
isBrowserMonitoringEnabled: toggleValues(state)[ | ||
FEATURE_FLAG_NAMES.form1010dBrowserMonitoringEnabled | ||
], | ||
}), | ||
toggles => toggles, | ||
); | ||
|
||
const makeSelectFeatureToggles = () => selectFeatureToggles; | ||
|
||
export { makeSelectFeatureToggles }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on existing RUM config examples in vets-website. Creates a redux selector so these extra bits of state can be derived rather than directly stored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ESLint is disabled
vets-website
uses ESLint to help enforce code quality. In most situations we would like ESLint to remain enabled.
What you can do
See if the code can be refactored to avoid disabling ESLint, or wait for a VSP review.
Are you removing, renaming or moving a folder in this PR?
Did you change site-wide styles, platform utilities or other infrastructure?
Summary
This PR adds the RUM initialization to form 10-10d so it can be monitored in this dashboard. Feature is behind a flipper (matching BE PR) so it can be first tested in staging.
Related issue(s)
Testing done
Screenshots
NA
What areas of the site does it impact?
This form only.
Acceptance criteria
Quality Assurance & Testing
Error Handling
Authentication
Requested Feedback
NA