vets-website icon indicating copy to clipboard operation
vets-website copied to clipboard

Added Datadog Logging

Open ianmagenta opened this issue 1 year ago • 7 comments

Summary

Added Datadog logging package and included logging calls alongside Google Analytics calls for each Identity component.

Related issue(s)

https://github.com/department-of-veterans-affairs/va.gov-team/issues/75258

What areas of the site does it impact?

This impacts various Identity components throughout the site including RenderErrorContainer, AuthApp, AuthMetrics, VerifyApp, CreateAccountLink, LoginButton, SessionTimeoutModal, SignInModal, and VerifyAccountLink,

Acceptance criteria

  • [x] Add Datadog Logging package and add logs alongside Google Analytics calls in all relevant Identity components.

ianmagenta avatar Feb 14 '24 19:02 ianmagenta

Turns out that the Datadog logging package was merged into main while this PR was up: https://github.com/department-of-veterans-affairs/vets-website/pull/27567. I've gone ahead and removed that addition from this PR.

ianmagenta avatar Feb 15 '24 01:02 ianmagenta

@ianmagenta Also I noticed when running the unit tests there are some failures

yarn test:unit --app-folder=auth => AuthApp & AuthMetrics, most likely you'll need to add information to the session storage. YOu might want to also double-check the authentication/utilities unit test too.

asg5704 avatar Feb 26 '24 21:02 asg5704

@asg5704 - I can refactor the switch statement to avoid disabling eslint, but the tests currently expect it to use fallthrough behavior. Feel free to let me know what you think!

ianmagenta avatar Feb 26 '24 23:02 ianmagenta

@asg5704 - I can refactor the switch statement to avoid disabling eslint, but the tests currently expect it to use fallthrough behavior. Feel free to let me know what you think!

Yeah let's not disable ESLint, we can consolidate this to

switch(this.type) {
// .. rest above
case POLICY_TYPES.CUSTOM /* type=custom is used for SSOe auto login */:
case POLICY_TYPES.MHV_VERIFIED: /* type=mhv_verified */
case CSP_IDS.MHV:
case CSP_IDS.DS_LOGON:
case CSP_IDS.ID_ME:
case CSP_IDS.LOGIN_GOV:
case CSP_IDS.VAMOCK:
  dataDogLog({
    name: LOG_NAME.LOGIN_SUCCESS,
    payload: {
      ...ddPayload,
      ...(this.type === POLICY_TYPES.CUSTOM && { autoSSO: true }),
    },
    status: STATUS_TYPE.INFO,
  });
  recordEvent({ event: `login-success-${this.serviceName}` });
  this.compareLoginPolicy();
  break;
// .. rest below
}

asg5704 avatar Feb 27 '24 17:02 asg5704

@asg5704 - Sorry, it looks like it auto-dismissed your review when I pushed up the changes.

ianmagenta avatar Feb 27 '24 17:02 ianmagenta

PR has failing required tests, opting not to review at this time. - Tier 2/FE COP

Andrew565 avatar Mar 01 '24 15:03 Andrew565

Code Scanning Analysis Not Found

Your repository default branch has not been scanned with CodeQL in the last 7 days. Per VA policy your repository must use CodeQL to scan your source code for vulnerabilities at least once every 7 days against your default branch.

Once you have completed the scan against your default branch, follow this link to re-run the policy check and select Re-run all jobs at the top of the page: https://github.com/department-of-veterans-affairs/vets-website/actions/runs/8788942041

github-actions[bot] avatar Apr 22 '24 18:04 github-actions[bot]