Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-5270

Server selection logs remainingTimeMS in seconds not milliseconds

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 4.12
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Python Drivers
    • 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?
    • None
    • None
    • None
    • None
    • None
    • None

      Server selection logs remainingTimeMS in seconds not milliseconds:

      2025-04-04 15:50:54,456 DEBUG logger {"message": "Waiting for suitable server to become available", "selector": "Primary()", "operation": "find", "topologyDescription": "<TopologyDescription id: 67f0624ee2150dc865f9bef6, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('cluster0-shard-00-00-gh2ak.mongodb.net', 27017) server_type: Unknown, rtt: None>, <ServerDescription ('cluster0-shard-00-01-gh2ak.mongodb.net', 27017) server_type: Unknown, rtt: None>, <ServerDescription ('cluster0-shard-00-02-gh2ak.mongodb.net', 27017) server_type: Unknown, rtt: None>]>", "clientId": {"$oid": "67f0624ee2150dc865f9bef6"}, "remainingTimeMS": 29}
      

      The bug is here:
      https://github.com/mongodb/mongo-python-driver/blob/b40223938c9646e0b1a8f60d22e36120991b394d/pymongo/asynchronous/topology.py#L357

                      _debug_log(
                          _SERVER_SELECTION_LOGGER,
                          message=_ServerSelectionStatusMessage.WAITING,
                          ...
                          remainingTimeMS=int(end_time - time.monotonic()),
      

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: