[SERVER-32094] Add support for mongo shell to send client.application.name in initial isMaster request Created: 27/Nov/17  Updated: 08/Jan/24  Resolved: 23/Jan/18

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: None
Fix Version/s: 3.7.2

Type: Improvement Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Kevin Albertson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-32095 Attach client.application.name to con... Closed
Documented
is documented by DOCS-11246 Documenting support for mongo shell t... Closed
Related
related to SERVER-35309 Connection string option is appname; ... Closed
Backwards Compatibility: Fully Compatible
Sprint: TIG 2018-1-29
Participants:

 Description   

This likely involves adding an additional parameter to the Mongo object constructor and forwarding the metadata to the underlying DBClient instance.

Connection handshake

The isMaster handshake, as of MongoDB 3.4, supports a new argument, client, provided as a BSON object. This object has the following structure::

{
    isMaster: 1,
    client: {
        /* OPTIONAL. If present, the "name" is REQUIRED */
        application: {
            name: "<string>"
        },
        /* REQUIRED, including all sub fields */
        driver: {
            name: "<string>",
            version: "<string>"
        },
        /* REQUIRED */
        os: {
            type: "<string>",         /* REQUIRED */
            name: "<string>",         /* OPTIONAL */
            architecture: "<string>", /* OPTIONAL */
            version: "<string>"       /* OPTIONAL */
        },
        /* OPTIONAL */
        platform: "<string>"
    }
}

https://github.com/mongodb/specifications/blob/5499fd336aaa8d91bdd7cb285fa661f512be72dd/source/mongodb-handshake/handshake.rst#connection-handshake



 Comments   
Comment by Githook User [ 23/Jan/18 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@10gen.com', 'username': 'kevinAlbs'}

Message: SERVER-32094 support appname URI param in shell
Branch: master
https://github.com/mongodb/mongo/commit/805c28ebf2d1df9fefdf9f16726ea5b1ab77c5e9

Comment by Mark Benvenuto [ 02/Jan/18 ]

To answer Max's questions

  1. You could extend MongoExternalInfo::construct to take an application name as a parameter. For the very first request isMaster that is implicitly made on shell startup, you would need to extend the URI parser.
  2. We either need to modify DBDirectClient or MongoLocalInfo to set ClientMetadata in the Client object.
Comment by Gregory McKeon (Inactive) [ 29/Dec/17 ]

mark.benvenuto mira.carey@mongodb.com Can you answer Max's questions here?

Comment by Max Hirschhorn [ 21/Dec/17 ]

greg.mckeon, I think the TIG team could do the work for this ticket, but I'd appreciate a response from the Platform on the questions I raised in my earlier comment.

1. Could we expose a way to have the connection underlying the global db object sent client.application.name in the initial isMaster request? If not, then we can have the concurrent fuzzer do new Mongo(db.getMongo().host, ...).

My impression is that this should happen automatically for the global db object by supporting "appname" as a parameter to the mongo shell's connection string format.

The recommended way for applications to provide this value is through the connection URI. The connection string key is appname.

Example connection string:

mongodb://server:27017/db?appname=mongodump

https://github.com/mongodb/specifications/blob/5499fd336aaa8d91bdd7cb285fa661f512be72dd/source/mongodb-handshake/handshake.rst#clientapplicationname

Comment by Gregory McKeon (Inactive) [ 11/Dec/17 ]

max.hirschhorn do you have bandwidth to work on this? It seems straightforward and like it would be more efficient for you to pick up.

Comment by Max Hirschhorn [ 27/Nov/17 ]

A couple questions around the interface for this feature:

  1. Could we expose a way to have the connection underlying the global db object sent client.application.name in the initial isMaster request? If not, then we can have the concurrent fuzzer do new Mongo(db.getMongo().host, ...).
  2. Is there a equivalent way to attach metadata to the Client object when a DBDirectClient underlies the Mongo connection object?
Generated at Thu Feb 08 04:29:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.