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

perf(NODE-5854): Conditional logger instantiation and precompute willLog perf fix #3984

Merged
merged 13 commits into from
Feb 9, 2024

Conversation

aditi-khare-mongoDB
Copy link
Contributor

@aditi-khare-mongoDB aditi-khare-mongoDB commented Feb 2, 2024

Description

Misc perf improvements to logger.

What is changing?

new MongoLogger is only instantiated on the MongoClient when at least one of the component severities is turned on.
willLog is now a precomputed nested object rather than a function call (access is cheaper than a function)

Is there new documentation needed for these changes?

Not until logging is released NODE-5672

What is the motivation for this change?

To align with the company wide perf initiative and ensure that the logger is optimized.

Double check the following

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@aditi-khare-mongoDB aditi-khare-mongoDB changed the title Node 5854/logger instantiation will log perf fix perf(NODE-5854): Logger instantiation will log perf fix Feb 2, 2024
@aditi-khare-mongoDB aditi-khare-mongoDB marked this pull request as ready for review February 2, 2024 22:54
@alenakhineika alenakhineika self-assigned this Feb 5, 2024
@alenakhineika alenakhineika added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Feb 5, 2024
@alenakhineika
Copy link
Contributor

Could you double-check the list in the PR description? To make sure that all requirements are met.

src/mongo_logger.ts Outdated Show resolved Hide resolved
@aditi-khare-mongoDB aditi-khare-mongoDB changed the title perf(NODE-5854): Logger instantiation will log perf fix perf(NODE-5854): Logger instantiation and precompute willLog perf fix Feb 5, 2024
@aditi-khare-mongoDB aditi-khare-mongoDB changed the title perf(NODE-5854): Logger instantiation and precompute willLog perf fix perf(NODE-5854): Conditional logger instantiation and precompute willLog perf fix Feb 5, 2024
alenakhineika
alenakhineika previously approved these changes Feb 6, 2024
@alenakhineika alenakhineika added Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels Feb 6, 2024
src/mongo_client.ts Outdated Show resolved Hide resolved
src/mongo_logger.ts Outdated Show resolved Hide resolved
src/mongo_logger.ts Outdated Show resolved Hide resolved
src/mongo_logger.ts Outdated Show resolved Hide resolved
src/mongo_logger.ts Outdated Show resolved Hide resolved
src/mongo_logger.ts Outdated Show resolved Hide resolved
src/mongo_logger.ts Show resolved Hide resolved
test/unit/mongo_logger.test.ts Outdated Show resolved Hide resolved
test/unit/mongo_logger.test.ts Outdated Show resolved Hide resolved
src/mongo_logger.ts Show resolved Hide resolved
Co-authored-by: Durran Jordan <durran@gmail.com>
@durran durran merged commit a63fbc2 into main Feb 9, 2024
24 of 27 checks passed
@durran durran deleted the NODE-5854/logger-instantiation-will-log-perf-fix branch February 9, 2024 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team Review Needs review from team
Projects
None yet
4 participants