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

fix(NODE-5818): Add feature flagging to server selection logging #3974

Merged
merged 3 commits into from Feb 15, 2024

Conversation

aditi-khare-mongoDB
Copy link
Contributor

@aditi-khare-mongoDB aditi-khare-mongoDB commented Jan 23, 2024

Description

Add feature flagging to server selection logging, so that event instances are only created when willLog returns true for the logging configuration.

EVG Perf Analysis Results

Upon comparing the perf results of NODE-5818's changes to the commit before server selection logging was merged (b93d405, there are no significant regressions through this commit.
Both commits were rerun at the same time to ensure no ci changes influence the results.

Here is the Spreadsheet Link.

What is changing?

Same as above.

Is there new documentation needed for these changes?

No.

What is the motivation for this change?

Before: (Due to server selection logging merge NODE-4687)
findOne - 6% throughput reduction
runCommand - 9% throughput reduction
smallDocInsertOne - 6.5% throughput reduction

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

@nbbeeken nbbeeken changed the title fix(Node 5818): Add feature flagging to server selection logging fix(NODE-5818): Add feature flagging to server selection logging Jan 23, 2024
@durran
Copy link
Member

durran commented Jan 24, 2024

Am I correct in analysing this that, for example, findOne on these changes is slower than the mainline?

Screenshot 2024-01-24 at 20 02 30

@aditi-khare-mongoDB
Copy link
Contributor Author

aditi-khare-mongoDB commented Jan 24, 2024

Bookkeeping:
Screenshot 2024-01-24 at 3 13 03 PM

With newest rebase to main (includes the logging runtime error handling changes), this is a perf improvement / stabalization

@aditi-khare-mongoDB
Copy link
Contributor Author

aditi-khare-mongoDB commented Jan 25, 2024

Perf Analysis Results

Evergreen Trends
Upon comparing the perf results of NODE-5818's changes to the commit before server selection logging was merged (b93d405, there are no significant regressions through this commit.
Both commits were rerun at the same time to ensure no ci changes influence the results.

Here is the Spreadsheet Link.

@aditi-khare-mongoDB aditi-khare-mongoDB marked this pull request as draft January 25, 2024 22:55
@aditi-khare-mongoDB aditi-khare-mongoDB marked this pull request as ready for review January 30, 2024 19:43
@alenakhineika alenakhineika self-assigned this Feb 1, 2024
@alenakhineika alenakhineika added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Feb 1, 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 2, 2024
alenakhineika
alenakhineika previously approved these changes Feb 5, 2024
@W-A-James W-A-James self-requested a review February 5, 2024 20:49
W-A-James
W-A-James previously approved these changes Feb 5, 2024
@alenakhineika
Copy link
Contributor

The PR is approved by the team, but blocked by DEVPROD-4523 and can be merged only when the waterfall is fixed.

Also flaky tests: NODE-5897, NODE-5498, NODE-5803

Copy link
Member

@durran durran left a comment

Choose a reason for hiding this comment

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

I think we just need to rebase now, remove the willLog checks, and then make all calls to the mongologger use topology.client.mongoLogger?.debug() now.

@aditi-khare-mongoDB
Copy link
Contributor Author

@durran what is your reasoning for removing the willLog / feature flagging checks?

Sinon stub issue with testing, almost ready for review

added test, ready for review

Removed extranous changes from other PR

lint fix

made all mongoLogger accesses in topology.ts be conditional
@aditi-khare-mongoDB aditi-khare-mongoDB force-pushed the NODE-5818/server-selection-regression branch from 72195b1 to 0751030 Compare February 12, 2024 15:59
@durran
Copy link
Member

durran commented Feb 13, 2024

@durran what is your reasoning for removing the willLog / feature flagging checks?

@aditi-khare-mongoDB The logger instantiation PR refactored the log method in the client logger to check willLog first and return if it won't log. debug is bound to log so it's going to check that first as well - I don't see the need for the redundant check to willLog. That's why I thought this PR would just go away.

@aditi-khare-mongoDB
Copy link
Contributor Author

aditi-khare-mongoDB commented Feb 13, 2024

@durran
I see. The log method always checked willLog or some similar method (compareSeverities) before logging the message. See this PR (a random logging PR from before the logger instantiation PR), for reference.

The focus of this PR is so that a ServerSelectionEvent instance is only created if willLog returns true, and the log call only occurs after the ServerSelectionEvent instance is created. This is why, I am of the opinion that we should add a willLog check before we call MongoLogger?.debug or MongoLogger?.info.

@mongodb mongodb deleted a comment from mongo-node-bot Feb 15, 2024
@durran
Copy link
Member

durran commented Feb 15, 2024

@durran I see. The log method always checked willLog or some similar method (compareSeverities) before logging the message. See this PR (a random logging PR from before the logger instantiation PR), for reference.

The focus of this PR is so that a ServerSelectionEvent instance is only created if willLog returns true, and the log call only occurs after the ServerSelectionEvent instance is created. This is why, I am of the opinion that we should add a willLog check before we call MongoLogger?.debug or MongoLogger?.info.

Ah ok, thanks for clarifying that. Then I think we can proceed here.

@durran durran merged commit 55203ef into main Feb 15, 2024
23 of 25 checks passed
@durran durran deleted the NODE-5818/server-selection-regression branch February 15, 2024 16:49
@alenakhineika alenakhineika removed the Team Review Needs review from team label Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants