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-5840): heartbeat duration includes socket creation #3973

Merged
merged 9 commits into from Jan 30, 2024

Conversation

nbbeeken
Copy link
Contributor

@nbbeeken nbbeeken commented Jan 23, 2024

Description

What is changing?

  • Refactor connect to be async
  • Rename and refactor makeConnection -> makeSocket
  • Add makeConnection function
  • Refactor monitor to record start time after socket is created, before handshake
  • socket failures set heartbeat failed duration to -1
  • Refactor tests using callback style connect
  • Test duration does not include socket creation by artificially delaying it
Is there new documentation needed for these changes?

What is the motivation for this change?

The duration field of hb started and failed should match the definition in the spec.

Release Highlight

Fixed heartbeat duration including socket creation

The ServerHeartbeatSucceeded and ServerHeartbeatFailed event have a duration property that represents the time it took to perform the hello handshake with MongoDB. The Monitor responsible for issuing heartbeats mistakenly included the time it took to create the socket in this field, which inflates the value with the time it takes to perform a DNS lookup, TCP, and TLS handshakes.

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 NODE-5840-fix-duration fix(NODE-5840): heartbeat duration includes socket creation Jan 23, 2024
@nbbeeken nbbeeken marked this pull request as ready for review January 24, 2024 20:55
@alenakhineika alenakhineika self-assigned this Jan 25, 2024
@alenakhineika alenakhineika added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Jan 25, 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 Jan 26, 2024
@W-A-James W-A-James self-requested a review January 26, 2024 20:56
@W-A-James W-A-James merged commit a42039b into main Jan 30, 2024
19 of 27 checks passed
@W-A-James W-A-James deleted the NODE-5840-fix-duration branch January 30, 2024 21:41
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
3 participants