[SERVER-10637] Provide a mechanism to expose the connectionId so that drivers can log it Created: 28/Aug/13  Updated: 18/Jan/22  Resolved: 05/Jun/18

Status: Closed
Project: Core Server
Component/s: Networking
Affects Version/s: None
Fix Version/s: 4.1.1

Type: New Feature Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Anthony Roy
Resolution: Done Votes: 4
Labels: neweng, service_architecture
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-24611 Implement ClientMetadata class Closed
is depended on by CSHARP-4014 Remove code to run `getLastError` com... Backlog
is depended on by CSHARP-2571 Prefer connectionId from isMaster res... Closed
is depended on by JAVA-1109 Allow killing of ops Closed
is depended on by JAVA-3255 Prefer connectionId from isMaster res... Closed
Documented
is documented by DOCS-12974 Document "connectionId" in isMaster Closed
Related
is related to DRIVERS-360 Could the server remove support for g... Closed
is related to DRIVERS-2106 Include local ephemeral port in APM c... Backlog
Backwards Compatibility: Fully Compatible
Sprint: Platforms 2018-06-04, Platforms 2018-06-18
Participants:

 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.



 Comments   
Comment by Anthony Roy [ 05/Jun/18 ]

connectionId has been added to the isMaster response.

Comment by Githook User [ 05/Jun/18 ]

Author:

{'username': 'Ant2888', 'name': 'Anthony Roy', 'email': 'anthony.roy@10gen.com'}

Message: SERVER-10637 Add connectionId to isMaster response

Added connectionId to allow drivers to correlate client-side conections with
server-side log messages
Branch: master
https://github.com/mongodb/mongo/commit/1065b4b16ee060b99713d75e4e822dcbe6b08ea7

Comment by Robert Stam [ 29/Oct/14 ]

The best solution would be to add the connectionId to the isMaster response.

Drivers are already calling isMaster.

Comment by Scott Hernandez (Inactive) [ 11/Sep/14 ]

Currently the shell kills ops, during shutdown, by using "whatMyUri" then killing anything from currentOps which has that client address.

This command could return the connectionId as well.

Generated at Thu Feb 08 03:23:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.