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

Add requestId and sessionId to logs #532

Closed
4 tasks
eleanorreem opened this issue Jul 18, 2024 · 6 comments · Fixed by #727
Closed
4 tasks

Add requestId and sessionId to logs #532

eleanorreem opened this issue Jul 18, 2024 · 6 comments · Fixed by #727
Assignees
Labels
complexity: advanced Time needed to do this ticket will be large e.g. 2-3+ days feature/enhancement New feature or request help-wanted Extra attention is needed javascript Pull requests that update Javascript code priority: soon Should be prioritized soon. stale This issue or PR is inactive. state: approved Ready to go. Not blocked or pending.
Milestone

Comments

@eleanorreem
Copy link
Contributor

Overview

We currently don't log request IDs or session IDs in our logs. These would be hugely helpful with debugging. Every time we call logger.log or logger.error, the output should be decorated with both requestIds and sessionIds. We are currently refactoring/ improving our logs so any suggestions for improving are welcome.

Action Items

Resources/Instructions

@eleanorreem eleanorreem added feature/enhancement New feature or request help-wanted Extra attention is needed complexity: advanced Time needed to do this ticket will be large e.g. 2-3+ days priority: soon Should be prioritized soon. state: approved Ready to go. Not blocked or pending. javascript Pull requests that update Javascript code labels Jul 18, 2024
@kyleecodes kyleecodes added this to the 02. Roadmaps milestone Jul 18, 2024
@kyleecodes kyleecodes moved this to To-Do Bloom Backend in Chayn Tech Volunteer Advancement Jul 18, 2024
@chinmaym07
Copy link

@eleanorreem can I try my hands on this ?

Copy link

Thank you @chinmaym07 you have been assigned this issue!
Please follow the directions in our Contributing Guide. We look forward to reviewing your pull request shortly ✨


Support Chayn's mission? ⭐ Please star this repo to help us find more contributors like you!
Learn more about Chayn here and explore our projects. 🌸

@github-actions github-actions bot added the stale This issue or PR is inactive. label Sep 16, 2024
@kyleecodes kyleecodes removed the stale This issue or PR is inactive. label Oct 22, 2024
@leoseg
Copy link
Contributor

leoseg commented Nov 26, 2024

Hi @chinmaym07 are you still working at this? If not I would like to pick up the issue :) As I see the logging.interceptor already logs the user id of the request as well as the IP, what exactly would the request-ID be? About logging the origin IP of the request, I'm not sure if this could be a privacy issue or what do you think about this?:) Also I there is already a session and session-user but as far as I understand those have different meanings than web sessions, here is a solution for sessions which could the already existing Firebase, maybe this would be a solution!

Copy link

github-actions bot commented Dec 5, 2024

Thank you @leoseg you have been assigned this issue!
Please follow the directions in our Contributing Guide. We look forward to reviewing your pull request. ✨


Support Chayn's mission? ⭐ Please star this repo to help us find more contributors like you!
Learn more about our impact and sign-up for our volunteer programsto join our mission!. 🌸

@eleanorreem
Copy link
Contributor Author

@leoseg thanks for this! And good catch on the privacy issue.

We are planning to remove IP addresses from our logs as we don't need that information, thank you for the reminder. I am going to prioritise that today.

I think we would want to log the requestId separate from the userId as the userId can make multiple requests at the same ID. A quick google brought me to this suggestion but alternative methods would be valid.

Thanks for your help so far!

leoseg added a commit to leoseg/bloom-backend that referenced this issue Dec 6, 2024
leoseg added a commit to leoseg/bloom-backend that referenced this issue Dec 9, 2024
@leoseg
Copy link
Contributor

leoseg commented Dec 9, 2024

Hi @eleanorreem I created a first pull request here, to hear your thoughts about my implementation idea for logging the request id and session id. I have some problems with my local setup in the moment so until now I only ran the unit tests but I'm on it and let you hear when I did manually test everything.

leoseg added a commit to leoseg/bloom-backend that referenced this issue Dec 10, 2024
leoseg added a commit to leoseg/bloom-backend that referenced this issue Dec 15, 2024
leoseg added a commit to leoseg/bloom-backend that referenced this issue Dec 15, 2024
leoseg added a commit to leoseg/bloom-backend that referenced this issue Dec 29, 2024
leoseg added a commit to leoseg/bloom-backend that referenced this issue Dec 29, 2024
leoseg added a commit to leoseg/bloom-backend that referenced this issue Dec 29, 2024
leoseg added a commit to leoseg/bloom-backend that referenced this issue Dec 29, 2024
leoseg added a commit to leoseg/bloom-backend that referenced this issue Dec 29, 2024
leoseg added a commit to leoseg/bloom-backend that referenced this issue Dec 29, 2024
leoseg added a commit to leoseg/bloom-backend that referenced this issue Dec 29, 2024
@github-actions github-actions bot added the stale This issue or PR is inactive. label Jan 13, 2025
kyleecodes added a commit that referenced this issue Jan 13, 2025
* #532 Added session and request logging to each logger message using cls

* #532 Fixxed errors in unit tests

* #532 Updated cls service injection

* #532 Added error handling for logger

* #532 Updated yarn dependencies

* #532 Add condition for user.lastActiveAt if its the first login so

* #532 Added await in crisp service so error is caught in async function

* Update package.json

Fix syntax, missing comma

---------

Co-authored-by: Kylee Fields <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: advanced Time needed to do this ticket will be large e.g. 2-3+ days feature/enhancement New feature or request help-wanted Extra attention is needed javascript Pull requests that update Javascript code priority: soon Should be prioritized soon. stale This issue or PR is inactive. state: approved Ready to go. Not blocked or pending.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants