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 the requestId to the Apollo context and include it in logs #191

Merged
merged 3 commits into from
Feb 3, 2025

Conversation

briri
Copy link
Collaborator

@briri briri commented Jan 31, 2025

Description

Fixes #190

  • Added requestId to the Apollo context
  • Updated the formatLogMessage function so that it includes the following fields (when available) on each request: requestId, jti and userId

@jupiter007 the core changes are in src/context.ts and src/logger.ts the majority of the other changes are updated to accommodate the fact that formatLogMessage now take the Apollo context as its argument instead of logger

Type of change

Please delete options that are not relevant

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Include any relevant details for your test configuration.

All unit tests are passing, the Apollo server loads and I can run queries in the explorer

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I updated the CHANGELOG.md and added documentation if necessary
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@briri briri requested a review from jupiter007 January 31, 2025 23:27
Copy link
Collaborator

@jupiter007 jupiter007 left a comment

Choose a reason for hiding this comment

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

LGTM

@jupiter007
Copy link
Collaborator

Thanks @briri

@briri briri merged commit 9ef9b8a into development Feb 3, 2025
@briri briri deleted the feature/BR-better-errors branch February 3, 2025 16:12
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.

2 participants