Skip to content

Move correlation ID to store#1465

Merged
tdonohue merged 6 commits intoDSpace:mainfrom
atmire:move-correlation-id-to-store
Jan 14, 2022
Merged

Move correlation ID to store#1465
tdonohue merged 6 commits intoDSpace:mainfrom
atmire:move-correlation-id-to-store

Conversation

@ybnd
Copy link
Copy Markdown
Member

@ybnd ybnd commented Dec 20, 2021

References

Description

Short summary of changes (1-2 sentences).

Instructions for Reviewers

List of changes in this PR
  • A correlationId field was added to the store, where it can be initialized both server- and client-side
  • A service was added to resolve the correlationId from a cookie or the store, or generate it on demand if there isn't one yet.
  • Initialization logic was moved from AppModule to BrowserAppModule & ServerAppModule in order to initialize after the store is rehydrated. Because of this the client can pick up a correlation ID generated by the server if it doesn't have a cookie yet.
Testing
  1. Start up a local Rest server and the UI using this PR branch in prod mode
  2. Clear cookies or open an incognito window
  3. In the Rest server logs, check that the correlation ID is present for all calls made by the node server
  4. In the netwerk tab of the browser, verify that the same correlation ID is used in the request headers of the client side calls

Checklist

This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome). If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!

  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes TSLint validation using yarn run lint
  • My PR doesn't introduce circular dependencies
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • If my PR includes new, third-party dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.

@artlowel artlowel added bug e/3 Estimate in hours high priority labels Dec 20, 2021
@artlowel artlowel added this to the 7.2 milestone Dec 20, 2021
Comment thread src/app/correlation-id/correlation-id.service.spec.ts Outdated
@ybnd
Copy link
Copy Markdown
Member Author

ybnd commented Dec 20, 2021

Looks like there were some other test failures hiding behind the fdescribe. Not sure what's causing those rn, will take a closer look tomorrow

Copy link
Copy Markdown
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Tested and this works. Thanks @ybnd ! I've verified that the first request has the Correlation ID set, and that the backend logs almost never have "unknown unknown" (except briefly during authentication, but that's expected based on backend's behavior)

That said, I have two very minor requests for this PR before we merge it. I'd appeciate it if you could add some more TypeDocs or basic comments to code files that do not have any comments. See inline below. Once those are added, I feel this could be merged.

Comment thread src/app/correlation-id/correlation-id.actions.ts
Comment thread src/app/correlation-id/correlation-id.reducer.ts
@ybnd ybnd force-pushed the move-correlation-id-to-store branch from dd625ac to c1e8bbb Compare December 23, 2021 15:56
@lgtm-com
Copy link
Copy Markdown

lgtm-com Bot commented Dec 23, 2021

This pull request introduces 2 alerts when merging c1e8bbb into ba268d4 - view on LGTM.com

new alerts:

  • 2 for Unused variable, import, function or class

Copy link
Copy Markdown
Contributor

@atarix83 atarix83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @ybnd

LGTM. I've tested and verified that it works properly

@tdonohue tdonohue merged commit 710d893 into DSpace:main Jan 14, 2022
@tdonohue tdonohue mentioned this pull request Jan 14, 2022
6 tasks
4science-it pushed a commit to 4Science/dspace-angular that referenced this pull request Mar 29, 2024
Dspace cris 2023 02 x DSC-1454

Approved-by: Vincenzo Mecca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CORRELATION_ID doesn't exist for first request of every client and for every request of non-JS clients

4 participants