Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-10637

Provide a mechanism to expose the connectionId so that drivers can log it

    XMLWordPrintableJSON

Details

    • Fully Compatible
    • Platforms 2018-06-04, Platforms 2018-06-18

    Description

      Sometimes application developers and support engineers need to correlate what's happening in their application with activity in the database, and one easy way to do this would be if drivers could log the server's connectionId for outgoing messages, something like:

      ... inserting 3 documents: server [localhost:27017], connection [conn2400] 
      

      and correlate it with a server log message like:

      Sat Aug 24 00:59:05.598 [conn2400] insert ... ninserted:1 keyUpdates:0 locks(micros) w:313952 313ms
      

      It would also be useful to include the connectionId with any exception thrown by a driver.

      Currently the only command that will return this connectionId is "getlasterror". While drivers can use this (by calling it after connecting and caching the result), it's not ideal. For one, "getlasterror" is likely to be removed in a future release. For another, the server will log this call, and it may confuse people that getlasterror is being called after every connect.

      So the request is to provide some other supported mechanism that will provide the server's connectionId to clients.

      A good solution would be to add the connectionId to the isMaster response. Drivers are already calling isMaster and therefore would be able to discover the server's connectionId without having to issue a separate command requiring an additional network round trip.

      Attachments

        Issue Links

          Activity

            People

              anthony.roy Anthony Roy
              jeff.yemin@mongodb.com Jeffrey Yemin
              Votes:
              4 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: