Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-5840

Heartbeat durations are measured incorrectly

    • 3
    • Not Needed
    • Hide

      Create a copy of the Kickoff Template with the issue key (NODE-XXX) in the filename and share a link to the new doc via this field.

      Show
      Create a copy of the Kickoff Template with the issue key (NODE-XXX) in the filename and share a link to the new doc via this field.
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Following investigation into DRIVERS-2677, it was discovered that the Node driver measures heartbeat duration incorrectly. On initial creation of a monitoring connection, the heartbeat duration calculation includes the time taken to establish the initial TCP connection as well as the time to send a hello/legacy hello and receive a response from the server. This goes against the definition of the heartbeat duration for ServerHeartbeatSucceeded and ServerHeartbeatFailed events as laid out in the SDAM Events API spec.

       

      From local testing, when connecting to an Atlas cluster with the driver, this consistently results in initial heartbeat durations of ~200ms with median durations of 21ms.

      Use Case

      As a Driver Engineer
      I want to measure heartbeat duration from just before the call to hello/legacy hello
      So that heartbeat duration is measured accurately.

      User Impact

      • None

      Dependencies

      • upstream and/or downstream requirements and timelines to bear in mind

      Unknowns

      • Will this clash with CSOT implementation?

      Acceptance Criteria

      Implementation Requirements

      • Update checkServer in src/sdam/monitor.ts to properly record duration of heartbeat as the time between sending a hello and receiving a response in all cases

      Testing Requirements

      • Write unit tests that assert that the first heartbeat has a duration that is more consistent with subsequent heartbeats.
        • Using mock local server so that it is integration-like

      Documentation Requirements

      • None

      Follow Up Requirements

      • additional tickets to file, required releases, etc

            Assignee:
            neal.beeken@mongodb.com Neal Beeken
            Reporter:
            warren.james@mongodb.com Warren James
            Alena Khineika, Warren James
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: