Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

michaelclement
Copy link
Contributor

@michaelclement michaelclement commented Dec 26, 2024

Are you removing, renaming or moving a folder in this PR?

  • No, I'm not changing any folders (skip to TeamSites and delete the rest of this section)
  • Yes, I'm removing, renaming or moving a folder

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

  • Unit

Screenshots

NA

What areas of the site does it impact?

This form only.

Acceptance criteria

Quality Assurance & Testing

  • I fixed|updated|added unit tests and integration tests for each feature (if applicable).
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs
  • Linting warnings have been addressed
  • Documentation has been updated (link to documentation *if necessary)
  • Screenshot of the developed feature is added
  • Accessibility testing has been performed

Error Handling

  • Browser console contains no warnings or errors.
  • Events are being sent to the appropriate logging solution
  • Feature/bug has a monitor built into Datadog or Grafana (if applicable)

Authentication

  • Did you login to a local build and verify all authenticated routes work as expected with a test user

Requested Feedback

NA

@va-vfs-bot va-vfs-bot temporarily deployed to master/98828-monitoring-rum-dashboard-setup/main December 26, 2024 21:09 Inactive
Copy link
Contributor Author

@michaelclement michaelclement Dec 26, 2024

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).

Comment on lines +20 to +21
sessionSampleRate: 100,
sessionReplaySampleRate: 100,
Copy link
Contributor Author

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.

Copy link
Contributor Author

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

@va-vfs-bot va-vfs-bot temporarily deployed to master/98828-monitoring-rum-dashboard-setup/main December 26, 2024 21:28 Inactive
cloudmagic80
cloudmagic80 previously approved these changes Dec 27, 2024
Comment on lines +6 to +12
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';
Copy link
Contributor Author

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
Comment on lines +34 to +53
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 };
Copy link
Contributor Author

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.

Comment on lines +1 to +17
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 };
Copy link
Contributor Author

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.

@michaelclement michaelclement marked this pull request as ready for review December 30, 2024 15:49
@michaelclement michaelclement requested a review from a team as a code owner December 30, 2024 15:49
Copy link

@va-vfs-bot va-vfs-bot left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants